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

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

    1. Bridging Single Tokens:

          function bridgeSingleTokens(
              bytes32 _marketHash,
              uint128 _executorGasLimit,
              address[] calldata _depositors
          )
    2. Bridging UNI V2 LP Tokens:

          function bridgeLpTokens(
              bytes32 _marketHash,
              uint128 _executorGasLimit,
              uint96 _minAmountOfToken0ToBridge,
              uint96 _minAmountOfToken1ToBridge,
              address[] calldata _depositors
          )
  • 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

  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 OFT entrypoint (Stargate Pools/Hydra, OFT adapters, etc.) for each supported token.

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

Green Lighter

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

  2. Green lights markets - rendering their deposits bridgeable after 48 hours

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

  1. Responsible for bridging deposits for LP token markets.

  2. Responsible for setting minimum amounts redeemed for each constituent in the liquidity pool

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

Last updated