Created
June 13, 2016 18:05
-
-
Save daragao/4f319f75857f7b61a0c4991e003cce44 to your computer and use it in GitHub Desktop.
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
var Web3 = require('web3'); | |
var web3 = new Web3(); | |
var provider = new web3.providers.HttpProvider('http://localhost:8545'); | |
web3.setProvider(provider); | |
if(process.argv.length < 3) { | |
console.log('needs the contract Name as argument!'); | |
process.exit(1); | |
} | |
var contractName = process.argv[2]; | |
var GreeterContract = require('./'+contractName+'.sol.js'); | |
GreeterContract.setProvider(provider); | |
GreeterContract.defaults({from:web3.eth.accounts[0]}); | |
var params = process.argv.slice(3,5); | |
GreeterContract.new.apply(GreeterContract,params).then(function(greeter) { | |
console.log('contract address: '+greeter.address); | |
}).catch(function(err) { | |
console.log("Error creating contract!"); | |
console.log(err.stack); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment