Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Dev #50

Merged
merged 3 commits into from
Mar 20, 2021
Merged

Dev #50

Show file tree
Hide file tree
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
20 changes: 13 additions & 7 deletions src/pages/Earn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ export default function Earn() {
* @todo only account for this if rewards are inactive
*/
const stakingInfosWithBalance = stakingInfos

let timeToStakingFinish = stakingInfos?.[0]?.periodFinish
stakingInfos.map(item => {
const period = item ? item.periodFinish : timeToStakingFinish
if (period && item.active && timeToStakingFinish && timeToStakingFinish < period) {
timeToStakingFinish = period
}
});
// toggle copy if rewards are inactive
const stakingRewardsExist = Boolean(typeof chainId === 'number' && (STAKING_REWARDS_INFO[chainId]?.length ?? 0) > 0)

Expand Down Expand Up @@ -223,7 +229,7 @@ export default function Earn() {
<AutoColumn gap="lg" style={{ width: '100%', maxWidth: '720px' }}>
<DataRow style={{ alignItems: 'baseline' }}>
<TYPE.mediumHeader style={{ marginTop: '0.5rem' }}>Participating pools</TYPE.mediumHeader>
<Countdown exactEnd={stakingInfos?.[0]?.periodFinish} />
<Countdown exactEnd={timeToStakingFinish} />
</DataRow>

<PoolSection>
Expand All @@ -234,11 +240,11 @@ export default function Earn() {
) : stakingInfos?.length !== 0 && stakingInfosWithBalance.length === 0 ? (
<OutlineCard>No active pools</OutlineCard>
) : (
stakingInfosWithBalance?.map(stakingInfo => {
// need to sort by added liquidity here
return <PoolCard key={stakingInfo.stakingRewardAddress} stakingInfoTop={stakingInfo} />
})
)}
stakingInfosWithBalance?.map(stakingInfo => {
// need to sort by added liquidity here
return <PoolCard key={stakingInfo.stakingRewardAddress} stakingInfoTop={stakingInfo} />
})
)}
</PoolSection>
</AutoColumn>
</PageWrapper>
Expand Down
4 changes: 2 additions & 2 deletions src/state/stake/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const STAKING_GENESIS_CHAINS = {
}

export const REWARDS_DURATION_DAYS_CHAINS = {
[ChainId.AVALANCHE]: 45,
[ChainId.SMART_CHAIN]: 30
[ChainId.AVALANCHE]: 60,
[ChainId.SMART_CHAIN]: 60
}

export const STAKING_GENESIS = 1615597200
Expand Down