From e5286ba405bef7550e6ca1c763af12b91431aa1c Mon Sep 17 00:00:00 2001 From: benk10 Date: Sun, 21 Jun 2020 09:31:54 +0300 Subject: [PATCH] release 0.1.1-rc.23-v4 --- migrate-dao.js | 3 ++- migrate.js | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/migrate-dao.js b/migrate-dao.js index 51ddb5ed..3d600a03 100644 --- a/migrate-dao.js +++ b/migrate-dao.js @@ -15,6 +15,7 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration } else if (await web3.eth.net.getId() === 77) { network = 'sokol' } else { + web3.eth.accounts.wallet.add(web3.eth.accounts.privateKeyToAccount('0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1')) adminAddress = web3.eth.accounts.wallet[1].address } } @@ -366,7 +367,7 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration deploymentState.StandAloneContracts[i].address, opts ) - tx = (await sendTx(standaloneContractProxy.methods.changeAdmin(deploymentState.Avatar), 'Transferring Standalone Proxy Ownership...')).receipt + tx = (await sendTx(standaloneContractProxy.methods.changeAdmin(deploymentState.Avatar), 'Transferring Standalone Proxy Ownership...', adminAddress, 100000)).receipt await logTx(tx, 'Transferred Standalone Proxy Ownership.') } } diff --git a/migrate.js b/migrate.js index bb8f2e65..eb0abe93 100755 --- a/migrate.js +++ b/migrate.js @@ -181,23 +181,26 @@ const wrapCommand = fn => async options => { getArcVersionNumber: function getArcVersionNumber (arcVersion) { return Number(arcVersion.split('rc.')[1]) }, - sendTx: async function sendTx (tx, msg, from = web3.eth.defaultAccount) { + sendTx: async function sendTx (tx, msg, from = web3.eth.defaultAccount, manualGas = -1) { spinner.start(msg) let gas = 0 let nonce = await web3.eth.getTransactionCount(from) const blockLimit = (await web3.eth.getBlock('latest')).gasLimit - try { - gas = (await tx.estimateGas()) - if (gas * 1.1 < blockLimit - 10000) { - gas *= 1.1 - gas = parseInt(gas) - } else { + if (manualGas === -1) { + try { + gas = (await tx.estimateGas()) + if (gas * 1.1 < blockLimit - 10000) { + gas *= 1.1 + gas = parseInt(gas) + } else { + gas = blockLimit - 10000 + } + } catch (error) { gas = blockLimit - 10000 } - } catch (error) { - gas = blockLimit - 10000 + } else { + gas = manualGas } - let result = tx.send({ from, gas, nonce }) let receipt = await new Promise(resolve => result.on('receipt', resolve).on('error', async error => { spinner.fail('Transaction failed: ' + error)