commit
2eaa5fc0a4
|
@ -1,8 +1,8 @@
|
||||||
development:
|
development:
|
||||||
rpc_host: localhost
|
rpc_host: localhost
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
|
||||||
mine: false
|
mine: false
|
||||||
|
rpc_whitelist: localhost
|
||||||
minerthreads: 1
|
minerthreads: 1
|
||||||
genesis_block: config/genesis/dev_genesis.json
|
genesis_block: config/genesis/dev_genesis.json
|
||||||
datadir: /tmp/embark
|
datadir: /tmp/embark
|
||||||
|
@ -18,7 +18,7 @@ development:
|
||||||
staging:
|
staging:
|
||||||
rpc_host: localhost
|
rpc_host: localhost
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
rpc_whitelist: localhost
|
||||||
datadir: default
|
datadir: default
|
||||||
mine: false
|
mine: false
|
||||||
network_id: 0
|
network_id: 0
|
||||||
|
@ -34,7 +34,7 @@ staging:
|
||||||
production:
|
production:
|
||||||
rpc_host: localhost
|
rpc_host: localhost
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
rpc_whitelist: localhost
|
||||||
datadir: default
|
datadir: default
|
||||||
network_id: 1
|
network_id: 1
|
||||||
mine: false
|
mine: false
|
||||||
|
|
|
@ -25,7 +25,7 @@ Blockchain.prototype.generate_basic_command = function() {
|
||||||
cmd += "--rpcport " + config.rpcPort + " ";
|
cmd += "--rpcport " + config.rpcPort + " ";
|
||||||
cmd += "--rpcaddr " + config.rpcHost + " ";
|
cmd += "--rpcaddr " + config.rpcHost + " ";
|
||||||
cmd += "--networkid " + config.networkId + " ";
|
cmd += "--networkid " + config.networkId + " ";
|
||||||
cmd += "--rpccorsdomain \"" + config.rpcWhitelist + "\" ";
|
cmd += "--rpccorsdomain " + config.rpcWhitelist + " ";
|
||||||
|
|
||||||
if(config.testnet){
|
if(config.testnet){
|
||||||
cmd += "--testnet "
|
cmd += "--testnet "
|
||||||
|
|
|
@ -36,6 +36,7 @@ Compiler.prototype.compile_solidity = function(contractFiles) {
|
||||||
|
|
||||||
compiled_object[className] = {};
|
compiled_object[className] = {};
|
||||||
compiled_object[className].code = contract.bytecode;
|
compiled_object[className].code = contract.bytecode;
|
||||||
|
compiled_object[className].runtimeBytecode = contract.runtimeBytecode;
|
||||||
compiled_object[className].info = {};
|
compiled_object[className].info = {};
|
||||||
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
|
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,9 @@ Compiler.prototype.compile = function(contractFiles) {
|
||||||
var solidity = [], serpent = [];
|
var solidity = [], serpent = [];
|
||||||
|
|
||||||
for (var i = 0; i < contractFiles.length; i++) {
|
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') {
|
if (extension === 'sol') {
|
||||||
solidity.push(contractFiles[i]);
|
solidity.push(contractFiles[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ BlockchainConfig.prototype.config = function(env) {
|
||||||
whisper: config.whisper || false,
|
whisper: config.whisper || false,
|
||||||
account: config.account,
|
account: config.account,
|
||||||
geth_extra_opts: config.geth_extra_opts || [],
|
geth_extra_opts: config.geth_extra_opts || [],
|
||||||
testnet: config.testnet || false
|
testnet: config.testnet || false,
|
||||||
|
deploy_synchronously: config.deploy_synchronously || false
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -3,6 +3,7 @@ var fs = require('fs');
|
||||||
var grunt = require('grunt');
|
var grunt = require('grunt');
|
||||||
var readYaml = require('read-yaml');
|
var readYaml = require('read-yaml');
|
||||||
var Config = require('./config/config.js');
|
var Config = require('./config/config.js');
|
||||||
|
var BigNumber = require('bignumber.js');
|
||||||
|
|
||||||
Deploy = function(env, contractFiles, blockchainConfig, contractsConfig, chainManager, withProvider, withChain, _web3) {
|
Deploy = function(env, contractFiles, blockchainConfig, contractsConfig, chainManager, withProvider, withChain, _web3) {
|
||||||
if (_web3 !== undefined) {
|
if (_web3 !== undefined) {
|
||||||
|
@ -36,8 +37,8 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams, cb)
|
||||||
cb(contract.address);
|
cb(contract.address);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//console.log(arguments);
|
console.log("error deploying");
|
||||||
//console.log("error deploying");
|
console.log(e)
|
||||||
//exit();
|
//exit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -53,6 +54,9 @@ Deploy.prototype.deploy_contracts = function(env, cb) {
|
||||||
this.contractDB = this.contractsManager.contractDB;
|
this.contractDB = this.contractsManager.contractDB;
|
||||||
this.deployedContracts = {};
|
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);
|
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) {
|
Deploy.prototype.deploy_a_contract = function(env, className, cb) {
|
||||||
var contractDependencies = this.contractsManager.contractDependencies;
|
var contractDependencies = this.contractsManager.contractDependencies;
|
||||||
var contract = this.contractDB[className];
|
var contract = this.contractDB[className];
|
||||||
|
@ -175,6 +198,8 @@ Deploy.prototype.generate_provider_file = function() {
|
||||||
Deploy.prototype.generate_abi_file = function() {
|
Deploy.prototype.generate_abi_file = function() {
|
||||||
var result = "";
|
var result = "";
|
||||||
|
|
||||||
|
result += 'blockchain = '+JSON.stringify(this.blockchainConfig)+';';
|
||||||
|
|
||||||
for(className in this.deployedContracts) {
|
for(className in this.deployedContracts) {
|
||||||
var deployedContract = this.deployedContracts[className];
|
var deployedContract = this.deployedContracts[className];
|
||||||
var contract = this.contractDB[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 + "Contract = web3.eth.contract(" + className + "Abi);";
|
||||||
result += className + " = " + className + "Contract.at('" + contractAddress + "');";
|
result += className + " = " + className + "Contract.at('" + contractAddress + "');";
|
||||||
}
|
}
|
||||||
|
result += 'contractDB = '+JSON.stringify(this.contractDB)+';'
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
"solc": "^0.1.6",
|
"solc": "^0.1.6",
|
||||||
"toposort": "^0.2.10",
|
"toposort": "^0.2.10",
|
||||||
"web3": "^0.15.0",
|
"web3": "^0.15.0",
|
||||||
|
"bignumber.js": "debris/bignumber.js#master",
|
||||||
"wrench": "^1.5.8",
|
"wrench": "^1.5.8",
|
||||||
"ethersim": "^0.1.1"
|
"ethersim": "^0.1.1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -74,6 +74,7 @@ describe('embark.config.blockchain', function() {
|
||||||
datadir: '/tmp/embark',
|
datadir: '/tmp/embark',
|
||||||
chains: 'chains_development.json',
|
chains: 'chains_development.json',
|
||||||
deployTimeout: 45,
|
deployTimeout: 45,
|
||||||
|
deploy_synchronously: false,
|
||||||
networkId: 0,
|
networkId: 0,
|
||||||
maxPeers: 4,
|
maxPeers: 4,
|
||||||
mine: false,
|
mine: false,
|
||||||
|
@ -125,6 +126,7 @@ describe('embark.config.blockchain', function() {
|
||||||
datadir: '/tmp/embark',
|
datadir: '/tmp/embark',
|
||||||
chains: undefined,
|
chains: undefined,
|
||||||
deployTimeout: 20,
|
deployTimeout: 20,
|
||||||
|
deploy_synchronously: false,
|
||||||
networkId: 0,
|
networkId: 0,
|
||||||
maxPeers: 4,
|
maxPeers: 4,
|
||||||
mine: false,
|
mine: false,
|
||||||
|
|
Loading…
Reference in New Issue