Merge pull request #25 from debris/fixed_contract_address
Fixed contract address
This commit is contained in:
commit
19eb84ef91
8339
js/web3.js
8339
js/web3.js
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,7 @@ var fs = require('fs');
|
|||
var grunt = require('grunt');
|
||||
var readYaml = require('read-yaml');
|
||||
var Config = require('./config/config.js');
|
||||
var sleep = require('sleep');
|
||||
|
||||
Deploy = function(env, contractFiles, blockchainConfig, contractsConfig) {
|
||||
//this.blockchainConfig = (new Config.Blockchain()).loadConfigFile('config/blockchain.yml').config(env);
|
||||
|
@ -56,12 +57,10 @@ Deploy.prototype.deploy_contracts = function(env) {
|
|||
gasPrice: contract.gasPrice
|
||||
});
|
||||
|
||||
contractObject["new"].apply(contractObject, contractParams);
|
||||
contractAddress = undefined; // TODO;
|
||||
this.deployedContracts[className] = contractAddress;
|
||||
var transactionHash = contractObject["new"].apply(contractObject, contractParams).transactionHash;
|
||||
this.deployedContracts[className] = transactionHash;
|
||||
|
||||
console.log("address is " + contractAddress);
|
||||
console.log("deployed " + className + " at " + contractAddress);
|
||||
console.log("deployed " + className + " with transaction hash " + transactionHash);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -77,7 +76,16 @@ Deploy.prototype.generate_abi_file = function() {
|
|||
var contract = this.contractDB[className];
|
||||
|
||||
var abi = JSON.stringify(contract.compiled.info.abiDefinition);
|
||||
var contractAddress = deployedContract;
|
||||
var transactionHash = deployedContract;
|
||||
|
||||
console.log('trying to obtain ' + className + ' address...');
|
||||
var receipt = null;
|
||||
while ((receipt = web3.eth.getTransactionReceipt(transactionHash)) === null) {
|
||||
sleep.sleep(1);
|
||||
}
|
||||
var contractAddress = receipt.contractAddress;
|
||||
console.log('address is ' + contractAddress);
|
||||
|
||||
result += "var " + className + "Abi = " + abi + ";";
|
||||
result += "var " + className + "Contract = web3.eth.contract(" + className + "Abi);";
|
||||
result += "var " + className + " = " + className + "Contract.at('" + contractAddress + "');";
|
||||
|
|
15
package.json
15
package.json
|
@ -25,17 +25,18 @@
|
|||
"grunt-contrib-uglify": "^0.9.1",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-open": "^0.2.3",
|
||||
"hashmerge": "^1.0.2",
|
||||
"jasmine": "^2.3.1",
|
||||
"matchdep": "^0.3.0",
|
||||
"methodmissing": "^0.0.3",
|
||||
"python": "^0.0.4",
|
||||
"read-yaml": "^1.0.0",
|
||||
"shelljs": "^0.5.0",
|
||||
"web3": "^0.5.0",
|
||||
"wrench": "^1.5.8",
|
||||
"hashmerge": "^1.0.2",
|
||||
"sleep": "^2.0.0",
|
||||
"sync-me": "^0.1.1",
|
||||
"python": "^0.0.4",
|
||||
"methodmissing": "^0.0.3",
|
||||
"jasmine": "^2.3.1",
|
||||
"toposort": "^0.2.10"
|
||||
"toposort": "^0.2.10",
|
||||
"web3": "^0.8.1",
|
||||
"wrench": "^1.5.8"
|
||||
},
|
||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||
"contributors": [],
|
||||
|
|
Loading…
Reference in New Issue