mirror of https://github.com/embarklabs/embark.git
fix on deploy
This commit is contained in:
parent
7e4429b342
commit
d005d3f668
|
@ -194,6 +194,14 @@ class CodeGenerator {
|
|||
return result;
|
||||
}
|
||||
|
||||
generateContractCode(contract) {
|
||||
let abi = JSON.stringify(contract.abiDefinition);
|
||||
|
||||
let block = "";
|
||||
block += Templates.vanilla_contract({className: contract.className, abi: abi, contract: contract});
|
||||
return block;
|
||||
}
|
||||
|
||||
generateStorageInitialization(useEmbarkJS) {
|
||||
let self = this;
|
||||
let result = "\n";
|
||||
|
|
|
@ -77,16 +77,11 @@ class Deploy {
|
|||
if (contract.onDeploy !== undefined) {
|
||||
self.logger.info('executing onDeploy commands');
|
||||
let codeGenerator = new CodeGenerator({contractsManager: self.contractsManager});
|
||||
let context = codeGenerator.generateContext();
|
||||
let code = codeGenerator.generateContracts(false, true, true);
|
||||
let cmds = contract.onDeploy.join(';\n');
|
||||
|
||||
let _cmds = "";
|
||||
_cmds += "__mainContext.__loadManagerInstance.execWhenReady(function() {";
|
||||
_cmds += cmds;
|
||||
_cmds += "});";
|
||||
|
||||
RunCode.doEval(context + "\n" + code + "\n" + _cmds, self.web3);
|
||||
let cmds = "";
|
||||
cmds += codeGenerator.generateContractCode(contract);
|
||||
cmds += contract.onDeploy.join(';\n');
|
||||
RunCode.doEval(cmds, self.web3);
|
||||
}
|
||||
|
||||
callback();
|
||||
|
|
|
@ -7,9 +7,11 @@ import 'bootstrap/dist/css/bootstrap.min.css';
|
|||
//import 'bootstrap/dist/js/bootstrap.min.js';
|
||||
import EmbarkJS from 'Embark/EmbarkJS';
|
||||
import SimpleStorage from 'Embark/contracts/SimpleStorage';
|
||||
import Test from 'Embark/contracts/Test';
|
||||
|
||||
window.EmbarkJS = EmbarkJS;
|
||||
window.SimpleStorage = SimpleStorage;
|
||||
window.Test = Test;
|
||||
|
||||
import './foo.css';
|
||||
|
||||
|
|
Loading…
Reference in New Issue