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
  1. Products
  2. VaultCraft VCI & SDK
  3. SDK

Vault

The Vault class wraps a given vault contract and provides all necessary view and write functions to interact with any given vault.

Currently we are using the word Adapter and Strategy interchangeably. In V2 we will simplify this wording to name every yield-earning contract a Strategy.

Initialization

The Vault class must be created for each vault contract you wish to interact with. To initialize it, you'll need the vault's address, a public client for reading, and a wallet client for making changes. We use viem's public and wallet clients.

  • The public client fetches data from the chain using a JSON-RPC API

  • The wallet client connects with an Externally Owned Account (EOA) to enable user transaction signing.

To find the addresses of all existing vaults on a chain, you can use the "allVaults" function of the VaultRegistry contract, such as through etherscan.

Find current VaultRegistry addresses here:

mainnet: "0x007318Dc89B314b47609C684260CfbfbcD412864"
optimism: "0xdD0d135b5b52B7EDd90a83d4A4112C55a1A6D23A"
arbitrum: "0xB205e94D402742B919E851892f7d515592a7A6cC"
polygon: "0x2246c4c469735bCE95C120939b0C078EC37A08D0"
bsc: "0x25172C73958064f9ABc757ffc63EB859D7dc2219"

We are developing a VaultRegistry class for our SDK to simplify this process. Additionally, our app will soon include a dedicated page for you to conveniently view and manage all your vaults.

To initialize the Vault class simply follow this example:

const vaultAddress = "0x5d344226578DC100b2001DA251A4b154df58194f",
const publicClient = createPublicClient({
  chain: mainnet,
  transport: http()
})
const walletClient = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum)
})

const vault = new Vault(vaultAddress, publicClient, walletClient);
PreviousYieldOptionsNextVaultController

Last updated 1 year ago

Check our for available methods.

๐Ÿช„
๐Ÿ›ธ
GitHub