Simplifying code

This commit is contained in:
Richard Ramos 2018-08-23 15:58:09 -04:00
parent aa63705638
commit c6b3c226c4
2 changed files with 6 additions and 8 deletions

View File

@ -54,21 +54,21 @@ class ContractSettings {
return this.web3.utils.toHex(contractName).slice(0, 10); return this.web3.utils.toHex(contractName).slice(0, 10);
} }
_obtainContractBytecode(topicName){ async _obtainContractBytecode(topicName){
if(this.contracts[topicName].isIdentity) return; if(this.contracts[topicName].isIdentity) return;
this.pendingToLoad++; this.pendingToLoad++;
this.web3.eth.getCode(this.contracts[topicName].address)
.then(code => { try {
const code = await this.web3.eth.getCode(this.contracts[topicName].address)
this.contracts[topicName].code = this.web3.utils.soliditySha3(code); this.contracts[topicName].code = this.web3.utils.soliditySha3(code);
this.pendingToLoad--; this.pendingToLoad--;
if(this.pendingToLoad == 0) this.events.emit("setup:complete", this); if(this.pendingToLoad == 0) this.events.emit("setup:complete", this);
}) } catch(err) {
.catch((err) => {
console.error("Invalid contract for " + topicName); console.error("Invalid contract for " + topicName);
console.error(err); console.error(err);
process.exit(); process.exit();
}); }
} }
_extractFunctions(topicName){ _extractFunctions(topicName){

View File

@ -29,8 +29,6 @@ class BaseStrategy {
} }
async _estimateGas(input){ async _estimateGas(input){
console.dir(input);
let p = { let p = {
from: this.config.node.blockchain.account, from: this.config.node.blockchain.account,
to: input.contract, to: input.contract,