-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a3622f
commit a3588b4
Showing
4 changed files
with
906 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const HDWAlletProvider = require('truffle-hdwallet-provider'); | ||
const Web3 = require('web3'); | ||
const {interface, bytecode} = require('./compile'); | ||
|
||
const provider = new HDWAlletProvider( | ||
'will local problem govern armor risk icon pioneer hospital clock beef dust', | ||
'https://rinkeby.infura.io/ncPX8dwwzFDA8pywepNB' | ||
) | ||
|
||
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: '0x' + bytecode, arguments: ['Hi there']}) | ||
.send({ | ||
gas: '1000000', | ||
from: accounts[0], | ||
gasPrice: web3.utils.toWei('2', 'gwei') | ||
}); | ||
|
||
console.log('contract deployed to ', result.options.address); | ||
|
||
}; | ||
|
||
deploy(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.