project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

ERC4626 Strategy

ERC4626 Vault & Strategy that accepts WETH, mints iUSD on Ironclad (Mode network) and deposits into the Stability Pool

ERC4626 Strategy

Created At

Superhack 2024

Project Description

This project uses the ERC4626 standard to implement a vault and strategy system.

=== VAULT ===

The Vault itself is an ERC4626 vault based on the solmate implementation. I have overridden 3 functions - afterDeposit, beforeWithdrawal, and totalAssets.

The afterDeposit function passes the Wrapped ETH (base asset) over to the Strategy contract. The beforeWithdrawal function withdraws the WETH from the Strategy contract back to the Vault. The totalAssets function accounts for all WETH (both user deposited, and that obtained via the strategy) that the strategy is either in possession of, or has claim to. This function is what is used for the 4626 shares-to-assets/assets-to-shares calculations.

=== STRATEGY ===

The Strategy contract uses the Ironclad protocol to yield additional WETH. Ironclad is forked from the Liquity codebase, meaning it takes in collateral (in our case WETH) and mints a stablecoin against it - in this case "iUSD".

This iUSD is then deposited into the Ironclad Stability Pool, which is a pool of iUSD used to repay undercollateralised loans. Rewards are paid out to Stability Pool depositors.

The rewards that are paid out, however, are not in liquid $ICL (Ironclad) tokens - they are paid in $oICL, or "Ironclad Options Tokens". These oICL are extended ERC20 tokens that allow receivers to exercise an option to purchase the underlying liquid ICL token at a 50% discount to the current market rate.

The Strategy contract claims these oICL and exercises the options on them, receiving liquid ICL tokens in return.

These liquid ICL tokens are then swapped into WETH on Velodrome and re-deposited into Ironclad to mint iUSD, which is once again deposited into the Stability Pool, autocompounding our rewards and increasing the amount of WETH that the vault & strategy have claim to.

How it's Made

This project was built using Foundry. The solmate ERC4626 contract was used for the vault, while a number of Interfaces were used to interface with the various Ironclad contracts, the Redstone oracle contract, and the Velodrome router contract. The vault and strategy contract were deployed to the Mode testnet network.

VAULT_ON_MODE=0x5D1AAd696FF2265a5d8991Cc8f215f83e2355C04 STRATEGY_ON_MODE=0xF06efD836F59B9f7e612A930c5CA2f1B57d3216D

background image mobile

Join the mailing list

Get the latest news and updates