forked from DefiLlama/yield-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* animeswap-ANI * refactor * update holder pool * add pool meta * remove holder pool
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
const { default: BigNumber } = require('bignumber.js'); | ||
|
||
const utils = require('../utils'); | ||
|
||
const DEPLOYER_ADDRESS = '0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c'; | ||
const STAKING_ADDRESS = '0x8615f5671592532631e56c76ca09d332fae1cd03d463bc379eec1007973966ef'; | ||
const POOL_ADDRESS = '0x796900ebe1a1a54ff9e932f19c548f5c1af5c6e7d34965857ac2f7b1d1ab2cbf'; | ||
const AUTOANI_ADDRESS = '0x453989b1e41bb442c833314f6ffc8572e3670c1a40a6c8a6e52ea7c588c72fd7'; | ||
const NODE_URL = 'https://fullnode.mainnet.aptoslabs.com/v1'; | ||
const COINS_LLAMA_PRICE_URL = 'https://coins.llama.fi/prices/current/'; | ||
const DECIMALS = 1e8; | ||
|
||
const aptosCoinName = 'coingecko:aptos'; | ||
const aptCoinName = '0x1::aptos_coin::AptosCoin'; | ||
const aniCoinName = `${DEPLOYER_ADDRESS}::AnimeCoin::ANI`; | ||
|
||
async function main() { | ||
const [aptPrice, coinInfo, swapPool, aniPoolInfo, mcData, autoUserInfo, autoBalance] = await Promise.all([ | ||
utils.getData(`${COINS_LLAMA_PRICE_URL}${aptosCoinName}`), | ||
utils.getData(`${NODE_URL}/accounts/${POOL_ADDRESS}/resource/0x1::coin::CoinInfo<${POOL_ADDRESS}::LPCoinV1::LPCoin<${aptCoinName},${aniCoinName}>>`), | ||
utils.getData(`${NODE_URL}/accounts/${POOL_ADDRESS}/resource/${DEPLOYER_ADDRESS}::AnimeSwapPoolV1::LiquidityPool<${aptCoinName},${aniCoinName}>`), | ||
utils.getData(`${NODE_URL}/accounts/${STAKING_ADDRESS}/resource/${DEPLOYER_ADDRESS}::AnimeMasterChefV1::PoolInfo<${aniCoinName}>`), | ||
utils.getData(`${NODE_URL}/accounts/${STAKING_ADDRESS}/resource/${DEPLOYER_ADDRESS}::AnimeMasterChefV1::MasterChefData`), | ||
utils.getData(`${NODE_URL}/accounts/${AUTOANI_ADDRESS}/resource/${DEPLOYER_ADDRESS}::AnimeMasterChefV1::UserInfo<${aniCoinName}>`), | ||
utils.getData(`${NODE_URL}/accounts/${AUTOANI_ADDRESS}/resource/0x1::coin::CoinStore<${aniCoinName}>`), | ||
]); | ||
|
||
const YEAR_S = 365 * 86400; | ||
|
||
const lpSupply = coinInfo.data.supply.vec[0].integer.vec[0].value; | ||
const stakedANI = aniPoolInfo.data.coin_reserve.value; | ||
const interestANI = BigNumber(mcData.data.per_second_ANI) | ||
.multipliedBy(aniPoolInfo.data.alloc_point) | ||
.div(mcData.data.total_alloc_point) | ||
.multipliedBy(BigNumber(100).minus(mcData.data.dao_percent)) | ||
.div(100) | ||
.multipliedBy(YEAR_S); | ||
const apr = interestANI | ||
.div(stakedANI) | ||
.multipliedBy(100) | ||
.toNumber(); | ||
const apy = utils.aprToApy(apr); | ||
|
||
const tvlUsdStakeAni = BigNumber(stakedANI) | ||
.multipliedBy(swapPool.data.coin_x_reserve.value) | ||
.div(swapPool.data.coin_y_reserve.value) | ||
.multipliedBy(aptPrice.coins[aptosCoinName].price) | ||
.div(DECIMALS) | ||
.toNumber(); | ||
|
||
const tvlUsdHolderPool = BigNumber(autoUserInfo.data.amount) | ||
.plus(autoBalance.data.coin.value) | ||
.multipliedBy(swapPool.data.coin_x_reserve.value) | ||
.div(swapPool.data.coin_y_reserve.value) | ||
.multipliedBy(aptPrice.coins[aptosCoinName].price) | ||
.div(DECIMALS) | ||
.toNumber(); | ||
|
||
return [ | ||
{ | ||
pool: `${STAKING_ADDRESS}-StakeANI-aptos`, | ||
chain: utils.formatChain('Aptos'), | ||
project: 'animeswap', | ||
symbol: utils.formatSymbol('ANI'), | ||
tvlUsd: tvlUsdStakeAni, | ||
apyReward: apr, | ||
rewardTokens: [aniCoinName], | ||
poolMeta: 'Stake ANI', | ||
}, | ||
]; | ||
} | ||
|
||
module.exports = { | ||
timetravel: false, | ||
apy: main, | ||
url: 'https://app.animeswap.org/#/pool?chain=aptos', | ||
}; |