# DeFi Protocol Engineering & Operations

_Case study · anonymised client · 2024 → present_

> 26-month full takeover of a live multi-chain DeFi protocol: contracts, dApp, non-custodial automation, treasury and governance. ~55 repositories, 3,300+ commits, 20+ external audit rounds across 5 firms.

Team: [Aleksi Seppänen](https://azsh.fi/portfolio/people/aleksi-seppanen), [Joonas Valkama](https://azsh.fi/portfolio/people/joonas-valkama), [Maksim Kalashnikov](https://azsh.fi/portfolio/people/maksim-kalashnikov), [Ilkka Pokkinen](https://azsh.fi/portfolio/people/ilkka-pokkinen), [Eero Huhtelin](https://azsh.fi/portfolio/people/eero-huhtelin)
Tags: Smart Contracts, DeFi, Web3, Software Architecture, Audit Remediation, Security, Incident Response, Fullstack Development, Testing, DevOps, Technical Leadership, Governance, Solidity, TypeScript, Next.js, React, wagmi, viem, LayerZero V2, Stargate V2, AWS KMS, Playwright, Vitest, Anvil
Source: https://azsh.fi/portfolio/projects/defi-protocol-engineering-operations

Client anonymised at their request. Figures taken from the live repositories.

## Engagement

2024 → present (26 months). Full takeover of a live multi-chain DeFi protocol: smart contracts, dApp, off-chain automation, treasury tooling and governance, with user funds on-chain throughout.

## Scale

- ~55 repositories
- 3,300+ commits
- 300+ pull requests
- 350+ Solidity sources
- 160+ test suites
- 6 EVM networks
- 20+ external audit rounds across 5 firms

## 1 · cold-start takeover

Inherited a partial black box: unverified contracts, deployer keys and multisigs outside client control, off-chain dependencies never handed over. We mapped on-chain ownership contract by contract, drove staged key/multisig transfer, rewrote unrecoverable components from verified bytecode, and restored three broken redemption paths so stranded users could exit.

## 2 · a productised token framework

Replaced ad-hoc per-asset integrations with one reusable spine (Depositor / Staker / Receipt token / LP staker / FeeDistributor / Whitelist) on UUPS (ERC-1967) proxies with role-based access control, storage-gap regression tests and mainnet-fork tests. Eight asset integrations now ship from it; integration lead time fell from months to weeks.

## 3 · vault engineering

ERC-4626 strategy vaults, later upgraded in place to an ERC-7540-shaped async redeem queue (request → fulfil → claim) separating NAV locking from liquidity. Cross-chain RWA vault on LayerZero V2 + Stargate V2: hub/spoke ABA routing, OFT share tokens, oracle-reported NAV, slippage preflight and explicit failure recovery, shipped with a nine-contract, auditor-grade technical report.

![async redeem vault](https://prod-behind-azsh-424i.encr.app/static/projectimages/defi-solidity.svg)

## 4 · non-custodial automation

Two-service split: a proposer computes and part-signs batches; an independent executor re-validates and co-signs. Each holds its own AWS KMS key against a 2-of-N Safe, so compromising one service cannot move funds. Atomic MultiSend batches, a KV mirror as tamper-evidence layer, and layered gates: per-call cap, UTC-day cumulative cap, structural %-of-capital cap, balance invariants. Scoped and audited as web2 infrastructure, not only as contracts.

## 5 · frontend & quality engineering

Next.js 15 / React 19 / TypeScript / wagmi + viem / RainbowKit. Multichain abstraction without page reloads, a single input auto-routing between AMM swap and contract deposit, dev→staging→prod branch gating. CI runs Playwright end-to-end against a real browser wallet extension under xvfb with screenshot diffing on every PR, plus Vitest integration tests on Anvil mainnet forks.

![reading nav with viem](https://prod-behind-azsh-424i.encr.app/static/projectimages/defi-viem.svg)

## 6 · security & incident response

Three third-party exploits hit held positions. Each was triaged, quantified publicly within days and given a user recovery path; one ended in the client acquiring the failed protocol. An npm supply-chain incident was traced and cleared the same day. Independent transaction-hash verification was added to every multisig signature. At sunset of the absorbed protocol we unwound positions, relinquished upgrade rights and left the contracts immutable and withdrawable indefinitely.

## 7 · governance, legal, comms

- 19 on-chain proposals authored and executed
- delegate participation in three external DAOs
- DAO legal entity registered
- MiCA legal opinion obtained
- jurisdiction gating implemented, then relaxed on counsel
- two years of public weekly engineering reports

## Outcomes

Flagship USD vault independently ranked #2 across all chains by a third-party tracker. LP vaults with consistent performance. A tangled 8–12-token legacy emission system consolidated into a single governance asset, with excess supply burned on a published schedule.

## Available for

- Protocol takeover & technical due diligence
- Solidity architecture and audit remediation
- cross-chain vaults
- key-split operational automation
- dApp and test infrastructure

---

az.sh Oy · contact@azsh.fi · +358 44 055 4838 · HTML version: https://azsh.fi/portfolio/projects/defi-protocol-engineering-operations · Site index: https://azsh.fi/llms.txt
