View functions
To retrieve important details about the vaults, such as TVR (Total Value Ratio), APY (Annual Percentage Yield), investment strategies, and risk scores, as well as to check user balances, utilize the functions provided below:
Where 'networkName' is 'mainnet', 'arbitrum' or 'sepolia'.
Protocol discovery functions
Use the following functions to retrieve an array containing information about the Vaults deployed on the Yelay platform. This array will include essential details for each Vault, such as its address, names, associated asset groups, strategies it employs, and the address of the risk score provider responsible for assessing its risk level.
For reference, you can explore the Vaults currently active on Yelay by visiting: https://app.spool.fi/smart-vaults
Returns an array of VaultInfo
objects:
Where SmartVaultStrategy
is:
Use the following function to fetch an array of strategies currently deployed on the Yelay platform. This array will provide comprehensive information about each strategy, including its contract address, name, Annual Percentage Yield (APY), risk score, and the timestamp of the most recent DoHardWork execution. Use the following link to explore the strategies currently active on Yelay: https://app.spool.fi/strategies.
Returns array of strategy info objects:
Where risk scores are:
Use the following function to retrieve an array of risk score providers that are integrated with the Yelay platform. For more details about the risk score providers, use the following link: https://docs.spool.fi/technical-reference/understanding-the-protocol/understanding-a-risk-model
Returns an array of Risk providers:
RiskScores structure can be seen above
To obtain an array of asset groups currently configured on the Yelay platform, use the following function. For more details about the asset groups, see here: https://docs.spool.fi/technical-reference/technical-implementation/smart-vaults/supported-asset-groups
Returns an array of Asset group:
Where TokenInfo is:
Vault details functions
Retrieve essential information about a specific Vault using this function. Please note that this method does not include Annual Percentage Yield (APY) details, which can be obtained through a getVaultAPY function (see below).
Returns the same as ListVaults - VaultInfo object, but only for one vault.
To determine the total supply of shares (SVTs) for a particular Vault, employ the following function:
Returns a BigNumber of SVT amounts in decimals.
Calculate the total balance within a Vault, denominated in the Vault's native asset, by utilizing this method. Keep in mind that this function only accounts for deposits that have been processed by the 'DoHardWork' mechanism.
Returns an array of BigNumbers representing the amount the vault has of each asset in the asset group. If asset group is [dai] it will return [amountOfDai], if [dai, usdc] it will return [amountOfDai, amountOfUsdc]
Use the provided function to retrieve the balance within a Vault, nominated in the Vault’s assets. This method is particularly useful for Vaults that support multiple assets:
Returns a map of each asset in vault and int’s amount Record<string, BigNumber>
The above methods also have a batch option
in which case the results are arrays, matched by index to vaults sent as parameters.
These batch functions have been added in v1.0.15
.
Obtain comprehensive APY details for a Vault, including yield APY, incentives APY, and a breakdown of associated fees, by leveraging the following function:
Returns a record for each given vault containing it’s fees and APYs [vaultAddress]:
Base vault’s APY is the weighted average of 7-days historical APYs of the underlying strategies.
To fetch a Vault's total asset value denominated in USD, use the following method:
Returns a number representing the usd value of assets in vault
To return a breakdown of fees per vault, use the following:
Returns a vault fee struct:
To return all users of the specified vaults, use the method getVaultUsers
:
The method returns a record for each vault from the query, containing an array where each object represents a user. The object contains their address, dNFTs and wNFTs for that smart vault, along with the actual smart vault data:
To return all vaults the user or a list of user interacted with, use the method getUserVaults
:
The method returns a record for each user from the query, containing an array where each object represents a vault. The object contains the vault details, dNFTs and wNFTs of the user for that smart vault, along with the user address:
User balance functions
To obtain the user's balance within a specific Vault, denominated in the Vault's native asset, utilize the following function:
returns an array of user balances corresponding to the asset group of the vault. Returns BigNumber[].
To obtain the user's balance of Vault shares (SVTs), excluding shares for which a withdrawal has already been initiated, use the following method:
Returns a BigNumber with the svt amounts. Includes all D-NFTs.
To calculate the user's total balance in a specific Vault, taking into account both processed and unprocessed deposits, use the provided function:
Returns an array of D-NFT objects:
shares are the amounts of NFT still available, up to 1,000,000
isBurned is true if the user has exchange this nft, either for SVTs (in case of D-NFTs) or for the underlying assets (in case of W-NFTs)
isFlushExecuted tells us if this nft is included in next DoHardWork
isSynced is irrelevant
isDhw finished lets us know if this nft has been processed
The assets array of the D-NFTs is filled at it’s creation and includes the assets that will be routed into the vault
To fetch the user's balance in Withdrawal NFTs (W-NFTs), representing the total amount of assets pending withdrawal, use the following function:
Returns an array of W-NFT objects:
This includes both W-NFTs that represent withdrawal request and are awaiting DoHardWork as well as those that are already ready to be claimed to be withdrawn.
Please note that the 'assets' property of a W-NFT is only populated after the NFT is burned, which occurs when the user claims the associated assets. Additionally, each W-NFT contains an 'svtWithdrawn' property, which indicates the number of SVTs being withdrawn through that specific W-NFT.
When dealing with multi-asset Vaults, employ the following function prior to initiating a deposit:
Result is an array of BigNumbers. This method is used to determine deposit bags for multi asset vaults. It tells us what the ratio of the deposits should be when depositing.
To avoid calculating the values for the redeem bag used when withdrawing, getMaxRedeemBag
method can be used:
The method returns a RedeemBagStruct
, which can then be directly used in the redeem
or redeemFast
method parameters.
Last updated