From 8307246ca7bbe1aaddd1f402e313a6c7c29a6054 Mon Sep 17 00:00:00 2001 From: Victor Creed Date: Fri, 16 Oct 2020 13:52:55 +0300 Subject: [PATCH] fixes contract approving when trading long with DOC --- src/app/hooks/trading/useApproveAndTrade.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/hooks/trading/useApproveAndTrade.ts b/src/app/hooks/trading/useApproveAndTrade.ts index 791421f98..98c6fa8c9 100644 --- a/src/app/hooks/trading/useApproveAndTrade.ts +++ b/src/app/hooks/trading/useApproveAndTrade.ts @@ -44,7 +44,7 @@ export function useApproveAndTrade( txHash: approveTx, status: approveStatus, loading: approveLoading, - } = useTokenApprove(getToken(), getLendingContract(lendingContract).address); + } = useTokenApprove(token, getLendingContract(lendingContract).address); const { trade, @@ -78,14 +78,14 @@ export function useApproveAndTrade( const handleTx = useCallback(() => { if ( - getToken() !== Asset.BTC && + token !== Asset.BTC && bignumber(collateralTokenSent).greaterThan(allowance.value) ) { handleApprove(toWei('1000000', 'ether')); } else { handleTrade(); } - }, [getToken, allowance, collateralTokenSent, handleApprove, handleTrade]); + }, [allowance, collateralTokenSent, handleApprove, handleTrade, token]); const [txState, setTxState] = useState<{ type: TxType;