mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-12-28 07:39:22 -05:00
deploy script
This commit is contained in:
parent
a359e86f85
commit
8580c5e427
6
contracts/Mocks/IDeployer.sol
Normal file
6
contracts/Mocks/IDeployer.sol
Normal file
@ -0,0 +1,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.6.0;
|
||||
|
||||
interface IDeployer {
|
||||
function deploy(bytes memory _initCode, bytes32 _salt) external returns (address payable createdContract);
|
||||
}
|
25
deploy.js
Normal file
25
deploy.js
Normal file
@ -0,0 +1,25 @@
|
||||
const eth = true
|
||||
const poolSize = '1000000000000000000'
|
||||
const hasherAddress = '0x83584f83f26aF4eDDA9CBe8C730bc87C364b28fe'
|
||||
const verifierAddress = '0xce172ce1F20EC0B3728c9965470eaf994A03557A'
|
||||
const deployerAddress = '0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80'
|
||||
const deploySalt = '0x0000000000000000000000000000000000000000000000000000000047941987'
|
||||
const rpcUrl = 'https://mainnet.infura.io'
|
||||
|
||||
const Web3 = require('web3')
|
||||
const web3 = new Web3(rpcUrl)
|
||||
|
||||
const contractData = require('./build/contracts/' + (eth ? 'ETHTornado.json' : 'ERC20Tornado.json'))
|
||||
const contract = new web3.eth.Contract(contractData.abi)
|
||||
const bytes = contract
|
||||
.deploy({
|
||||
data: contractData.bytecode,
|
||||
arguments: [verifierAddress, hasherAddress, poolSize, 20],
|
||||
})
|
||||
.encodeABI()
|
||||
|
||||
console.log('Deploy bytecode', bytes)
|
||||
|
||||
const deployer = new web3.eth.Contract(require('./build/contracts/IDeployer.json').abi, deployerAddress)
|
||||
const receipt = deployer.methods.deploy(bytes, deploySalt)
|
||||
receipt.then(console.log).catch(console.log)
|
@ -4,7 +4,7 @@ const ETHTornado = artifacts.require('ETHTornado')
|
||||
const Verifier = artifacts.require('Verifier')
|
||||
const Hasher = artifacts.require('Hasher')
|
||||
|
||||
module.exports = function (deployer, network, accounts) {
|
||||
module.exports = function (deployer) {
|
||||
return deployer.then(async () => {
|
||||
const { MERKLE_TREE_HEIGHT, ETH_AMOUNT } = process.env
|
||||
const verifier = await Verifier.deployed()
|
||||
|
@ -5,7 +5,7 @@ const Verifier = artifacts.require('Verifier')
|
||||
const Hasher = artifacts.require('Hasher')
|
||||
const ERC20Mock = artifacts.require('ERC20Mock')
|
||||
|
||||
module.exports = function (deployer, network, accounts) {
|
||||
module.exports = function (deployer) {
|
||||
return deployer.then(async () => {
|
||||
const { MERKLE_TREE_HEIGHT, ERC20_TOKEN, TOKEN_AMOUNT } = process.env
|
||||
const verifier = await Verifier.deployed()
|
||||
|
Loading…
Reference in New Issue
Block a user