How do I create an IAM?

Creating a Vault IAM

Step 1: Set the name of your IAM

Step 2: Add a detailed description of what your market is and what you will be incentivizing

Step 3: Select "Vault Market" to incentivize deposits into an existing ERC4626 Vault. These incentives will be streamed to the user until they withdraw from the vault.

Step 4: Select the chain your IAM will be deployed on and select the asset you want users to provide

Step 5: Enter the address of your existing ERC-4626 Vault. This will be a wrapped vault on Royco.

Step 6: Create the Market. It will take a few minutes to populate in the Explore page.

Requirements for an ERC-4626 Compatible Vault:

The underlying ERC-4626 Vault that will be incentivized must be deployed before deploying your Vault IAM. Royco is compatible with a wide variety of ERC-4626 Vaults, but generally, the more a specific Vault conforms to the expected standard behavior, the more Royco functionality will be supported.

Ideally, your existing ERC-4626 Vault will support immediate and exact withdrawals and deposits.

ERC-4626 Actions:

The underlying ERC-4626 Vault can be expressive, but generally, the action the IAM incentivizes should be: calling the vault’s `deposit()` function, and moving an amount of asset tokens equal to the `quantity` parameter passed in the function call.

If a non-conforming ERC-4626 Vault is unavoidable, it is still possible for the Wrapped Vault to function, and even cross-margin offers, if the following requirements still hold:

Requirements to distribute incentives to APs via Wrapped Vault:

  • asset() function doesn’t revert

  • deposit() function doesn’t revert

  • convertToAssets() function doesn’t revert

  • Working previewDeposit() function with accurate return value

  • ERC20 functionality intact

Requirements to enable cross-margin offers on Royco IAMs: An AP may earn incentives from one vault while waiting for a conditional offer to fill on a different market.

  • Withdraw function must return exactly `quantity` token to the withdrawer immediately

  • Working maxWithdraw() function with accurate return value

Always defer to checking the Royco codebase to confirm vault compatibility, especially when integrating irregular vaults.

Creating a Recipe IAM

Step 1: Set the name of your IAM

Step 2: Add a detailed description of what your market is and what you will be incentivizing

Step 3: Select "Recipe Market" to incentivize any onchain action. These incentives can be paid upfront, paid after a timelock without the ability to withdraw, or paid after a timelock with forfeiture of incentives if users withdraw early.

Step 4: Select the chain your IAM will be deployed on and select the asset you want users to provide.

Step 5: Choose the contracts and functions that represent what action you want to represent. Define an Enter and Exit script for the IAM to be listed on the Explore page.

Step 6: Create the Market. It will take a few minutes to populate in the Explore page.

How Recipes Work

Recipe Weiroll Scripts: Recipe IAMs rely on Weiroll, an operation-chaining/functional scripting language where all function calls are smart contract interactions. Unlike multicall, Weiroll allows “carrying” function outputs into the inputs of other function calls–enabling expressive, complex smart contract interactions.

Weiroll scripts are represented as an array of bytes32 commands, so they are difficult to create without using online builders–such as the one on Royco.org. These online builders drastically simplify script creation. It is recommended to use one of the transpilers specifically designed for generating Weiroll scripts, if you are to create a Weiroll script without an online builder.

Requirements for Recipe Weiroll scripts, at a minimum:

  • A valid ‘deposit recipe’ script that defines the incentivized action, to be executed by the AP’s disposable smart contract wallet.

  • A valid ‘withdrawal recipe’ script that calls all of the functions required to unwind an AP’s position. Without this, the AP will still be able to exit their position, but will need to execute the function calls manually.

Once the Weiroll script is complete, a Recipe Market can be created by calling ```function createMarket( address inputToken, uint256 lockupTime, uint256 frontendFee, Recipe calldata depositRecipe, Recipe calldata withdrawRecipe, RewardStyle rewardStyle) ```.

  • `inputToken` the token that will be transferred to the AP’s Weiroll Wallet for availability during script execution. I.e. If the action is “deposit USDC in a liquidity pool,” then inputToken would be set to the AP’s current address, and anytime an offer is filled, the fill quantity of USDC will be transferred from the AP to the AP’s Weiroll Wallet, and may be used by the script.

  • `lockupTime` the number of seconds the Weiroll Wallet is time-locked, the AP will agree to not being able to withdraw or otherwise interact with their assets until the lockup expires.

  • `frontendFee` the % of incentives offered to be paid to the frontend. Must be higher than the minimum value set by the protocol. Frontends may opt to give increased visibility, preferred treatment, etc. to markets with higher fees.

  • `depositRecipe`and `withdrawRecipe`are the Weiroll scripts generated prior to market creation.

  • `rewardStyle` is an enum that determines how and when the incentives are paid to the AP, its enumerated values are as follows:

    • 0. Upfront:

    • 1. Arrear:

    • 2. Forfeitable:

Last updated