From 83520affa3c84b5f50f4fabd1966fd2802e85caa Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Wed, 14 Oct 2015 10:54:07 -0400 Subject: [PATCH 1/7] add contractdb --- lib/deploy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/deploy.js b/lib/deploy.js index 03f169e05..c903222a4 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -188,6 +188,7 @@ Deploy.prototype.generate_abi_file = function() { result += className + "Contract = web3.eth.contract(" + className + "Abi);"; result += className + " = " + className + "Contract.at('" + contractAddress + "');"; } + result += 'contractDB = '+JSON.stringify(this.contractDB)+';' return result; }; From 171fefbda12df5bf313bae1dbd5851c366a38324 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Fri, 16 Oct 2015 13:07:28 -0400 Subject: [PATCH 2/7] expose runtimeBytecode --- lib/compiler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compiler.js b/lib/compiler.js index 6c2866df9..d843a5a49 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -36,6 +36,7 @@ Compiler.prototype.compile_solidity = function(contractFiles) { compiled_object[className] = {}; compiled_object[className].code = contract.bytecode; + compiled_object[className].runtimeBytecode = contract.runtimeBytecode; compiled_object[className].info = {}; compiled_object[className].info.abiDefinition = JSON.parse(contract.interface); } From bd76193ac8052d55f829451ea81a01329dc5cff9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 21 Oct 2015 17:26:57 -0400 Subject: [PATCH 3/7] add bignumber to dependencies so BigNumber can be used in onDeploy --- lib/deploy.js | 1 + package.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index c903222a4..11ee3a9e1 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -3,6 +3,7 @@ var fs = require('fs'); var grunt = require('grunt'); var readYaml = require('read-yaml'); var Config = require('./config/config.js'); +var BigNumber = require('bignumber.js'); Deploy = function(env, contractFiles, blockchainConfig, contractsConfig, chainManager, withProvider, withChain, _web3) { if (_web3 !== undefined) { diff --git a/package.json b/package.json index 5817c1b63..9da36b7c2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "shelljs": "^0.5.0", "solc": "^0.1.6", "toposort": "^0.2.10", - "web3": "^0.15.0", + "web3": "^0.8.1", + "bignumber.js": "debris/bignumber.js#master", "wrench": "^1.5.8", "ethersim": "^0.1.1" }, From 7dac3c083218b03e7d721882eb9e3484a4207ab0 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Fri, 20 Nov 2015 13:02:18 -0500 Subject: [PATCH 4/7] deploy_synchronously --- lib/config/blockchain.js | 4 +++- lib/deploy.js | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index d2110ed2f..30514f334 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -54,7 +54,9 @@ BlockchainConfig.prototype.config = function(env) { whisper: config.whisper || false, account: config.account, geth_extra_opts: config.geth_extra_opts || [], - testnet: config.testnet || false + testnet: config.testnet || false, + geth_extra_opts: config.geth_extra_opts, + deploy_synchronously: config.deploy_synchronously || false } return config; diff --git a/lib/deploy.js b/lib/deploy.js index 11ee3a9e1..d5d2db29a 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -54,7 +54,10 @@ Deploy.prototype.deploy_contracts = function(env, cb) { this.contractDB = this.contractsManager.contractDB; this.deployedContracts = {}; - this.deploy_contract_list(all_contracts.length, env, all_contracts, cb); + if(this.blockchainConfig.deploy_synchronously) + this.deploy_contract_list_sync(env, all_contracts, cb); + else + this.deploy_contract_list(all_contracts.length, env, all_contracts, cb); } Deploy.prototype.deploy_contract_list = function(index, env, all_contracts, cb) { @@ -70,6 +73,26 @@ Deploy.prototype.deploy_contract_list = function(index, env, all_contracts, cb) } } +Deploy.prototype.deploy_contract_list_synchronously = function(env, all_contracts, cb) { + + var _this = this; + + all_contracts.forEach(function(className){ + _this.deploy_a_contract(env, className, function(){ + mark_contract_as_deployed() + }); + }) + + var deployed_contracts_count = 0; + + function mark_contract_as_deployed(){ + deployed_contracts_count ++; + + if(deployed_contracts_count === all_contracts.length) + cb() + } +} + Deploy.prototype.deploy_a_contract = function(env, className, cb) { var contractDependencies = this.contractsManager.contractDependencies; var contract = this.contractDB[className]; From 8ea13b4da5544afc1c467b3c8123f9be0726972f Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Fri, 20 Nov 2015 13:11:12 -0500 Subject: [PATCH 5/7] sync->synchronously --- lib/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index d5d2db29a..f8f2207c0 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -55,7 +55,7 @@ Deploy.prototype.deploy_contracts = function(env, cb) { this.deployedContracts = {}; if(this.blockchainConfig.deploy_synchronously) - this.deploy_contract_list_sync(env, all_contracts, cb); + this.deploy_contract_list_synchronously(env, all_contracts, cb); else this.deploy_contract_list(all_contracts.length, env, all_contracts, cb); } From 8af4282ed760e39f17f237ee5a863f2055ca9791 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Mon, 23 Nov 2015 12:49:51 -0500 Subject: [PATCH 6/7] deployed_contracts_count fix --- lib/deploy.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/deploy.js b/lib/deploy.js index f8f2207c0..4ed07210a 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -75,7 +75,8 @@ Deploy.prototype.deploy_contract_list = function(index, env, all_contracts, cb) Deploy.prototype.deploy_contract_list_synchronously = function(env, all_contracts, cb) { - var _this = this; + var _this = this + ,deployed_contracts_count = 0 all_contracts.forEach(function(className){ _this.deploy_a_contract(env, className, function(){ @@ -83,8 +84,6 @@ Deploy.prototype.deploy_contract_list_synchronously = function(env, all_contract }); }) - var deployed_contracts_count = 0; - function mark_contract_as_deployed(){ deployed_contracts_count ++; From 07ec9067667c3adbb8acdfc38c8f1ca1b55b58aa Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Wed, 2 Dec 2015 18:42:36 -0500 Subject: [PATCH 7/7] add blockchain config to abi --- lib/config/blockchain.js | 1 + lib/deploy.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 30514f334..46b14f7bb 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -33,6 +33,7 @@ BlockchainConfig.prototype.config = function(env) { config = { + env:env, rpcHost: config.rpc_host, rpcPort: config.rpc_port, gasLimit: config.gas_limit || 500000, diff --git a/lib/deploy.js b/lib/deploy.js index 4ed07210a..bad650392 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -198,6 +198,8 @@ Deploy.prototype.generate_provider_file = function() { Deploy.prototype.generate_abi_file = function() { var result = ""; + result += 'blockchain = '+JSON.stringify(this.blockchainConfig)+';'; + for(className in this.deployedContracts) { var deployedContract = this.deployedContracts[className]; var contract = this.contractDB[className];