-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
23 lines (18 loc) · 825 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
const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require('./compile');
const provider = new HDWalletProvider(
'witness cricket reform stereo horse budget border upgrade purity puppy flight shield',
'https://rinkeby.infura.io/v3/f5c1ecd8143e43ed9951c2aa9e9ad9a4'
);
const web3 = new Web3(provider);
// just to be able to use async await
const deploy = async () => {
const accounts = await web3.eth.getAccounts();
console.log('deploying with account :' , accounts[0]);
const res = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data : bytecode , arguments : ['Hi There !']})
.send({gas : 1000000 , from: accounts[0]});
console.log('contract deployed to :',res.options.address);
};
deploy();