Box is an ERC-4626–compatible vault contract designed to manage assets, allocations, and funding in a modular way.
It allows to:
- Hold an underlying asset (e.g. USDC) used for
depositandredeem. allocate/deallocate/reallocateliquidity between the underlying asset and whitelisted tokens.pledge/depledgeassets as collateral andborrow/repaythrough funding modules.
- Slippage controls: Every swap is bounded by an oracle-based slippage check. Cumulative slippage over time is also limited.
- Shutdown mechanism: In case of curator misbehavior, anyone can trigger a
shutdown. This ensures depositors can eventually withdraw through a permissionlesswinddownprocess.
- Allocators will not manipulate weak oracles during allocations.
- Guardian will veto malicious curator proposals.
- Allocators will not deliberately set excessive LTVs that harm depositors.
redeem can't be used as an arbitrage path.
The Box contract define the following roles:
Each Box has one owner, it can:
- Set the curator
- Transfer ownership of the Box
- Set the skim recipient
The owneris a critical role that should be strongly protected.
Each Box has one curator, it can:
- Add/remove an allocator
- Add/remove a feeder (timelocked)
- Set the guardian (timelocked, not during wind-down)
- Trigger a
shutdownprocess - Add new tokens and their oracles (timelocked)
- Remove a token
- Change an existing token’s oracle (timelocked, not during wind-down)
- Add funding modules and facilities (timelocked)
- Add collateral and debt tokens for funding mdoules (timelocked)
- Remove funding modules, facilities, debt and collateral tokens
- Set max slippage (timelocked)
- Increase timelocks
- Decrease timelocks (timelocked)
revokea timelocked action (cancel it before execution)
The curator is an important role that should be strongly protected, but all critical actions can be revoked during a timelock and a compromised curator can be removed by the owner.
Direct depositor in the Box are given the role feeder
depositwhile the Box is active (not inshutdown)withdrawavailable liquidity in normal mode, or all assets duringwinddown
Notice that a Box holder don't need to be a feeder to redeem and transfer a Box token.
allocatefrom the underlying asset to whitelisted tokens (within slippage constraints)deallocatefrom whitelisted tokens to the underlying asset (within slippage constraints)reallocatefrom whitelisted tokens to another whitelisted tokens (within slippage constraints)pledge/depledgethe underlying asset or a token as collateral on a funding module / facilityborrow/repaythe underlying asset or a token as debt on a funding module / facility- Call the
flashfunction with a callback to execute a flashloan-enabled operation
revokea timelocked action from the curator (cancel it before execution)- Trigger a
shutdownprocess recoverfrom a shutdown back to normal mode (only beforewinddownbegins)- Change an existing token’s oracle (only during
winddown)
repaydebtdepledgecollateraldeallocatefrom tokens without a debt balanceallocateto a token with a debt balance (so the debt balance can be repaid)
The curator can add modular funding integrations (IFunding).
Supported modules: Morpho Blue and Aave v3.
- Each module instance belongs to a single Box (constructor parameter).
- Only whitelisted tokens from the parent Box can be used as collateral/debt.
- Only empty modules (no facilities, collateral, or debt tokens) can be added.
facilityDataencodes Morpho Blue market parameters.- Each module instance is tied to a Morpho instance address.
- Borrowing is capped by a max LTV relative to the market’s LLTV.
facilityDatais always empty ("").- Each module is tied to an Aave pool address and a given
eModeparameter.
Box mitigates oracle manipulation and front-running risks by:
- Restricting deposits to whitelisted feeders.
- Limiting withdrawals to available liquidity.
This prevents attackers from depositing at artificially low valuations and redeeming at artificially high valuations.
A Box moves through three possible states:
-
Normal mode
- Deposits, withdrawals, allocations, pledges, and borrowing are active.
-
Shutdown mode
- Triggered by the guardian (or curator).
- New deposits are blocked.
- The guardian may restore normal mode only before wind-down begins.
-
Winddown mode
- Permissionless recovery process.
- Increasing slippage tolerance allows full exit for all feeders.
- Anyone may help unwind positions and repay debt.