VaultCraft
IntroductionProductsTokenomicsGovernanceSecurityResources
  • Welcome to VaultCraft
    • ๐ŸŒฝIntroduction
    • ๐Ÿซ‚Refer your friends
    • ๐Ÿ—ฃ๏ธBook a Demo
    • ๐ŸคPartner with us
      • VaultCraft Partner Program
      • Vaultcraft Referral Program
  • Products
    • ๐ŸฟOverview
    • ๐ŸชV2 - Safe Smart Vaults
      • ๐Ÿ› ๏ธManager Docs
      • ๐Ÿ‘จโ€๐ŸญUser Docs
      • ๐Ÿค“Developer Docs
    • ๐Ÿง Smart Vaults
      • ๐Ÿ“ˆStrategies
      • ๐Ÿ’พIntegrated Protocols
    • ๐ŸคนMulti-strategy Smart Vaults
      • Rebalancing Methodology
    • ๐Ÿช„VaultCraft VCI & SDK
      • ๐Ÿช„VaultCraft Interface (VCI)
      • ๐Ÿ›ธSDK
        • Developer Docs
        • YieldOptions
        • Vault
        • VaultController
    • โšกZap into Vaults
    • ๐Ÿช‚VAULTRON
  • Tokenomics
    • ๐Ÿ’ฃVCX
      • ๐ŸฟVCX
        • ๐Ÿ•ฐ๏ธOld POP Tokenomics
      • ๐ŸฟVoting Power
      • ๐ŸฟoVCX
      • ๐Ÿš€Boost
      • ๐ŸคBribing
      • ๐Ÿ’ฐProtocol Revenue
      • ๐Ÿ”ฅTreasury Burn
    • ๐ŸงˆVCX Markets
    • โ›“๏ธSmart Contracts
  • GOVERNANCE
    • ๐Ÿ—ณ๏ธVaultCraftDAO
  • Security
    • ๐Ÿ’‚Guards
    • ๐ŸšงMulti-sig contract Management
    • ๐Ÿ›ก๏ธ Audits
    • ๐Ÿ› Bug Bounty
    • ๐Ÿ’กNon-technical QA
  • Tools & Resources
    • ๐Ÿ“บTutorials
    • โš’๏ธWebsites
    • โš’๏ธDashboards
    • โš’๏ธCommunities
    • โš’๏ธBrand Assets
Powered by GitBook
On this page
  • Initialization
  • Choose Provider
  1. Products
  2. VaultCraft VCI & SDK
  3. SDK

YieldOptions

The YieldOptions class lets you access yield data for various protocols on multiple chains. Use it to compare farm yields for your assets or discover new opportunities. It covers supported protocols, assets, and expected yields across different networks.

We currently support the following networks and protocols, with more being added soon:

Ethereum
โ”œโ”€โ”€ Aave V2
โ”œโ”€โ”€ Aave V3
โ”œโ”€โ”€ Aura
โ”œโ”€โ”€ Balancer
โ”œโ”€โ”€ Beefy
โ”œโ”€โ”€ Compound V2
โ”œโ”€โ”€ Compound V3
โ”œโ”€โ”€ Convex
โ”œโ”€โ”€ Curve
โ”œโ”€โ”€ Flux
โ”œโ”€โ”€ Idle
โ”œโ”€โ”€ Origin
โ”œโ”€โ”€ Yearn

Initialization

To set it up, provide a yield data source and specify the cache duration (in seconds).

const ttl = 3600; // cache for 1 hour
const yieldOptions = new YieldOptions(provider, ttl);

Choose Provider

Cached Provider

The CachedProvider is the most efficient solution. It is a simple wrapper class for static yield data. You pass it a URL pointing to a JSON file on initialization and it stores the data in memory.

const provider = new CachedProvider();
await provider.initialize("<https://raw.githubusercontent.com/Popcorn-Limited/apy-data/main/apy-data.json>");

const ttl = 3600;
const yieldOptions = new YieldOptions(provider, 3600);

Protocol Provider

The LiveProvider utilizes real-time yield data obtained from on-chain contracts or the protocol's API. To access on-chain data, it requires a connection to a viem public client.

const ttl = 3600;
const clients = {
    1: createPublicClient({
        chain: mainnet,
        transport: http()
    }),
};
const provider = new LiveProvider(clients, ttl);
const yieldOptions = new YieldOptions(provider, ttl);
PreviousDeveloper DocsNextVault

Last updated 1 year ago

Check our for available methods.

๐Ÿช„
๐Ÿ›ธ
GitHub