How to Choose a Resolver

This guide will help you select the appropriate resolver for your use case.

Glossary

  • underlying token: The token that generates yield, typically a vault or lending position. For example, for Yearn v3 USDC vault, the underlying token is the Yearn vault token itself.

  • asset: The base token that the underlying token's value and yield are measured in. For example, for Yearn v3 USDC vault, the asset is USDC. The asset is what users deposit into and withdraw from the underlying token.

  • vault: The ERC20-compliant token that represents ownership of the underlying token. For ERC4626 vaults, this is the vault token itself. The vault token's balance represents the user's share of the total underlying assets.

  • resolver: A contract that fetches the exchange rate between vault shares and assets. The resolver determines how many asset tokens (e.g. USDC) one vault share is worth, accounting for any accumulated yield.

Simple Flowchart

You need to select a resolver based on the type of underlying token.

Resolver Selection Guide in Simple Terms

  1. For Rebasing Tokens: If the underlying token automatically changes balances in wallets (rebasing), we don't natively support it.

  2. For Standard Vault (ERC4626): If the underlying token follows the standard ERC4626 standard, use ERC4626Resolver.

  3. For Tokens with Conversion Functions: If the underlying token has a function that tells you how many base assets you get for a certain amount of tokens, use CustomConversionResolver. The function must follow the spec of convertToAssets(uint256 shares) -> uint256 assets in ERC4626 except for the function name.

  4. For Tokens with Share Price Functions: If the underlying token has a function that tells you the conversion rate of how many assets is 1 share of the vault worth, use SharePriceResolver. The function signature must be like assetsPerShare() -> uint256 assets.

  5. For Tokens with External Price Sources: If the underlying token contract doesn't have any of the above, but there is a price oracle against the asset, ExternalPriceResolver may be used. For chainlink price feeds, ChainlinkPriceResolver is available out of the box.

  6. For Tokens with Constant Price: If the underlying token has a constant price, use ConstantPriceResolver.

  7. For Other Tokens: If the underlying token doesn't fit any of these categories, please contact us for support.

What Information You'll Need

Each resolver needs specific information:

  • ERC4626Resolver:

    • vault: The address of ERC4626 token. asset is automatically set as vault.asset() function result.

  • CustomConversionResolver:

    • vault: The ERC20 token address of your underlying token

    • asset: The ERC20 token address of the base asset (e.g., USDC for a USDC underlying token)

    • conversionFunctionSignature: The function signature of the function that converts shares to assets similar to convertToAssets() in ERC4626

      • Specification:

        • customConversionFn(uint256 shares) -> uint256 assets

        • shares is the number of shares to convert to assets

        • assets is the number of assets that one share is worth

  • SharePriceResolver:

    • vault: The ERC20 token address of your underlying token

    • asset: The ERC20 token address of the base asset

    • priceFunctionSignature: The function signature of the function that gives the price per share similar to convertToAssets(10 ** vault.decimals()) in ERC4626

      • Specification:

        • customPriceFn() -> uint256 assets

        • assets is the number of assets that one share is worth

  • ExternalPriceResolver:

    • vault: The ERC20 token address of your underlying token

    • asset: The ERC20 token address of the base asset

    • oracle: The address of the price oracle

    • priceFeedFunctionSignature: The function signature of the function on the oracle that provides the price

      • Specification:

        • priceFeedFn() -> uint256 assets

        • assets is the number of assets that one share is worth

  • ChainlinkPriceResolver:

    • vault: The ERC20 token address of your underlying token

    • asset: The ERC20 token address of the base asset

    • oracle: The address of Chainlink AggregatorV3Interface price oracle that returns vault price against asset

  • ConstantPriceResolver:

    • vault: The ERC20 token address of your underlying token

    • asset: The ERC20 token address of the base asset

Last updated