mirror of
https://github.com/status-im/snt-gas-relay.git
synced 2025-02-18 08:57:09 +00:00
Simplifying code
This commit is contained in:
parent
aa63705638
commit
c6b3c226c4
@ -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){
|
||||||
|
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user