Skip to content

Commit

Permalink
fix(erc20): prefer tsignore over hardcoded erc20 list
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed Dec 24, 2020
1 parent 2278183 commit 78b2838
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,16 @@ const ErrorTextContainer = styled.div`
display: flex;
justify-content: center;
flex-direction: row;
margin-left: 40px;
margin-right: 40px;
`
const ErrorText = styled(Text)`
display: inline-flex;
align-items: center;
font-weight: 500;
font-size: 14px;
padding: 6px 12px;
border-radius: 32px;
border-radius: 8px;
background-color: ${props => props.theme.red000};
color: ${props => props.theme.red800};
margin-bottom: 16px;
Expand Down Expand Up @@ -286,18 +289,18 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
: amountRowNode.children[amountRowNode.children.length - 1]
currencyNode.style.fontSize = `${fontSizeNumber * fontRatio}px`
}

const limit = Number(props.sddLimit.max) / SDD_LIMIT_FACTOR
// if user is attempting to send NC ERC20, ensure they have sufficient
// ETH balance else warn user and disable trade
const isErc20 = props.supportedCoins[cryptoCurrency].contractAddress
const isSufficientEthForErc20 =
props.payment &&
(props.payment.coin === 'PAX' ||
props.payment.coin === 'USDT' ||
props.payment.coin === 'WDGLD') &&
!props.payment.isSufficientEthForErc20 &&
isErc20 &&
props.swapAccount?.type === 'ACCOUNT' &&
props.orderType === 'SELL'
props.orderType === 'SELL' &&
isErc20 &&
// @ts-ignore
!props.payment.isSufficientEthForErc20

return (
<CustomForm onSubmit={props.handleSubmit}>
<FlyoutWrapper style={{ paddingBottom: '0px', borderBottom: 'grey000' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,17 @@ const Checkout: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
}
const userMax = Number(payment ? payment.effectiveBalance : BASE.balance)
const balanceBelowMinimum = userMax < Number(min)

const isQuoteFailed = Remote.Failure.is(props.quoteR)
// if user is attempting to send NC ERC20, ensure they have sufficient
// ETH balance else warn user and disable trade
const isErc20 = coins[BASE.coin].contractAddress
const isSufficientEthForErc20 =
const disableInsufficientEth =
props.payment &&
(props.payment.coin === 'PAX' ||
props.payment.coin === 'USDT' ||
props.payment.coin === 'WDGLD') &&
BASE.type === 'ACCOUNT' &&
isErc20 &&
// @ts-ignore
props.payment.isSufficientEthForErc20
const disableInsufficientEth =
isErc20 && !isSufficientEthForErc20 && BASE.type === 'ACCOUNT'

return (
<FlyoutWrapper style={{ paddingTop: '20px' }}>
<StyledForm onSubmit={handleSubmit}>
Expand Down

0 comments on commit 78b2838

Please sign in to comment.