diff --git a/server/web3sign/controllers/erc.js b/server/web3sign/controllers/erc.js index 132778d..5a55da2 100644 --- a/server/web3sign/controllers/erc.js +++ b/server/web3sign/controllers/erc.js @@ -32,6 +32,16 @@ async function approveErc20(session) { return; } } + const contractMeta = bc.getContractByName(currencyName); + if (!contractMeta) { + session.rspErr(500, 'currency meta not found'); + return; + } + console.log(contractMeta); + if (contractMeta['type'] != 'erc20') { + session.rspErr(500, 'currency meta type error'); + return; + } const instance = bc.getInstanceByName(currencyName); if (!instance) { @@ -46,7 +56,7 @@ async function approveErc20(session) { session.rspData({ 'trans_id' : '', 'trans_req': { - 'to': '', + 'to': contractMeta['address'], 'data': data } });