-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
31 lines (17 loc) · 847 Bytes
/
deploy.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
const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode} = require('./compile');
const provider = new HDWalletProvider(
'ladder large heart unhappy anxiety sting fix cream friend rhythm slight action',
'https://rinkeby.infura.io/v3/3d116f8970664df2b977047bd66ced49'
);
const web3 = new Web3(provider);
const deploy = async() => {
const accounts = await web3.eth.getAccounts();
console.log("------Attempting to deploy from account",accounts[0]);
const result = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data: bytecode,arguments:["HI there!"]})
.send({from:accounts[0],gas: '1000000'})
console.log("----------contract deployed to", result.options.address);
};
deploy();