Skip to content
RED SAGSkills
hardBlockchain Developer interview question

You are building an ERC-4626 yield vault. What design and security issues do you consider?

What the interviewer wants to hear

  • Share price inflation or donation attack on empty vaults; virtual shares or seed deposit
  • Rounding always in favour of the vault
  • Accurate totalAssets that cannot be manipulated, including strategy losses
  • Token quirks: fee-on-transfer, rebasing, decimals
  • Strategy risk, withdrawal limits, reentrancy, and invariant tests

Model answer

The first issue is the inflation or donation attack: an attacker deposits 1 wei, donates a large amount, and later depositors receive zero shares. I use OpenZeppelin's virtual shares with a decimals offset, and also seed the vault with an initial deposit. Rounding must always favour the vault, so deposit and redeem round down for the user, and mint and withdraw round up. totalAssets must be accurate and hard to manipulate: if it reads a pool spot price or a balance anyone can donate to, the share price can be pushed. I handle strategy losses honestly instead of hiding them, and set withdrawal limits through maxWithdraw when liquidity is locked. I decide which tokens are supported and block fee-on-transfer or rebasing ones if not handled. Finally I add reentrancy guards around external strategy calls and write invariant tests, such as "shares never become worth more than the assets backing them".

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Blockchain Developer questions