-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy-factory.js
37 lines (29 loc) · 1.01 KB
/
deploy-factory.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const Web3 = require('web3');
const web3 = new Web3('http://localhost:9545');
const p0 = "30";
const p1 = "0x0000000000000000000000000000000000000000";
const p2 = "0x0000000000000000000000000000000000000000";
const FactoryCode = require('./build/contracts/LiquidFactory.json').bytecode
const FactoryAbi = require('./build/contracts/LiquidFactory.json').abi
async function deployToken() {
try {
const ganacheAccounts = await web3.eth.getAccounts();
const contract = new web3.eth.Contract(FactoryAbi);
contract.deploy({
arguments: [p0, p1, p2],
data: FactoryCode
}).send({
from: ganacheAccounts[0],
gas: 4712388,
gasPrice: 100000000000
}).then((deployment) => {
console.log('Factory was deployed at the following address:');
console.log(deployment.options.address);
}).catch((err) => {
console.error(err);
});
} catch (e) {
console.log(e);
}
}
deployToken();