5_deploy_erc20_tornado.js 897 B

1234567891011121314151617181920212223242526272829
  1. /* global artifacts */
  2. require('dotenv').config({ path: '../.env' })
  3. const ERC20Tornado = artifacts.require('ERC20Tornado')
  4. const Verifier = artifacts.require('Verifier')
  5. const Hasher = artifacts.require('Hasher')
  6. const ERC20Mock = artifacts.require('ERC20Mock')
  7. module.exports = function (deployer) {
  8. return deployer.then(async () => {
  9. const { MERKLE_TREE_HEIGHT, ERC20_TOKEN, TOKEN_AMOUNT } = process.env
  10. const verifier = await Verifier.deployed()
  11. const hasher = await Hasher.deployed()
  12. let token = ERC20_TOKEN
  13. if (token === '') {
  14. const tokenInstance = await deployer.deploy(ERC20Mock)
  15. token = tokenInstance.address
  16. }
  17. const tornado = await deployer.deploy(
  18. ERC20Tornado,
  19. verifier.address,
  20. hasher.address,
  21. TOKEN_AMOUNT,
  22. MERKLE_TREE_HEIGHT,
  23. token,
  24. )
  25. console.log('ERC20Tornado address', tornado.address)
  26. })
  27. }