-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
25 lines (19 loc) · 871 Bytes
/
deploy.js
File metadata and controls
25 lines (19 loc) · 871 Bytes
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
const Web3 = require("web3");
const HDWalletProvider = require('truffle-hdwallet-provider');
const { interface, bytecode } = require('./compile');
const provider = new HDWalletProvider(
// Account mnemonics
'recipe submit horror approve bargain used pretty orient recycle put meadow crash',
// Link to connect to to deploy
'https://rinkeby.infura.io/v3/486b5f156a244fedb0a6c3056b66eaa5'
);
const web3 = new Web3(provider);
async function deploy() {
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: '0x' + bytecode}) // add 0x bytecode
.send({from: accounts[0]}); // remove 'gas'
console.log("Console deployed to", result.options.address);
}
deploy();