Refactoring
This commit is contained in:
parent
e317d924ba
commit
1f4e3dc8d5
|
@ -91,13 +91,13 @@ function attachToContract(web3, abi, addr) {
|
|||
return contractInstance;
|
||||
}
|
||||
function checkInitialKey(web3, initialKey, contractAddr, abi, cb) {
|
||||
let oraclesContract = attachToContract(web3, abi, contractAddr)
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!oraclesContract) {
|
||||
if (!KeysStorage) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
oraclesContract.methods.checkInitialKey(initialKey).call(function(isNew) {
|
||||
KeysStorage.methods.checkInitialKey(initialKey).call(function(isNew) {
|
||||
cb(isNew);
|
||||
})
|
||||
}
|
||||
|
@ -218,9 +218,9 @@ function bytesCount(s) {
|
|||
}
|
||||
function createKeys(web3, keys, contractAddr, abi, cb) {
|
||||
console.log("***Create keys function***");
|
||||
let oraclesContract = attachToContract(web3, abi, contractAddr)
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!oraclesContract) {
|
||||
if (!KeysStorage) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ function createKeys(web3, keys, contractAddr, abi, cb) {
|
|||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
var opts = {from: web3.eth.defaultAccount, gasPrice: gasPrice}
|
||||
|
||||
oraclesContract.methods.createKeys("0x" + keys.miningKey.miningKeyObject.address,
|
||||
KeysStorage.methods.createKeys("0x" + keys.miningKey.miningKeyObject.address,
|
||||
"0x" + keys.payoutKey.payoutKeyObject.address,
|
||||
"0x" + keys.votingKey.votingKeyObject.address
|
||||
).send(opts).on('error', error => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function checkInitialKey(web3, initialKey, contractAddr, abi, cb) {
|
||||
let oraclesContract = attachToContract(web3, abi, contractAddr)
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!oraclesContract) {
|
||||
if (!KeysStorage) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
oraclesContract.methods.checkInitialKey(initialKey).call(function(isNew) {
|
||||
KeysStorage.methods.checkInitialKey(initialKey).call(function(isNew) {
|
||||
cb(isNew);
|
||||
})
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
function createKeys(web3, keys, contractAddr, abi, cb) {
|
||||
console.log("***Create keys function***");
|
||||
let oraclesContract = attachToContract(web3, abi, contractAddr)
|
||||
let KeysStorage = attachToContract(web3, abi, contractAddr)
|
||||
console.log("attach to oracles contract");
|
||||
if (!oraclesContract) {
|
||||
if (!KeysStorage) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ function createKeys(web3, keys, contractAddr, abi, cb) {
|
|||
var gasPrice = web3.utils.toWei(new web3.utils.BN(1), 'gwei')
|
||||
var opts = {from: web3.eth.defaultAccount, gasPrice: gasPrice}
|
||||
|
||||
oraclesContract.methods.createKeys("0x" + keys.miningKey.miningKeyObject.address,
|
||||
KeysStorage.methods.createKeys("0x" + keys.miningKey.miningKeyObject.address,
|
||||
"0x" + keys.payoutKey.payoutKeyObject.address,
|
||||
"0x" + keys.votingKey.votingKeyObject.address
|
||||
).send(opts).on('error', error => {
|
||||
|
|
Loading…
Reference in New Issue