Update Exchange.js
added const
This commit is contained in:
@@ -29,6 +29,10 @@ const Exchange = ({ pools }) => {
|
||||
const fromTokenContract = new Contract(fromToken, ERC20.abi);
|
||||
const fromTokenBalance = useTokenBalance(fromToken, account); //Know balance of "from Token"
|
||||
const toTokenBalance = useTokenBalance(toToken, account); //Know balance of "to Token"
|
||||
const tokenAllowance = useTokenAllowance(fromToken, account, ROUTER_ADDRESS) || parseUnits("0");
|
||||
const approvedNeeded = fromValueBigNumber.gt(tokenAllowance); //We need to approve to make the swap
|
||||
const formValueIsGreaterThan0 = fromValueBigNumber.gt(parseUnits("0")); //has to be greater than 0
|
||||
const hasEnoughBalance = fromValueBigNumber.lte(fromTokenBalance ?? parseUnits("0")); //lte = lower than or equal to
|
||||
|
||||
const isApproving = isOperationPending(swapApproveState);
|
||||
const isSwapping = isOperationPending(swapExecuteState);
|
||||
|
||||
Reference in New Issue
Block a user