commit
2eaa5fc0a4
|
@ -1,8 +1,8 @@
|
|||
development:
|
||||
rpc_host: localhost
|
||||
rpc_port: 8101
|
||||
rpc_whitelist: "*"
|
||||
mine: false
|
||||
rpc_whitelist: localhost
|
||||
minerthreads: 1
|
||||
genesis_block: config/genesis/dev_genesis.json
|
||||
datadir: /tmp/embark
|
||||
|
@ -18,7 +18,7 @@ development:
|
|||
staging:
|
||||
rpc_host: localhost
|
||||
rpc_port: 8101
|
||||
rpc_whitelist: "*"
|
||||
rpc_whitelist: localhost
|
||||
datadir: default
|
||||
mine: false
|
||||
network_id: 0
|
||||
|
@ -34,7 +34,7 @@ staging:
|
|||
production:
|
||||
rpc_host: localhost
|
||||
rpc_port: 8101
|
||||
rpc_whitelist: "*"
|
||||
rpc_whitelist: localhost
|
||||
datadir: default
|
||||
network_id: 1
|
||||
mine: false
|
||||
|
|
|
@ -25,7 +25,7 @@ Blockchain.prototype.generate_basic_command = function() {
|
|||
cmd += "--rpcport " + config.rpcPort + " ";
|
||||
cmd += "--rpcaddr " + config.rpcHost + " ";
|
||||
cmd += "--networkid " + config.networkId + " ";
|
||||
cmd += "--rpccorsdomain \"" + config.rpcWhitelist + "\" ";
|
||||
cmd += "--rpccorsdomain " + config.rpcWhitelist + " ";
|
||||
|
||||
if(config.testnet){
|
||||
cmd += "--testnet "
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -89,7 +90,9 @@ Compiler.prototype.compile = function(contractFiles) {
|
|||
var solidity = [], serpent = [];
|
||||
|
||||
for (var i = 0; i < contractFiles.length; i++) {
|
||||
var extension = contractFiles[i].split('.')[1];
|
||||
var contractParts = contractFiles[i].split('.'),
|
||||
extension = contractParts[contractParts.length-1]
|
||||
|
||||
if (extension === 'sol') {
|
||||
solidity.push(contractFiles[i]);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ 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,
|
||||
deploy_synchronously: config.deploy_synchronously || false
|
||||
}
|
||||
|
||||
return config;
|
||||
|
|
|
@ -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) {
|
||||
|
@ -36,8 +37,8 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams, cb)
|
|||
cb(contract.address);
|
||||
}
|
||||
else {
|
||||
//console.log(arguments);
|
||||
//console.log("error deploying");
|
||||
console.log("error deploying");
|
||||
console.log(e)
|
||||
//exit();
|
||||
}
|
||||
};
|
||||
|
@ -53,6 +54,9 @@ Deploy.prototype.deploy_contracts = function(env, cb) {
|
|||
this.contractDB = this.contractsManager.contractDB;
|
||||
this.deployedContracts = {};
|
||||
|
||||
if(this.blockchainConfig.deploy_synchronously)
|
||||
this.deploy_contract_list_synchronously(env, all_contracts, cb);
|
||||
else
|
||||
this.deploy_contract_list(all_contracts.length, env, all_contracts, cb);
|
||||
}
|
||||
|
||||
|
@ -69,6 +73,25 @@ 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
|
||||
,deployed_contracts_count = 0
|
||||
|
||||
all_contracts.forEach(function(className){
|
||||
_this.deploy_a_contract(env, className, function(){
|
||||
mark_contract_as_deployed()
|
||||
});
|
||||
})
|
||||
|
||||
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];
|
||||
|
@ -175,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];
|
||||
|
@ -188,6 +213,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;
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"solc": "^0.1.6",
|
||||
"toposort": "^0.2.10",
|
||||
"web3": "^0.15.0",
|
||||
"bignumber.js": "debris/bignumber.js#master",
|
||||
"wrench": "^1.5.8",
|
||||
"ethersim": "^0.1.1"
|
||||
},
|
||||
|
|
|
@ -74,6 +74,7 @@ describe('embark.config.blockchain', function() {
|
|||
datadir: '/tmp/embark',
|
||||
chains: 'chains_development.json',
|
||||
deployTimeout: 45,
|
||||
deploy_synchronously: false,
|
||||
networkId: 0,
|
||||
maxPeers: 4,
|
||||
mine: false,
|
||||
|
@ -125,6 +126,7 @@ describe('embark.config.blockchain', function() {
|
|||
datadir: '/tmp/embark',
|
||||
chains: undefined,
|
||||
deployTimeout: 20,
|
||||
deploy_synchronously: false,
|
||||
networkId: 0,
|
||||
maxPeers: 4,
|
||||
mine: false,
|
||||
|
|
Loading…
Reference in New Issue