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 { ...@@ -284,7 +284,6 @@ class CurrencyInputPanel extends Component {
const { const {
title, title,
description, description,
value,
errors, errors,
showSubButton, showSubButton,
subButtonContent, subButtonContent,
......
...@@ -18,8 +18,14 @@ export const isExchangeUnapproved = opts => { ...@@ -18,8 +18,14 @@ export const isExchangeUnapproved = opts => {
return false; return false;
} }
const allowanceKey = drizzleCtx.contracts[inputExchange].methods.allowance.cacheCall(account, inputExchange); const allowanceKey = drizzleCtx.contracts[currency].methods.allowance.cacheCall(account, inputExchange);
const allowance = contractStore[inputExchange].allowance[allowanceKey];
if (!contractStore[currency]) {
return false;
}
const allowance = contractStore[currency].allowance[allowanceKey];
if (!allowance) { if (!allowance) {
return false; return false;
} }
...@@ -42,10 +48,10 @@ export const approveExchange = async opts => { ...@@ -42,10 +48,10 @@ export const approveExchange = async opts => {
} }
const decimals = await getDecimals({ address: currency, drizzleCtx, contractStore }); const decimals = await getDecimals({ address: currency, drizzleCtx, contractStore });
const approvals = BN(10 ** decimals).multipliedBy(BN(10 ** 8)).toFixed(0);
return drizzleCtx.contracts[inputExchange].methods.approve.cacheSend( return drizzleCtx.contracts[currency].methods.approve.cacheSend(
inputExchange, inputExchange,
web3.utils.toHex(decimals*10**18), web3.utils.toHex(approvals),
{ from: account } { 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