mirror of
https://github.com/tornadocash/tornado-cli.git
synced 2024-11-22 01:37:08 +01:00
Fixed bug on ERC20 support
This commit is contained in:
parent
66e781ea83
commit
00f68385e3
8
cli.js
8
cli.js
@ -951,9 +951,9 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', torPort,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLocalRPC) {
|
if (isLocalRPC) {
|
||||||
tornadoAddress = currency === 'eth' ? contractJson.networks[netId].address : erc20tornadoJson.networks[netId].address
|
|
||||||
tokenAddress = currency !== 'eth' ? erc20ContractJson.networks[netId].address : null
|
|
||||||
netSymbol = getCurrentNetworkSymbol()
|
netSymbol = getCurrentNetworkSymbol()
|
||||||
|
tornadoAddress = currency === netSymbol.toLowerCase() ? contractJson.networks[netId].address : erc20tornadoJson.networks[netId].address
|
||||||
|
tokenAddress = currency !== netSymbol.toLowerCase() ? erc20ContractJson.networks[netId].address : null
|
||||||
deployedBlockNumber = 0
|
deployedBlockNumber = 0
|
||||||
senderAccount = (await web3.eth.getAccounts())[0]
|
senderAccount = (await web3.eth.getAccounts())[0]
|
||||||
} else {
|
} else {
|
||||||
@ -970,7 +970,7 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', torPort,
|
|||||||
if (!tornadoAddress) {
|
if (!tornadoAddress) {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
}
|
}
|
||||||
tokenAddress = config.deployments[`netId${netId}`][currency].tokenAddress
|
tokenAddress = currency !== netSymbol.toLowerCase() ? config.deployments[`netId${netId}`][currency].tokenAddress : null
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('There is no such tornado instance, check the currency and amount you provide', e)
|
console.error('There is no such tornado instance, check the currency and amount you provide', e)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
@ -980,7 +980,7 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', torPort,
|
|||||||
tornado = new web3.eth.Contract(contractJson, tornadoAddress)
|
tornado = new web3.eth.Contract(contractJson, tornadoAddress)
|
||||||
tornadoContract = new web3.eth.Contract(instanceJson, tornadoInstance)
|
tornadoContract = new web3.eth.Contract(instanceJson, tornadoInstance)
|
||||||
contractAddress = tornadoAddress
|
contractAddress = tornadoAddress
|
||||||
erc20 = currency !== 'eth' ? new web3.eth.Contract(erc20ContractJson.abi, tokenAddress) : {}
|
erc20 = currency !== netSymbol.toLowerCase() ? new web3.eth.Contract(erc20ContractJson.abi, tokenAddress) : {}
|
||||||
erc20Address = tokenAddress
|
erc20Address = tokenAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user