Skip to content

Commit

Permalink
fix: Past pools with BNB token (pancakeswap#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
RabbitDoge authored Mar 18, 2021
1 parent de3e119 commit ef92b99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/views/Pools/components/CardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ const CardFooter: React.FC<Props> = ({
<Balance fontSize="14px" isDisabled={isFinished} value={blocksRemaining} decimals={0} />
</Row>
)}
<Flex mb="4px">
<TokenLink onClick={() => registerToken(tokenAddress, tokenName, tokenDecimals, imageSrc)}>
Add {tokenName} to Metamask
</TokenLink>
<MetamaskIcon height={15} width={15} ml="4px" />
</Flex>
{tokenAddress && (
<Flex mb="4px">
<TokenLink onClick={() => registerToken(tokenAddress, tokenName, tokenDecimals, imageSrc)}>
Add {tokenName} to Metamask
</TokenLink>
<MetamaskIcon height={15} width={15} ml="4px" />
</Flex>
)}
<TokenLink href={projectLink} target="_blank">
{TranslateString(412, 'View project site')}
</TokenLink>
Expand Down
5 changes: 3 additions & 2 deletions src/views/Pools/components/PoolCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ const PoolCard: React.FC<HarvestProps> = ({ pool }) => {
userData,
stakingLimit,
} = pool

// Pools using native BNB behave differently than pools using a token
const isBnbPool = poolCategory === PoolCategory.BINANCE
const TranslateString = useI18n()
const stakingTokenContract = useERC20(getAddress(stakingToken.address))
const stakingTokenContract = useERC20(stakingToken.address ? getAddress(stakingToken.address) : '')
const { account } = useWeb3React()
const { onApprove } = useSousApprove(stakingTokenContract, sousId)
const { onStake } = useSousStake(sousId, isBnbPool)
Expand Down Expand Up @@ -213,7 +214,7 @@ const PoolCard: React.FC<HarvestProps> = ({ pool }) => {
isFinished={isFinished}
poolCategory={poolCategory}
tokenName={earningToken.symbol}
tokenAddress={getAddress(earningToken.address)}
tokenAddress={earningToken.address ? getAddress(earningToken.address) : ''}
tokenDecimals={earningToken.decimals}
/>
</Card>
Expand Down

0 comments on commit ef92b99

Please sign in to comment.