Skip to content

Commit 067838d

Browse files
committed
using charm contract data for geyser calc
1 parent 7388273 commit 067838d

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

frontend/src/components/GeyserFirst/MyStats.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const MyStats = () => {
3232
() => [
3333
{
3434
title: 'APY',
35-
body: currentStake > 0 ? GET_APY_STAKE_MSG() : GET_APY_NO_STAKE_MSG({ days: safeNumeral(calcPeriodInDays||30, '0.0') }),
35+
body: currentStake > 0 ? GET_APY_STAKE_MSG() : GET_APY_NO_STAKE_MSG(),
3636
},
3737
{
3838
title: 'Reward Multiplier',

frontend/src/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ export const INITIAL_SUPPLY = 50000000
8484

8585
// tooltip messages
8686
export const GET_APY_STAKE_MSG = () =>
87-
'APY is estimated for your current deposits till the end of this program. The APY metric does not account for gains or losses from holding liquidity tokens, or gains from liquidity mining rewards distributed by the underlying platform for holding liquidity tokens.'
87+
'APY is estimated for your current deposits till the end of the active program. The APY metric does not account for gains or losses from holding liquidity tokens, or gains from liquidity mining rewards distributed by the underlying platform for holding liquidity tokens.'
8888

89-
export const GET_APY_NO_STAKE_MSG = ({ days = '1' }) =>
90-
`APY is estimated for an avg deposit (20,000 USD) over the next ${days} days. The APY metric does not account for gains or losses from holding liquidity tokens, or gains from liquidity mining rewards distributed by the underlying platform for holding liquidity tokens.`
89+
export const GET_APY_NO_STAKE_MSG = () =>
90+
`APY is estimated for an avg deposit (of 20,000 USD) till the end of the active program. The APY metric does not account for gains or losses from holding liquidity tokens, or gains from liquidity mining rewards distributed by the underlying platform for holding liquidity tokens.`
9191

9292
export const GET_REWARD_MULTIPLIER_MSG = ({ days = '30', multiplier = '3.0' }) =>
9393
`Deposit liquidity tokens for ${days} days to achieve a ${multiplier}x reward multiplier.`

frontend/src/utils/stakingToken.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,13 @@ const getCharmV1 = async (tokenAddress: string, signerOrProvider: SignerOrProvid
412412
const contract = new Contract(address, CHARM_V1_ABI, signerOrProvider)
413413

414414
const { name, symbol, decimals } = await getTokenInfo(address, signerOrProvider)
415+
const poolBals = await contract.getTotalAmounts()
415416
const totalSupply: BigNumber = await contract.totalSupply()
416417
const totalSupplyNumber = parseFloat(formatUnits(totalSupply, decimals))
417418

418-
const vaultData = await fetch(`https://web-api.ampleforth.org/lp/charm-vault-info?chainID=1&vaultAddress=${tokenAddress}`);
419-
const vault = await vaultData.json();
420-
421419
const tokenCompositions = await getTokenCompositionsWithBalances(
422420
[await contract.token0(), await contract.token1()],
423-
[vault.total0, vault.total1],
421+
poolBals,
424422
signerOrProvider,
425423
[0.5, 0.5],
426424
)

frontend/src/utils/stats.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const defaultUserStats = (): UserStats => ({
3333
apy: 0,
3434
currentMultiplier: 1.0,
3535
minMultiplier: 1.0,
36-
maxMultiplier: 1.0,
36+
maxMultiplier: 3.0,
3737
currentReward: 0,
3838
currentRewardShare: 0,
3939
})
@@ -323,7 +323,7 @@ const getCurrentMultiplier = async (
323323
const perc = Math.min(now - ts, st) / st
324324
weightedStake += perc * amt
325325
})
326-
const fraction = weightedStake / totalStake
326+
const fraction = (geyserVaultData.stakes.length > 0) ? weightedStake / totalStake : 0
327327
const currentMultiplier = minMultiplier + fraction * (maxMultiplier - minMultiplier)
328328
return [minMultiplier, currentMultiplier, maxMultiplier]
329329
}

0 commit comments

Comments
 (0)