From 1f4fec44d09c418ae55e494469f0b9db380d2fe1 Mon Sep 17 00:00:00 2001 From: totop716 Date: Mon, 7 Feb 2022 13:04:10 -0500 Subject: [PATCH 1/2] fix daily reward rate on stake modal for syrup --- src/components/StakeSyrupModal/StakeSyrupModal.tsx | 1 - src/state/stake/hooks.ts | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/StakeSyrupModal/StakeSyrupModal.tsx b/src/components/StakeSyrupModal/StakeSyrupModal.tsx index 582e458bc..d35536055 100644 --- a/src/components/StakeSyrupModal/StakeSyrupModal.tsx +++ b/src/components/StakeSyrupModal/StakeSyrupModal.tsx @@ -79,7 +79,6 @@ const StakeSyrupModal: React.FC = ({ hypotheticalRewardRate = syrup.getHypotheticalRewardRate( syrup.stakedAmount.add(parsedAmountWrapped), syrup.totalStakedAmount.add(parsedAmountWrapped), - syrup.totalRewardRate, ); } diff --git a/src/state/stake/hooks.ts b/src/state/stake/hooks.ts index daabaceaf..7edd9a064 100755 --- a/src/state/stake/hooks.ts +++ b/src/state/stake/hooks.ts @@ -201,7 +201,6 @@ export interface SyrupInfo { getHypotheticalRewardRate: ( stakedAmount: TokenAmount, totalStakedAmount: TokenAmount, - totalRewardRate: TokenAmount, ) => TokenAmount; } @@ -545,13 +544,12 @@ export function useSyrupInfo( const getHypotheticalRewardRate = ( stakedAmount: TokenAmount, totalStakedAmount: TokenAmount, - totalRewardRate: TokenAmount, ): TokenAmount => { return new TokenAmount( token, JSBI.greaterThan(totalStakedAmount.raw, JSBI.BigInt(0)) ? JSBI.divide( - JSBI.multiply(totalRewardRate.raw, stakedAmount.raw), + JSBI.multiply(totalRewardRate01.raw, stakedAmount.raw), totalStakedAmount.raw, ) : JSBI.BigInt(0), @@ -561,7 +559,6 @@ export function useSyrupInfo( const individualRewardRate = getHypotheticalRewardRate( stakedAmount, totalStakedAmount, - totalRewardRate01, ); const periodFinishMs = syrupInfo.ending; @@ -789,13 +786,12 @@ export function useOldSyrupInfo( const getHypotheticalRewardRate = ( stakedAmount: TokenAmount, totalStakedAmount: TokenAmount, - totalRewardRate: TokenAmount, ): TokenAmount => { return new TokenAmount( token, JSBI.greaterThan(totalStakedAmount.raw, JSBI.BigInt(0)) ? JSBI.divide( - JSBI.multiply(totalRewardRate.raw, stakedAmount.raw), + JSBI.multiply(totalRewardRate01.raw, stakedAmount.raw), totalStakedAmount.raw, ) : JSBI.BigInt(0), @@ -805,7 +801,6 @@ export function useOldSyrupInfo( const individualRewardRate = getHypotheticalRewardRate( stakedAmount, totalStakedAmount, - totalRewardRate01, ); const periodFinishMs = syrupInfo.ending; From d0f96b29c38f431dd7f62ae30661c97fcf48777f Mon Sep 17 00:00:00 2001 From: totop716 Date: Mon, 7 Feb 2022 20:04:24 -0500 Subject: [PATCH 2/2] update name of the variable --- src/state/stake/hooks.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/state/stake/hooks.ts b/src/state/stake/hooks.ts index 7edd9a064..1f8aebc62 100755 --- a/src/state/stake/hooks.ts +++ b/src/state/stake/hooks.ts @@ -537,7 +537,7 @@ export function useSyrupInfo( const totalRewardRate = new TokenAmount(token, JSBI.BigInt(rate)); //const pair = info[index].pair.toLowerCase(); //const fees = (pairData && pairData[pair] ? pairData[pair].oneDayVolumeUSD * 0.0025: 0); - const totalRewardRate01 = new TokenAmount( + const rewardRate = new TokenAmount( token, JSBI.BigInt(rewardRateState.result?.[0]), ); @@ -549,7 +549,7 @@ export function useSyrupInfo( token, JSBI.greaterThan(totalStakedAmount.raw, JSBI.BigInt(0)) ? JSBI.divide( - JSBI.multiply(totalRewardRate01.raw, stakedAmount.raw), + JSBI.multiply(rewardRate.raw, stakedAmount.raw), totalStakedAmount.raw, ) : JSBI.BigInt(0), @@ -779,7 +779,7 @@ export function useOldSyrupInfo( const totalRewardRate = new TokenAmount(token, JSBI.BigInt(rate)); //const pair = info[index].pair.toLowerCase(); //const fees = (pairData && pairData[pair] ? pairData[pair].oneDayVolumeUSD * 0.0025: 0); - const totalRewardRate01 = new TokenAmount( + const rewardRate = new TokenAmount( token, JSBI.BigInt(rewardRateState.result?.[0]), ); @@ -791,7 +791,7 @@ export function useOldSyrupInfo( token, JSBI.greaterThan(totalStakedAmount.raw, JSBI.BigInt(0)) ? JSBI.divide( - JSBI.multiply(totalRewardRate01.raw, stakedAmount.raw), + JSBI.multiply(rewardRate.raw, stakedAmount.raw), totalStakedAmount.raw, ) : JSBI.BigInt(0),