mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-08-18 03:20:12 -04:00
uniswap integration
This commit is contained in:
parent
5b53815aa2
commit
1dea821af3
5 changed files with 316 additions and 14 deletions
|
@ -4,6 +4,9 @@ const ERC20Mixer = artifacts.require('ERC20Mixer')
|
|||
const Verifier = artifacts.require('Verifier')
|
||||
const MiMC = artifacts.require('MiMC')
|
||||
const ERC20Mock = artifacts.require('ERC20Mock')
|
||||
const UniswapMock = artifacts.require('UniswapMock')
|
||||
const { toBN, toWei } = require('web3-utils')
|
||||
const eth2daiPrice = toBN('174552286079977583324') // cause 1 ETH == 174.55 DAI
|
||||
|
||||
|
||||
module.exports = function(deployer, network, accounts) {
|
||||
|
@ -12,10 +15,15 @@ module.exports = function(deployer, network, accounts) {
|
|||
const verifier = await Verifier.deployed()
|
||||
const miMC = await MiMC.deployed()
|
||||
await ERC20Mixer.link(MiMC, miMC.address)
|
||||
let token = ERC20_TOKEN
|
||||
if(token === '') {
|
||||
const tokenInstance = await deployer.deploy(ERC20Mock)
|
||||
token = tokenInstance.address
|
||||
let tokenAddress = ERC20_TOKEN
|
||||
let uniswapAddress
|
||||
if (network === 'development') {
|
||||
if(tokenAddress === '') { // means we want to test with mock
|
||||
const tokenInstance = await deployer.deploy(ERC20Mock)
|
||||
tokenAddress = tokenInstance.address
|
||||
}
|
||||
const uniswap = await deployer.deploy(UniswapMock, tokenAddress, eth2daiPrice, { value: toWei('0.5') })
|
||||
uniswapAddress = uniswap.address
|
||||
}
|
||||
const mixer = await deployer.deploy(
|
||||
ERC20Mixer,
|
||||
|
@ -24,8 +32,9 @@ module.exports = function(deployer, network, accounts) {
|
|||
MERKLE_TREE_HEIGHT,
|
||||
EMPTY_ELEMENT,
|
||||
accounts[0],
|
||||
token,
|
||||
TOKEN_AMOUNT
|
||||
tokenAddress,
|
||||
TOKEN_AMOUNT,
|
||||
uniswapAddress
|
||||
)
|
||||
console.log('ERC20Mixer\'s address ', mixer.address)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue