Royco
  • Overview
    • Introduction to Royco
    • Key Concepts
    • Applications
  • FOR USERS
    • FAQs
    • How to Use Royco
  • FOR INCENTIVE PROVIDERS
    • Developer Overview
      • Fees on Royco
    • Recipes vs. Vaults IAMs
    • Create an IAM
    • Incentivize IAMs
      • Types of Incentives
      • Place an Incentive Offer
      • Place an Incentive Offer: For Developers
      • Setup a Points Campaign
      • Native Yield
    • Verify a Market
    • Audits
    • Contract Addresses
  • MORE
    • Bug Bounty Program
    • Cross-Chain Deposit Module (CCDM)
      • CCDM Recipe IAMs
      • Deposit Locker
      • Deposit Executor
      • Token Support
      • Audits
      • IP Guide
    • Royco V2
      • Incentive Locker
      • Action Verifiers
      • Multiplier Market Hub
      • Audit
    • Royco SDK
    • Contributing to the Protocol
    • Brand Kit
  • Royco Vaults
    • Royco Vaults: Overview
  • Royco Vaults: Risks
Powered by GitBook
On this page
  • Creating Campaigns
  • Receiving Bridged Deposits
  • Executing Deposit Recipes
  • Withdrawals
  • Making Withdrawals
  • Administrative Roles
  • Deposit Executor Owner
  • Campaign Owners
  • Campaign Verifier
  1. MORE
  2. Cross-Chain Deposit Module (CCDM)

Deposit Executor

An overview of the CCDM Deposit Executor

PreviousDeposit LockerNextToken Support

Last updated 3 months ago

The Deposit Executor is a singleton contract that receives and holds bridged deposits on the destination chain and deploys them into protocols by executing through Weiroll Wallets. It also allows APs to withdraw their deposits once the campaign's unlock timestamp has passed by distributing the receipt tokens for each deposit.

Creating Campaigns

  • IPs create and set the parameters of their Deposit Campaigns

    • Each campaign maps directly to a on the source chain.

      • Campaigns are identified by their corresponding Royco Market's hash on the source chain.

    • Parameters

      • Unlock timestamp

        • The absolute timestamp that deposits for this campaign will be unlocked for withdrawal.

        • All deposits for this campaign will be withdrawable at this timestamp, regardless of when they were bridged and deposited.

      • Receipt token

        • The ERC20 receipt token that will represent a depositor's position in the campaign's corresponding protocol.

        • These tokens must be returned to the Weiroll Wallet when it executes the deposit recipe.

      • Deposit Recipe

        • The that will be executed to deposit funds into this campaign's corresponding protocol.

          • Must give the Deposit Executor a max allowance to spend the receipt token (for withdrawals) and the campaign's input tokens (to refund dust/excess tokens).

        • This recipe must be verified by the before it can be executed.

Receiving Bridged Deposits

  1. Creates one Weiroll Wallet per CCDM Nonce received for a given Market Hash.

    1. If a wallet has already been created, it will use the cached wallet for the following steps.

  2. Stores accounting information for the Weiroll Wallet.

  3. Holds the deposits until the deposit recipe is executed for the Weiroll Wallet.

Executing Deposit Recipes

  • Upon calling executeDepositRecipes(), the following logic is triggered:

    1. The Weiroll Wallet is funded with the total amounts of each token deposited into the wallet.

    2. The deposit recipe is executed by the Weiroll Wallet.

    3. The Deposit Executor checks that:

      1. Receipt tokens were received by the Weiroll Wallet .

      2. The Weiroll Wallet gave max allowance to the Deposit Executor to spend its receipt tokens.

        1. This will be used to distribute receipt tokens to depositors on withdrawal.

      3. The Weiroll Wallet gave max allowance to the Deposit Executor to spend all the campaign's input tokens.

        1. This will be used to distribute dust amounts of deposit tokens to depositors on withdrawal.

Withdrawals

Depositors can withdraw from the Deposit Executor (on a per Weiroll Wallet basis) once the campaign's unlock timestamp has passed. Withdrawals can take one of two flows:

  1. If the Weiroll Wallet has executed the deposit recipe, the depositor withdraws their pro rata share of the receipt tokens from the Weiroll Wallet.

  2. If the Weiroll Wallet has not executed the deposit recipe, the depositor withdraws their original deposit amount for each deposited token.

Making Withdrawals

    • Call withdrawMerkleDeposit() from the address you used to deposit on the source chain and a merkle proof demonstrating that the deposit belongs to you.

      • Can only withdraw 1 deposit per invocation.

    • Call withdrawIndividualDeposits() from the address you used to deposit on the source chain.

      • Can withdraw funds from multiple Weiroll Wallets in a single invocation.

Administrative Roles

Deposit Executor Owner

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

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

  3. Sets the wrapped native asset token (i.e. WETH) for the destination chain.

    1. Campaigns are identified by their corresponding Royco IAM's hash on the source chain.

Campaign Owners

  1. Set the absolute unlock timestamp

    1. This can only be set ONCE.

    2. This is the timestamp that all deposits for your campaign will be withdrawable.

    3. This has to be set to less than 4 months after the the current timestamp in order to disallow unreasonable lock ups.

  2. Set the campaign's receipt token

    1. The receipt token that will represent a depositor's position in the campaign's corresponding protocol.

    2. This can only be set until the first deposit recipe is executed for the campaign.

  3. Set the deposit recipe

      1. Must return receipt tokens and dust to the Weiroll Wallet and give a max allowance to the Deposit Executor to spend them for withdrawals.

    1. This can be set an unbounded amount of times

    2. Every time it is set, the Campaign Verifier must verify the script before it can be executed

Campaign Verifier

  1. Verify a campaign

    1. Should consider that the campaign's input tokens, receipt token, and deposit recipe will work correctly through rigorous testing and simulation.

    2. Deposit recipes can now be executed for this campaign.

  2. Unverify a campaign

    1. Deposit recipes cannot be executed for this campaign.

When the Deposit Executor receives deposits from the , it triggers the following logic:

: The merkle root for all deposits included in this bridge and the total deposit amount accounted for in the merkle tree.

: Each depositor's address and deposit amounts included in this bridge.

For more information on how deposits are bridged, refer to .

are responsible for executing deposit recipes for Weiroll Wallets belonging to their campaign/market.

Sets the address of the on the source chain.

Sets the of each campaign/market

Delegates a to verify campaign parameters

Every time it is set, the must reverify the campaign params before the deposit recipe can be executed

The that will be executed to deposit tokens into the intended DApp/Protocol.

to deposit liquidity into your DApp/Protocol.

Deposit Locker
Deposit Locker
Weiroll Script/Recipe
Weiroll Scripts/Recipes
CCDM enabled market
Weiroll Script/Recipe
Campaign Verifier
Campaign Owners
Campaign Owner
Campaign Verifier
Campaign Verifier
Execute deposit recipes
Merkle Deposit Recipe IAMs
Individual Deposit Recipe IAMs
Merkle Deposit Recipe IAMs
Individual Deposit Recipe IAMs
Bridging Deposits