Skip to content

Commit

Permalink
release 0.1.1-rc.23-v4
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-kaufman committed Jun 21, 2020
1 parent 3956227 commit e5286ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion migrate-dao.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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.')
}
}
Expand Down
23 changes: 13 additions & 10 deletions migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e5286ba

Please sign in to comment.