Deposit Locker
An overview of the CCDM Deposit Locker
The Deposit Locker is a singleton contract that holds deposits on the source chain and handles the bridging of deposits to the destination chain. It receives inflows of deposits from Royco Recipe IAMs on the source chain and bridges outflows of deposits to the Deposit Executor on the destination chain. Here is a rundown on how the Deposit Locker functions:
Deposits
Whenever an offer is filled in a CCDM enabled market, funds are automatically deposited by the AP's Weiroll Wallet into the Deposit Locker.
Deposits are held by the Deposit Locker until they are bridged or withdrawn.
Withdrawals
Withdrawals are not enabled by default
In the rare case that they are needed, the Deposit Locker Owner can eternally halt all deposits and bridges for the market and enable withdrawals.
Then
executeWithdrawalScript()
can be called after the Weioll Wallet's locktime has elapsed.Sends the deposit amount back to the AP.
Does not forfeit any incentives.
Individual Deposit Recipe IAMs
Withdrawals are enabled by default
Depositors can withdraw their deposits on a Weiroll Wallet specific basis from the Deposit Locker in one of two scenarios:
Calling
forfeit()
in the case of forfeitable IAMs through the Recipe Market Hub.This will forfeit any incentives allocated to the depositor and automatically trigger the withdrawal recipe: sending the original deposit amount back to the AP.
Calling
executeWithdrawalScript()
after the Weioll Wallet's locktime has elapsed.This will happen in the rare case that the deposit made by the Weiroll Wallet was not bridged to the Deposit Executor before the Weiroll Wallet's unlock timestamp has passed.
Sends the deposit amount back to the AP.
Does not forfeit any incentives.
Note: Deposits cannot be withdrawn from the source chain once they are bridged. They must be withdrawn from the Deposit Executor after the campaign's unlock timestamp has passed on the destination chain.
Bridging Deposits
Bridging deposits from the Deposit Locker to the Deposit Executor is facilitated by LayerZero V2
All tokens are bridged using LZ V2's OFT standard.
Deposits for a particular market are bridgeable by the Market Owner once the rage quit period has elapsed after the Green Lighter gives their green light.
The rage quit period
This duration gives ample time for depositors to withdraw from a market if they change their mind, or they deem the destination action logic to be malicious.
The Deposit Locker exposes these functions to bridge deposits for Merkle Deposit Markets:
Bridging Single Tokens:
merkleBridgeSingleTokens()
Bridging UNI V2 LP Tokens:
merkleBridgeLpTokens()
Individual Deposit Recipe IAMs
The Deposit Locker exposes these functions to bridge deposits for Individual Deposit Markets:
Bridging Single Tokens:
bridgeSingleTokens()
Bridging UNI V2 LP Tokens:
bridgeLpTokens()
Administrative Roles
Deposit Locker Owner
Sets the LayerZero V2 endpoint for the source chain.
Sets the LayerZero EID (Endpoint ID) for the destination chain.
Sets the address of the Deposit Executor on the destination chain.
Sets the wrapped native asset token (i.e. WETH) for the source chain.
Sets the Royco Recipe Market Hub address for the source chain.
Sets the Uniswap V2 Router for the source chain.
Sets the OFT entrypoint (Stargate Pools/Hydra, OFT adapters, etc.) for each supported token.
Sets the Campaign Owner (IP / Party responsible for bridging deposits) for each market.
Delegates a Green Lighter to flag when deposits are bridgeable for each market.
Sets the base gas limit passed to lzReceive on the destination chain when bridging funds. This will be added to whatever gas the OFT passes by default if it has enforced options set for lzReceive.
In the rare case that deposits and bridging need to be permanently disabled for a market, they can halt the market.
Green Lighter
Maintains a holistic view of the entire system (Deposit Locker and Deposit Executor).
Green light markets - rendering their deposits bridgeable after the Rage Quit duration has elapsed (if applicable).
Green lighting should only be done once the destination campaign's deposit recipe and parameters have been thoroughly verified and tested/simulated.
Campaign Owners
This role is played by the same party as the Campaign Owner in the Deposit Executor.
Responsible for bridging deposits for their respective markets.
For UNI V2 LP token markets, the owner is also responsible for setting minimum amounts redeemed for each constituent in the liquidity pool when bridging deposits.
Note: Impermanent loss becomes permanent on bridge, so the thresholds must be set accordingly.
Last updated