Skip to content

update basisos index #1894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/adaptors/basisos/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ async function getApyBase(feesData, tvl){
return apyBase * 365 * 100
}

/**
* @dev Fetches the APY reward for a given vault.
* @param {string} vaultAddress The address of the vault.
* @returns {Promise<object>} An object containing the APY reward.
*/
async function getApyReward(vaultAddress){
const response = await utils.getData(`https://api.basisos.org/v1/vaults/apr/${vaultAddress}`);
return response;
}

/**
* @dev Calculates the APY for each BasisOS vault.
* @returns {Promise<Array<object>>} An array of pool objects, each containing APY and other relevant information.
Expand All @@ -194,6 +204,7 @@ async function apy() {
const tvl_in_usd = Number(tvl_in_asset.output) / 10 ** Number(assetDecimal.output);

const apyBase = await getApyBase(hyperliquidPositionFees, tvl_in_usd);
const apyReward = await getApyReward(vault);

pools.push({
pool: `${vault}-arbitrum`.toLowerCase(),
Expand All @@ -203,6 +214,7 @@ async function apy() {
tvlUsd: tvl_in_usd,
underlyingTokens: [productToken.output, assetToken.output],
apyBase: apyBase,
apyReward: apyReward,
});
}

Expand Down
Loading