mirror of https://github.com/embarklabs/embark.git
compiling correctly and moved wall of code
is_a_token I think is no longer necessary methinks...because now you can just draw up your coin as is. At the very least the function needs to be rewritten. In addition I moved the wall of code that you had a TODO to move on...and I put it in its own separate function configureContractsParameters. Let me know what we should do with is_a_token.
This commit is contained in:
parent
b7c03ac06b
commit
f864bb6098
|
@ -41,8 +41,12 @@ ContractsConfig.prototype.config = function(env) {
|
|||
};
|
||||
|
||||
ContractsConfig.prototype.is_a_token = function(target, compiled_contracts) {
|
||||
for (var className in compiled_contracts) {
|
||||
for (var className in compiled_contracts) { //This needs some serious changing
|
||||
|
||||
if (this.contractStubs[className] && this.contractStubs[className].indexOf(target) >= 0) {
|
||||
console.log("hit the condition")
|
||||
console.log(this.contractStubs[className]);
|
||||
console.log(this.contractStubs[className].indexOf(target));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -75,29 +79,30 @@ ContractsConfig.prototype.compileContracts = function(env) {
|
|||
}
|
||||
}
|
||||
|
||||
var all_compiled_contracts = {};
|
||||
// compile files
|
||||
compiled_contracts = this.compiler.compile(this.contractFiles);
|
||||
|
||||
|
||||
compiled_contracts = this.compiler.compile(this.contractFiles); //compile and push to contract DB
|
||||
|
||||
for (var className in compiled_contracts) {
|
||||
var contract = compiled_contracts[className];
|
||||
|
||||
if (this.is_a_token(className, compiled_contracts)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
all_compiled_contracts[className] = contract;
|
||||
this.all_contracts.push(className);
|
||||
this.contractDB[className] = {
|
||||
args: [],
|
||||
types: ['file'],
|
||||
gasPrice: this.blockchainConfig.gasPrice,
|
||||
gasLimit: this.blockchainConfig.gasLimit,
|
||||
compiled: contract
|
||||
compiled: compiled_contracts[className]
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: move this
|
||||
this.configureContractsParameters(contractsConfig);
|
||||
this.sortContracts();
|
||||
};
|
||||
|
||||
ContractsConfig.prototype.configureContractsParameters = function(contractsConfig) {
|
||||
for(className in contractsConfig) {
|
||||
var contractConfig = contractsConfig[className];
|
||||
|
||||
|
@ -123,7 +128,7 @@ ContractsConfig.prototype.compileContracts = function(env) {
|
|||
if (contractConfig.instanceOf !== undefined) {
|
||||
contract.types.push('instance');
|
||||
contract.instanceOf = contractConfig.instanceOf;
|
||||
contract.compiled = all_compiled_contracts[contractConfig.instanceOf];
|
||||
contract.compiled = compiled_contracts[contractConfig.instanceOf];
|
||||
}
|
||||
if (contractConfig.address !== undefined) {
|
||||
contract.types.push('static');
|
||||
|
@ -139,8 +144,7 @@ ContractsConfig.prototype.compileContracts = function(env) {
|
|||
}
|
||||
}
|
||||
|
||||
this.sortContracts();
|
||||
};
|
||||
}
|
||||
|
||||
ContractsConfig.prototype.sortContracts = function() {
|
||||
var converted_dependencies = [], i;
|
||||
|
@ -162,4 +166,3 @@ ContractsConfig.prototype.sortContracts = function() {
|
|||
};
|
||||
|
||||
module.exports = ContractsConfig;
|
||||
|
||||
|
|
Loading…
Reference in New Issue