-
Notifications
You must be signed in to change notification settings - Fork 10
/
deploy.js
31 lines (25 loc) · 1.1 KB
/
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
// To compile the serpent file, run
// serpent mk_contract_info_decl contract.se
var exec = require('child_process').exec;
exec('serpent mk_contract_info_decl ether-on-a-stick/contract.se',
function (error, stdout, stderr) {
if (error !== null) {
console.log('exec error: ' + error);
}
var compiledContract = JSON.parse(stdout);
// console.log('stdout: ' + stdout);
// console.log('stderr: ' + stderr);
var etherStickContract = web3.eth.contract(compiledContract.info.abiDefinition);
var etherStick = etherStickContract.new({from:web3.eth.accounts[0], data: compiledContract.code, gas: 300000}, function(e, contract){
if(!e) {
if(!contract.address) {
console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
} else {
console.log("Contract mined! Address: " + contract.address);
console.log(contract);
}
} else {
console.log(e);
}
})
});