Instant AI
  • INSTRUCTION
    • What is Instant AI
    • Tokenomics
    • Governance Process Overview
    • Become a Strategist
  • Smart Contracts
    • Protocol (V2) Contract Architecture
      • Smart Contract Architecture Walk-Through
    • Roles & Permissions
    • External Protocol Integration
      • Building Adaptors
        • BaseAdaptor
        • Protocol-Specific Functionality
        • Adaptor Configuration
        • Security Considerations
        • Debt Adaptors
        • Adaptor Uses to Keep in Mind
      • Building Pricing Extensions
    • Smart Contracts & Governance
    • Smart Contract Addresses
    • Advanced Smart Contracts
      • Registry Details
        • Registry.sol API
      • PriceRouter Details
        • Oracle Usage and Asset Pricing
        • PriceRouter.sol API
      • Cellars (aka ERC 4626 Vaults)
      • Adaptors
        • BaseAdaptor.sol API
      • Fees And Reserves
      • Portfolio (V1.5) Contract Architecture
  • Strategists
    • Overview
    • Protobuf
    • Requests
    • Adaptors
  • PROTOCOL
    • How does the protocol work?
    • Validators
    • Gravity Bridge
    • Steward
    • Auction module and participation
Powered by GitBook
On this page
  1. Smart Contracts
  2. External Protocol Integration
  3. Building Adaptors

Adaptor Uses to Keep in Mind

PreviousDebt AdaptorsNextBuilding Pricing Extensions

Last updated 6 months ago

A core aspect of developing a new Instant AI Cellar is determining which adaptors the Cellar may use, and how those adaptors work together. Adaptor developers should keep the following guidelines in mind when designing support for strategies that require multiple adaptors to interact to support a strategy.

Multicall

The nature of callOnAdaptor in is that a strategist can submit multiple adaptor calls, to multiple different adaptors, and have them executed atomically and serially. Additionally, Cellars support . Therefore, adaptor developers should gear their designs towards single-responsibility principles, knowing that atomicity across multiple adaptors can still be achieved.

For example, a common use case for LP-based strategies is the "zap" - where half of one asset is swapped for another asset right before entering a liquidity pool for those two assets. There is no need for a single adaptor to support both "swap" and "deposit LP" functionality in a single adaptor call. Atomicity and slippage protection are basically achieved by chaining multiple adaptor calls together - one to an adaptor designed for swapping tokens, then, subsequently, one designed for depositing to an LP pool. Strategists should be instructed on how to submit "batches" that achieve these multi-step processes, as opposed to having multi-step processes be native to adaptors themselves.

Untracked Assets

The totalAssets check ensures that any rebalance made via adaptor calls does not affect the total value of tracked assets. However, untracked assets can be used as intermediate positions within a series of adaptor calls, as long as the asset is eventually swapped to a tracked one in adaptor calls.

For instance, in a Cellar that is set up to only hold USDC, WETH, and WBTC, a strategist can perform an intermediate swap from USDC to AAVE, as long as the AAVE tokens are subsequently swapped to one of the three approved assets. Additionally, Cellars can use adaptor calls to claim farming/staking rewards that may be denominated in untracked assets, as long as they are swapped to a tracked asset before the series of adaptor calls finishes and rebalance deviations are checked.

Vesting

In some cases, adaptor developers may build scenarios by which a Cellar earns previously-untracked profit outside of the rebalance deviation. The most common use case for this is the claiming of staking and/or liquidity mining rewards. In these cases, even if swapped to a tracked asset, the profit cannot be immediately deposited into a Cellar due to the totalAssets check. In these cases, a and underlying vesting contract should be used.

Vesting adaptors are designed such that over time, they can increase the TVL of a cellar. Funds deposited into a vesting adaptor are initially untracked - meaning that do not cause deviations in TVL. Over time, deposits into the vesting contract are progressively added to the TVL, and can be withdrawn back to the Cellar and moved to other positions.

Cellar.sol
Multicall
Vesting Adaptor