Commit f44d0749 authored by Chi Kei Chan's avatar Chi Kei Chan Committed by GitHub

Fix Approval and Unlocks integration (#73)

parent ade904d2
......@@ -284,7 +284,6 @@ class CurrencyInputPanel extends Component {
const {
title,
description,
value,
errors,
showSubButton,
subButtonContent,
......
......@@ -18,8 +18,14 @@ export const isExchangeUnapproved = opts => {
return false;
}
const allowanceKey = drizzleCtx.contracts[inputExchange].methods.allowance.cacheCall(account, inputExchange);
const allowance = contractStore[inputExchange].allowance[allowanceKey];
const allowanceKey = drizzleCtx.contracts[currency].methods.allowance.cacheCall(account, inputExchange);
if (!contractStore[currency]) {
return false;
}
const allowance = contractStore[currency].allowance[allowanceKey];
if (!allowance) {
return false;
}
......@@ -42,10 +48,10 @@ export const approveExchange = async opts => {
}
const decimals = await getDecimals({ address: currency, drizzleCtx, contractStore });
return drizzleCtx.contracts[inputExchange].methods.approve.cacheSend(
const approvals = BN(10 ** decimals).multipliedBy(BN(10 ** 8)).toFixed(0);
return drizzleCtx.contracts[currency].methods.approve.cacheSend(
inputExchange,
web3.utils.toHex(decimals*10**18),
web3.utils.toHex(approvals),
{ from: account }
);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment