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

  • Merkle Deposit Recipe IAMs

    • 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:

      1. Calling forfeit() in the case of forfeitable IAMs through the Recipe Market Hub.

        1. This will forfeit any incentives allocated to the depositor and automatically trigger the withdrawal recipe: sending the original deposit amount back to the AP.

      2. Calling executeWithdrawalScript() after the Weioll Wallet's locktime has elapsed.

        1. 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.

        2. Sends the deposit amount back to the AP.

        3. 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

Administrative Roles

Deposit Locker Owner

  1. Sets the LayerZero V2 endpoint for the source chain.

  2. Sets the LayerZero EID (Endpoint ID) for the destination chain.

  3. Sets the address of the Deposit Executor on the destination chain.

  4. Sets the wrapped native asset token (i.e. WETH) for the source chain.

  5. Sets the Royco Recipe Market Hub address for the source chain.

  6. Sets the Uniswap V2 Router for the source chain.

  7. Sets the OFT entrypoint (Stargate Pools/Hydra, OFT adapters, etc.) for each supported token.

  8. Sets the Campaign Owner (IP / Party responsible for bridging deposits) for each market.

  9. Delegates a Green Lighter to flag when deposits are bridgeable for each market.

  10. 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.

  11. In the rare case that deposits and bridging need to be permanently disabled for a market, they can halt the market.

Green Lighter

  1. Maintains a holistic view of the entire system (Deposit Locker and Deposit Executor).

  2. Green light markets - rendering their deposits bridgeable after the Rage Quit duration has elapsed (if applicable).

    1. Green lighting should only be done once the destination campaign's deposit recipe and parameters have been thoroughly verified and tested/simulated.

Campaign Owners

  1. This role is played by the same party as the Campaign Owner in the Deposit Executor.

  2. Responsible for bridging deposits for their respective markets.

  3. 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.

    1. Note: Impermanent loss becomes permanent on bridge, so the thresholds must be set accordingly.

Last updated