Skip to content

Commit

Permalink
fixes contract approving when trading long with DOC
Browse files Browse the repository at this point in the history
  • Loading branch information
creed-victor committed Oct 16, 2020
1 parent 31a52ac commit 8307246
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/hooks/trading/useApproveAndTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8307246

Please sign in to comment.