Implementation Lab

Simple Vault Deposit and Withdrawal

Practice the basic Vault lifecycle by writing Foundry tests for a complete deposit and withdrawal flow.

What you will practice

  • Deploy MockUSDC and SimpleVault in the Foundry test setup.

  • Mint 100 USDC to Alice.

  • Approve the Vault to transfer Alice's USDC.

  • Deposit 100 USDC into the Vault.

  • Verify totalAssets, totalSupply, Alice's share balance, and the relevant USDC balances after the deposit.

  • Withdraw Alice's complete Vault position.

  • Verify that Alice receives her USDC back and that her share balance, totalAssets, and totalSupply return to zero.

Preparation and completion

Review the associated Learn before starting.

Completion outcome

By the end of this Lab, the learner will be able to write Foundry tests that execute a complete Vault deposit and withdrawal lifecycle and verify that assets, shares, totalAssets, and totalSupply remain consistent.