# IP Guide

IPs using **CCDM** for their cross-chain deposit campaigns should follow this guide: delineating the setup process and IP's responsibilities for each **CCDM** component. Before reading this guide, make sure that you have thoroughly read the [**CCDM Overview**](/more/cross-chain-deposit-module-ccdm.md) section.&#x20;

1. **CCDM Requirements -**&#x20;
   1. A deposit asset which meets the criteria required in the [Token Support](/more/cross-chain-deposit-module-ccdm/token-support.md) page.
   2. After completing a deposit into your protocol/DApp your smart contract must return a receipt token which represents the position. These receipt tokens are distributed among the CCDM depositors on the origin chain to return ownership of the positions to the users. Certain protocols which do not feature a receipt token may opt to deploy a helper wrapper contract which deposits into their protocol and returns a receipt token. These receipt tokens do not need to be fully featured, but must allow passing ownership of the position by transferring the token.
2. **Recipe Market Hub -** Create a [CCDM enabled Royco market](/more/cross-chain-deposit-module-ccdm/ccdm-recipe-iams.md).
3. [**Deposit Executor**](/more/cross-chain-deposit-module-ccdm/deposit-executor.md) **-** Set the parameters of your deposit campaign
   1. Your deposit campaign on the destination chain will be identified by the market hash of the market you created in step 1.
      1. The owner of the [**Deposit Executor**](/more/cross-chain-deposit-module-ccdm/deposit-executor.md) must set you as the owner of the Deposit campaign before you can set and modify the campaign parameters.
   2. Initialize your Campaign by calling this function:&#x20;

      ```solidity
          function initializeCampaign(
              bytes32 _sourceMarketHash,
              uint256 _unlockTimestamp,
              ERC20 _receiptToken,
              Recipe calldata _depositRecipe
          )
      ```

      1. \_sourceMarketHash
         1. The market hash of the market you created in step 1.
      2. \_unlockTimestamp
         1. The **ABSOLUTE** timestamp that **all** deposits in your campaign will be locked until.
         2. At this timestamp, all deposits for your campaign will be withdrawable.
         3. **Note: This value can only be set ONCE.**
      3. \_receiptToken
         1. This is the **ERC20** token that your protocol/DApp will return (as a receipt of the depositor's position) upon executing the deposit recipe.
      4. \_depositRecipe
         1. This is the [**Weiroll Script/Recipe**](https://github.com/weiroll/weiroll) that will deposit the tokens into your protocol/DApp and return the **receipt tokens** to the Weiroll Wallet executing the deposit recipe.
         2. The deposit script must also enforce that the Weiroll Wallet executing the recipe gives maximum allowance to the **Deposit Executor** to spend the receipt tokens.
   3. If you need to modify the receipt token or deposit recipe for some reason, you can call these  functions respectively:&#x20;
      1. **Receipt Tokens can only be modified until the first deposit recipe is executed for a campaign. Every time the receipt token is set, the** [**Campaign Verifier**](/more/cross-chain-deposit-module-ccdm/deposit-executor.md#campaign-verifier) **will need verify it before the deposit recipe can be executed.**

         ```solidity
         function setCampaignReceiptToken(bytes32 _sourceMarketHash, ERC20 _receiptToken)
         ```
      2. **Deposit Recipes can be set as many times as necessary but should be done so with caution. Every time the recipe is set, the** [**Campaign Verifier**](/more/cross-chain-deposit-module-ccdm/deposit-executor.md#campaign-verifier) **will need verify it before it can be executed.**

         ```solidity
         function setCampaignDepositRecipe(bytes32 _sourceMarketHash, Recipe calldata _depositRecipe)
         ```
4. [**Deposit Locker**](/more/cross-chain-deposit-module-ccdm/deposit-locker.md) **-** [Bridge deposits from the **Deposit Locker**](/more/cross-chain-deposit-module-ccdm/deposit-locker.md#bridging-deposits) once the [**green light**](/more/cross-chain-deposit-module-ccdm/deposit-locker.md#green-lighter) has turned on for your market.
   1. If your Royco market intakes [UNI V2 LP tokens](/more/cross-chain-deposit-module-ccdm/token-support.md#uniswap-v2-lp-tokens), you will need to set minimum amounts for each constituent redeemed. Set these with **caution**, as **impermanent loss will become permanent**.
5. [**Deposit Executor**](/more/cross-chain-deposit-module-ccdm/deposit-executor.md) **-** Once your bridged deposits have been received by the deposit executor, [**execute the deposit recipe**](/more/cross-chain-deposit-module-ccdm/deposit-executor.md#executing-deposit-recipes) for the Weiroll Wallet that they belong to:&#x20;

   ```solidity
   function executeDepositRecipes(bytes32 _sourceMarketHash, address[] calldata _weirollWallets)
   ```
6. Repeat steps 4 and 5 until all deposits have been bridged and deposited into your protocol/DApp.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.royco.org/more/cross-chain-deposit-module-ccdm/ip-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
