From 063cb93db6873cd82f9ff91b1f8564d4b63f9b1b Mon Sep 17 00:00:00 2001 From: MirthFutures Date: Tue, 3 Sep 2024 07:38:36 -0400 Subject: [PATCH] Remove duplicates and fix aura mainnet rewards multiplier --- .../address-book/ethereum/platforms/aura.ts | 1 + src/abis/ethereum/AuraBooster.ts | 635 ++++++++++++++++++ src/api/stats/ethereum/getAuraApys.js | 50 +- src/data/ethereum/auraBalancerLpPools.json | 58 -- 4 files changed, 659 insertions(+), 85 deletions(-) create mode 100644 src/abis/ethereum/AuraBooster.ts diff --git a/packages/address-book/src/address-book/ethereum/platforms/aura.ts b/packages/address-book/src/address-book/ethereum/platforms/aura.ts index 833ab1a93..fdb66c4b2 100644 --- a/packages/address-book/src/address-book/ethereum/platforms/aura.ts +++ b/packages/address-book/src/address-book/ethereum/platforms/aura.ts @@ -1,3 +1,4 @@ export const aura = { + booster: '0xA57b8d98dAE62B26Ec3bcC4a365338157060B234', router: '0xBA12222222228d8Ba445958a75a0704d566BF2C8', } as const; diff --git a/src/abis/ethereum/AuraBooster.ts b/src/abis/ethereum/AuraBooster.ts new file mode 100644 index 000000000..4339d510c --- /dev/null +++ b/src/abis/ethereum/AuraBooster.ts @@ -0,0 +1,635 @@ +const AuraBooster = [ + { + inputs: [ + { internalType: 'address', name: '_staker', type: 'address' }, + { internalType: 'address', name: '_minter', type: 'address' }, + { internalType: 'address', name: '_crv', type: 'address' }, + { internalType: 'address', name: '_voteOwnership', type: 'address' }, + { internalType: 'address', name: '_voteParameter', type: 'address' }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'address', name: 'newArbitrator', type: 'address' }], + name: 'ArbitratorUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { indexed: true, internalType: 'uint256', name: 'poolid', type: 'uint256' }, + { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'Deposited', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'address', name: 'rewardFactory', type: 'address' }, + { indexed: false, internalType: 'address', name: 'stashFactory', type: 'address' }, + { indexed: false, internalType: 'address', name: 'tokenFactory', type: 'address' }, + ], + name: 'FactoriesUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'address', name: 'feeDistro', type: 'address' }, + { indexed: false, internalType: 'bool', name: 'active', type: 'bool' }, + ], + name: 'FeeInfoChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'address', name: 'feeDistro', type: 'address' }, + { indexed: false, internalType: 'address', name: 'lockFees', type: 'address' }, + { indexed: false, internalType: 'address', name: 'feeToken', type: 'address' }, + ], + name: 'FeeInfoUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'address', name: 'newFeeManager', type: 'address' }], + name: 'FeeManagerUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'uint256', name: 'lockIncentive', type: 'uint256' }, + { indexed: false, internalType: 'uint256', name: 'stakerIncentive', type: 'uint256' }, + { indexed: false, internalType: 'uint256', name: 'earmarkIncentive', type: 'uint256' }, + { indexed: false, internalType: 'uint256', name: 'platformFee', type: 'uint256' }, + ], + name: 'FeesUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'address', name: 'newOwner', type: 'address' }], + name: 'OwnerUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'address', name: 'lpToken', type: 'address' }, + { indexed: false, internalType: 'address', name: 'gauge', type: 'address' }, + { indexed: false, internalType: 'address', name: 'token', type: 'address' }, + { indexed: false, internalType: 'address', name: 'rewardPool', type: 'address' }, + { indexed: false, internalType: 'address', name: 'stash', type: 'address' }, + { indexed: false, internalType: 'uint256', name: 'pid', type: 'uint256' }, + ], + name: 'PoolAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'address', name: 'newPoolManager', type: 'address' }], + name: 'PoolManagerUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'uint256', name: 'poolId', type: 'uint256' }], + name: 'PoolShutdown', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'address', name: 'lockRewards', type: 'address' }, + { indexed: false, internalType: 'address', name: 'stakerRewards', type: 'address' }, + ], + name: 'RewardContractsUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'address', name: 'newTreasury', type: 'address' }], + name: 'TreasuryUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: 'address', name: 'newVoteDelegate', type: 'address' }], + name: 'VoteDelegateUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { indexed: true, internalType: 'uint256', name: 'poolid', type: 'uint256' }, + { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'Withdrawn', + type: 'event', + }, + { + inputs: [], + name: 'FEE_DENOMINATOR', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MaxFees', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'REWARD_MULTIPLIER_DENOMINATOR', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_lptoken', type: 'address' }, + { internalType: 'address', name: '_gauge', type: 'address' }, + { internalType: 'uint256', name: '_stashVersion', type: 'uint256' }, + ], + name: 'addPool', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'bridgeDelegate', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_pid', type: 'uint256' }, + { internalType: 'address', name: '_gauge', type: 'address' }, + ], + name: 'claimRewards', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'crv', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_pid', type: 'uint256' }, + { internalType: 'uint256', name: '_amount', type: 'uint256' }, + { internalType: 'bool', name: '_stake', type: 'bool' }, + ], + name: 'deposit', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_pid', type: 'uint256' }, + { internalType: 'bool', name: '_stake', type: 'bool' }, + ], + name: 'depositAll', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }], + name: 'distributeL2Fees', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_feeToken', type: 'address' }], + name: 'earmarkFees', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'earmarkIncentive', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_pid', type: 'uint256' }], + name: 'earmarkRewards', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'feeManager', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'feeTokens', + outputs: [ + { internalType: 'address', name: 'distro', type: 'address' }, + { internalType: 'address', name: 'rewards', type: 'address' }, + { internalType: 'bool', name: 'active', type: 'bool' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'gaugeMap', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'getRewardMultipliers', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'isShutdown', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'l2FeesHistory', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'lockIncentive', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'lockRewards', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'minter', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'platformFee', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'poolInfo', + outputs: [ + { internalType: 'address', name: 'lptoken', type: 'address' }, + { internalType: 'address', name: 'token', type: 'address' }, + { internalType: 'address', name: 'gauge', type: 'address' }, + { internalType: 'address', name: 'crvRewards', type: 'address' }, + { internalType: 'address', name: 'stash', type: 'address' }, + { internalType: 'bool', name: 'shutdown', type: 'bool' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'poolLength', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'poolManager', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'rewardArbitrator', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_pid', type: 'uint256' }, + { internalType: 'address', name: '_address', type: 'address' }, + { internalType: 'uint256', name: '_amount', type: 'uint256' }, + ], + name: 'rewardClaimed', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'rewardFactory', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_arb', type: 'address' }], + name: 'setArbitrator', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_bridgeDelegate', type: 'address' }], + name: 'setBridgeDelegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_delegateContract', type: 'address' }, + { internalType: 'address', name: '_delegate', type: 'address' }, + { internalType: 'bytes32', name: '_space', type: 'bytes32' }, + ], + name: 'setDelegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_rfactory', type: 'address' }, + { internalType: 'address', name: '_sfactory', type: 'address' }, + { internalType: 'address', name: '_tfactory', type: 'address' }, + ], + name: 'setFactories', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_feeToken', type: 'address' }, + { internalType: 'address', name: '_feeDistro', type: 'address' }, + ], + name: 'setFeeInfo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_feeM', type: 'address' }], + name: 'setFeeManager', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_lockFees', type: 'uint256' }, + { internalType: 'uint256', name: '_stakerFees', type: 'uint256' }, + { internalType: 'uint256', name: '_callerFees', type: 'uint256' }, + { internalType: 'uint256', name: '_platform', type: 'uint256' }, + ], + name: 'setFees', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_pid', type: 'uint256' }], + name: 'setGaugeRedirect', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_owner', type: 'address' }], + name: 'setOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_poolM', type: 'address' }], + name: 'setPoolManager', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_rewards', type: 'address' }, + { internalType: 'address', name: '_stakerRewards', type: 'address' }, + ], + name: 'setRewardContracts', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'rewardContract', type: 'address' }, + { internalType: 'uint256', name: 'multiplier', type: 'uint256' }, + ], + name: 'setRewardMultiplier', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_treasury', type: 'address' }], + name: 'setTreasury', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes32', name: '_hash', type: 'bytes32' }], + name: 'setVote', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_voteDelegate', type: 'address' }], + name: 'setVoteDelegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_pid', type: 'uint256' }], + name: 'shutdownPool', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { inputs: [], name: 'shutdownSystem', outputs: [], stateMutability: 'nonpayable', type: 'function' }, + { + inputs: [], + name: 'staker', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'stakerIncentive', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'stakerRewards', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'stashFactory', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'tokenFactory', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'treasury', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_feeToken', type: 'address' }, + { internalType: 'bool', name: '_active', type: 'bool' }, + ], + name: 'updateFeeInfo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_voteId', type: 'uint256' }, + { internalType: 'address', name: '_votingAddress', type: 'address' }, + { internalType: 'bool', name: '_support', type: 'bool' }, + ], + name: 'vote', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'voteDelegate', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address[]', name: '_gauge', type: 'address[]' }, + { internalType: 'uint256[]', name: '_weight', type: 'uint256[]' }, + ], + name: 'voteGaugeWeight', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'voteOwnership', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'voteParameter', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_pid', type: 'uint256' }, + { internalType: 'uint256', name: '_amount', type: 'uint256' }, + ], + name: 'withdraw', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_pid', type: 'uint256' }], + name: 'withdrawAll', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_pid', type: 'uint256' }, + { internalType: 'uint256', name: '_amount', type: 'uint256' }, + { internalType: 'address', name: '_to', type: 'address' }, + ], + name: 'withdrawTo', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; + +export default AuraBooster; diff --git a/src/api/stats/ethereum/getAuraApys.js b/src/api/stats/ethereum/getAuraApys.js index c3bec393c..86bbd32d8 100644 --- a/src/api/stats/ethereum/getAuraApys.js +++ b/src/api/stats/ethereum/getAuraApys.js @@ -10,6 +10,7 @@ import { getEDecimals } from '../../../utils/getEDecimals'; import IBalancerVault from '../../../abis/IBalancerVault'; import IAaveProtocolDataProvider from '../../../abis/matic/AaveProtocolDataProvider'; import AuraToken from '../../../abis/ethereum/AuraToken'; +import AuraBooster from '../../../abis/ethereum/AuraBooster'; import { fetchContract } from '../../rpc/client'; import jp from 'jsonpath'; import AuraGauge from '../../../abis/ethereum/AuraGauge'; @@ -42,6 +43,7 @@ const bbeUSDPoolId = '0x50cf90b954958480b8df7958a9e965752f6271240000000000000000 const liquidityProviderFee = 0.0025; const secondsInAYear = 31536000; +const REWARD_MULTIPLIER_DENOMINATOR = 10000; const RAY_DECIMALS = '1e27'; const balVault = fetchContract(balancer.router, IBalancerVault, ETH_CHAIN_ID); @@ -54,14 +56,7 @@ const getAuraApys = async () => { ]); const poolsMap = pools.map(p => ({ name: p.name, address: p.address })); - return getApyBreakdown( - poolsMap, - tradingAprs, - farmApys[0], - liquidityProviderFee, - farmApys[1], - farmApys[2] - ); + return getApyBreakdown(poolsMap, tradingAprs, farmApys[0], liquidityProviderFee, farmApys[1], farmApys[2]); }; const getPoolApys = async pools => { @@ -69,14 +64,14 @@ const getPoolApys = async pools => { const lsAprs = []; const cmpAprs = []; - const [auraData, { balances, rewardRates, finishes, extras }] = await Promise.all([ + const [auraData, { balances, rewardRates, finishes, multipliers, extras }] = await Promise.all([ getAuraData(), getPoolsData(pools), ]); const data = await Promise.all( pools.map((pool, i) => - getPoolApy(pools[i], auraData, balances[i], rewardRates[i], finishes[i], extras) + getPoolApy(pools[i], auraData, balances[i], rewardRates[i], finishes[i], multipliers[i], extras) ) ); data.forEach(d => { @@ -88,11 +83,11 @@ const getPoolApys = async pools => { return [apys, lsAprs, cmpAprs]; }; -const getPoolApy = async (pool, auraData, balance, rewardRate, finish, extras) => { +const getPoolApy = async (pool, auraData, balance, rewardRate, finish, multiplier, extras) => { if (pool.status === 'eol') return new BigNumber(0); let [yearlyRewardsInUsd, totalStakedInUsd, aprFixed, bbaUSDApy] = await Promise.all([ - getYearlyRewardsInUsd(auraData, pool, rewardRate, finish, extras), + getYearlyRewardsInUsd(auraData, pool, rewardRate, finish, multiplier, extras), getTotalStakedInUsd(pool, balance), pool.name == 'aura-wsteth-reth-sfrxeth-v3' ? getThreeEthPoolYield(pool) @@ -106,9 +101,7 @@ const getPoolApy = async (pool, auraData, balance, rewardRate, finish, extras) = let composableApr = new BigNumber(0); if (pool.includesComposableStable) { - pool.composableSplit - ? (bbaUSDApy = bbaUSDApy.dividedBy(pool.composableSplit)) - : (bbaUSDApy = bbaUSDApy); + pool.composableSplit ? (bbaUSDApy = bbaUSDApy.dividedBy(pool.composableSplit)) : (bbaUSDApy = bbaUSDApy); composableApr = bbaUSDApy; } @@ -120,13 +113,17 @@ const getPoolApy = async (pool, auraData, balance, rewardRate, finish, extras) = return [rewardsApy, aprFixed, composableApr]; }; -const getYearlyRewardsInUsd = async (auraData, pool, rewardRate, finish, extras) => { +const getYearlyRewardsInUsd = async (auraData, pool, rewardRate, finish, multiplier, extras) => { let yearlyRewardsInUsd = new BigNumber(0); if (finish > Date.now() / 1000) { const balPrice = await fetchPrice({ oracle: 'tokens', id: BAL.oracleId }); const yearlyRewards = rewardRate.times(secondsInAYear); yearlyRewardsInUsd = yearlyRewards.times(balPrice).dividedBy(getEDecimals(BAL.decimals)); - let amount = yearlyRewards.times(auraData[0]).dividedBy(auraData[1]); + let amount = yearlyRewards + .times(auraData[0]) + .dividedBy(auraData[1]) + .times(multiplier) + .dividedBy(REWARD_MULTIPLIER_DENOMINATOR); // e.g. amtTillMax = 5e25 - 1e25 = 4e25 if (amount.gte(auraData[2])) { @@ -177,9 +174,7 @@ const getLiquidStakingPoolYield = async pool => { } } else { const price = await fetchPrice({ oracle: 'tokens', id: pool.tokens[j].oracleId }); - const amt = new BigNumber(tokenQtys[1][j].toString()) - .times(price) - .dividedBy([pool.tokens[j].decimals]); + const amt = new BigNumber(tokenQtys[1][j].toString()).times(price).dividedBy([pool.tokens[j].decimals]); totalQty = totalQty.plus(amt); qty.push(amt); } @@ -205,8 +200,7 @@ const getLiquidStakingPoolYield = async pool => { apr = apr + lsApr / divisor; } else { pool.balancerChargesFee - ? (apr = - apr + (lsApr * qty[pool.lsIndex[i]].dividedBy(totalQty).toNumber()) / divisor / 2) + ? (apr = apr + (lsApr * qty[pool.lsIndex[i]].dividedBy(totalQty).toNumber()) / divisor / 2) : (apr = apr + (lsApr * qty[pool.lsIndex[i]].dividedBy(totalQty).toNumber()) / divisor); } } @@ -274,10 +268,7 @@ const getComposableAaveYield = async () => { return dataProvider.read.getReserveData([t.address]); }); - const res = await Promise.all([ - Promise.all(supplyRateCalls), - balVault.read.getPoolTokens([bbaUSDPoolId]), - ]); + const res = await Promise.all([Promise.all(supplyRateCalls), balVault.read.getPoolTokens([bbaUSDPoolId])]); const rates = res[0].map(v => new BigNumber(v[3].toString())); const tokenQtys = await balVault.read.getPoolTokens([bbaUSDPoolId]); @@ -308,11 +299,14 @@ const getPoolsData = async pools => { const extraRewardInfo = []; const extraRewardRateCalls = []; const extraRewardPeriodFinishCalls = []; + const multiplierCalls = []; + const booster = fetchContract(addressBook.ethereum.platforms.aura.booster, AuraBooster, ETH_CHAIN_ID); pools.forEach(pool => { const gaugeContract = fetchContract(pool.gauge, AuraGauge, ETH_CHAIN_ID); balanceCalls.push(gaugeContract.read.totalSupply()); rewardRateCalls.push(gaugeContract.read.rewardRate()); periodFinishCalls.push(gaugeContract.read.periodFinish()); + multiplierCalls.push(booster.read.getRewardMultipliers([pool.gauge])); pool.rewards?.forEach(reward => { const virtualGauge = fetchContract(reward.rewardGauge, AuraGauge, ETH_CHAIN_ID); extraRewardInfo.push({ @@ -331,18 +325,20 @@ const getPoolsData = async pools => { Promise.all(periodFinishCalls), Promise.all(extraRewardRateCalls), Promise.all(extraRewardPeriodFinishCalls), + Promise.all(multiplierCalls), ]); const balances = res[0].map(v => new BigNumber(v.toString())); const rewardRates = res[1].map(v => new BigNumber(v.toString())); const finishes = res[2].map(v => new BigNumber(v.toString())); + const multipliers = res[5].map(v => new BigNumber(v.toString())); const extras = extraRewardInfo.map((_, i) => ({ ...extraRewardInfo[i], rewardRate: new BigNumber(res[3][i].toString()), periodFinish: new BigNumber(res[4][i].toString()), })); - return { balances, rewardRates, finishes, extras }; + return { balances, rewardRates, finishes, multipliers, extras }; }; const getAuraData = async () => { diff --git a/src/data/ethereum/auraBalancerLpPools.json b/src/data/ethereum/auraBalancerLpPools.json index f4b7cc9b4..0235efac4 100644 --- a/src/data/ethereum/auraBalancerLpPools.json +++ b/src/data/ethereum/auraBalancerLpPools.json @@ -559,37 +559,6 @@ } ] }, - { - "name": "aura-gyro-gyd-sdai", - "address": "0x1CCE5169bDe03f3d5aD0206f6BD057953539DAE6", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "gauge": "0x2C0D60f986cDe7eE59489055aa22A8E49b6825aD", - "vaultPoolId": "0x1cce5169bde03f3d5ad0206f6bd057953539dae600020000000000000000062b", - "lsUrl": "DSR", - "dataPath": "$.savingsRate", - "balancerChargesFee": false, - "lsIndex": 0, - "decimals": "1e18", - "rewards": [ - { - "rewardGauge": "0xa8EAA1702E07Dc9224Ec2c563838f406652382D9", - "oracleId": "AURA", - "decimals": "1e18" - } - ], - "tokens": [ - { - "oracle": "tokens", - "oracleId": "sDAI", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "GYD", - "decimals": "1e18" - } - ] - }, { "name": "aura-gyro-gyd-usdt", "address": "0xfbfaD5fa9E99081da6461F36f229B5cC88A64c63", @@ -617,33 +586,6 @@ } ] }, - { - "name": "aura-gyro-gyd-usdc", - "address": "0xC2AA60465BfFa1A88f5bA471a59cA0435c3ec5c1", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "gauge": "0xE9096FDB508C0160318c11425Ba75924ecFA1D82", - "vaultPoolId": "0xc2aa60465bffa1a88f5ba471a59ca0435c3ec5c100020000000000000000062c", - "decimals": "1e18", - "rewards": [ - { - "rewardGauge": "0x5220E7A1BC2209F67aad8a6CD595fBfC62349fc9", - "oracleId": "AURA", - "decimals": "1e18" - } - ], - "tokens": [ - { - "oracle": "tokens", - "oracleId": "USDC", - "decimals": "1e6" - }, - { - "oracle": "tokens", - "oracleId": "GYD", - "decimals": "1e18" - } - ] - }, { "name": "aura-reth-rpl", "address": "0x9F9d900462492D4C21e9523ca95A7CD86142F298",