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
andStrategy
interchangeably. In V2 we will simplify this wording to name every yield-earning contract aStrategy
.
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:
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:
Check our GitHub for available methods.
Last updated