Crystl Finance
Lead Solidity Developer
July 2021 – July 2022
Crystl Finance was a multi-chain vaulting platform that exceeded USD 30 million in TVL at its peak. I led a team of three Solidity developers, working alongside the frontend team, the CEO and the product manager.
Three pieces of work mattered.
Shipping vaults fast, without shipping bugs
At the height of that cycle there were new yield farms appearing daily, and our job was to have vaults live on them quickly. Quickly, but not carelessly — every new farm was a new integration surface.
We semi-automated it: configuration files in the repository, deployment scripts reading directly from those configs. Most farms were forks of two or three base designs, so the strategy contracts rarely needed an overhaul — but there were always quirks, dual-reward farms and unusual reward tokens among them, that needed a careful minimal change rather than a rewrite.
I owned the test suite that gated all of it: contracts deployed onto a forked node against an archive node, exercising deposits, withdrawals and the rest after every change.
The V3 vaults
We were asked for three things the existing contracts could not do: maximizer vaults that compound into a second vault, boosted vaults paying additional rewards on top of the compounding yield, and zap in/out so users could deposit in whatever token they held.
The design question at the outset was how much battle-tested code to keep. In smart contracts, old code that has survived contact with the world is worth a great deal. We decided to overhaul the majority of the vault structure while preserving the core accounting logic.
The hardest part was tracking user shares accurately through multiple levels of vaulting, with users depositing and withdrawing at arbitrary times. That is deceptively difficult — it looks like bookkeeping until you write down the cases. Another engineer and I solved it by going back to first principles and deriving the share mathematics rather than patching it.
Then two engineering problems. The main vault contract grew too large to deploy, so we pared redundant code, extracted functions into external libraries and tuned the optimiser until it fit. And per-vault deployment cost was too high, so we introduced a factory contract to deploy strategy instances.
We tested with Mythril, then took the contracts through a HashEx audit. Both reports are public.
The work won a runner-up prize at the Polygon BuidlIt Hackathon 2022, and second runner-up in the TRON Grand Hackathon 2022.
Launching on a brand-new chain
We deployed to Cronos essentially at its launch, and underestimated what that meant. There was one block explorer, provided by the chain team, and it was unreliable — which made contract verification difficult and manual testing harder still. Parts of our deployment toolchain simply did not work against the chain, so we deployed manually. No archive node existed with any major provider, so our fork-based test suite could not run at all.
We adapted: test the shared functionality on Polygon where the tooling worked, move the contracts across, and test only the chain-specific differences by hand. Not elegant, but it shipped without incident.