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);

Check our GitHub for available methods.

Last updated