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
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.
This will automatically trigger the withdrawal script if specified.
Calling just
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.
This will 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 market are bridgeable 48 hours after the Green Lighter gives its green light
The 48 hour duration is referred to as 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 two functions to bridge deposits:
Each CCDM bridge transaction transmits a payload containing the following information
Per Payload:
Market Hash - The hash of the Royco market that these deposits belong to.
CCDM Nonce - A number used in conjunction with the market hash to identify which CCDM bridge transaction the deposits belong to.
Number of Tokens Bridged - The number of tokens bridged with this CCDM bridge transaction (1 for single tokens and 2 for LP tokens).
Per Depositor Bridged:
Depositor Address - The address of the depositor being bridged.
Deposit Amount - The amount deposited by this depositor sent with this bridge transaction.
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 OFT entrypoint (Stargate Pools/Hydra, OFT adapters, etc.) for each supported token.
Delegates a Green Lighter to flag when deposits are bridgeable for each market.
Green Lighter
Maintains a holistic view of the entire system (Deposit Locker and Executor)
Green lights markets - rendering their deposits bridgeable after 48 hours
Green lighting should only be done once the destination campaign's action logic and parameters have been thoroughly verified and tested/simulated.
LP Market IPs/Owners
Responsible for bridging deposits for LP token markets.
Responsible for setting minimum amounts redeemed for each constituent in the liquidity pool
Note: impermanent loss becomes permanent on bridge, so the thresholds must be set accordingly.
Last updated