Skip to content

Commit

Permalink
Fix rinkeby and mainnet publish (#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
macor161 authored Mar 27, 2020
1 parent 483664d commit 8ccf6e4
Showing 1 changed file with 23 additions and 46 deletions.
69 changes: 23 additions & 46 deletions packages/cli/src/commands/apm_cmds/util/runPublishTask.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import TaskList from 'listr'
import { apmPublishVersion } from '@aragon/toolkit'
//
import { task as execTask } from '../../../commands/dao_cmds/utils/execHandler'
import listrOpts from '../../../helpers/listr-options'

export default async function runPublishTask({
reporter,

// Globals
gasPrice,
web3,
wsProvider,
module,
network,
http,
provider,
apm: apmOptions,
Expand All @@ -27,10 +22,6 @@ export default async function runPublishTask({
version,
pathToPublish,
contractAddress,
dao,
proxyAddress,
methodName,
params,
}) {
const appName = module.appName
return new TaskList(
Expand All @@ -39,43 +30,29 @@ export default async function runPublishTask({
title: `Publish ${appName}`,
enabled: () => !onlyArtifacts,
task: async (ctx, task) => {
if ((network.name === 'rpc') | (network.name === 'development')) {
ctx.contractInstance = null // clean up deploy sub-command artifacts

task.output = 'Generating transaction and waiting for confirmation'
const accounts = await web3.eth.getAccounts()
const from = accounts[0]

const transaction = await apmPublishVersion(
web3,
from,
appName,
version,
http ? 'http' : provider,
http || pathToPublish,
contractAddress,
from,
apmOptions
)

transaction.from = from
transaction.gasPrice = gasPrice
// apm.js already calculates the recommended gas

ctx.receipt = await web3.eth.sendTransaction(transaction)
} else {
return execTask({
dao,
app: proxyAddress,
method: methodName,
params,
reporter,
gasPrice,
apm: apmOptions,
web3,
wsProvider,
})
}
ctx.contractInstance = null // clean up deploy sub-command artifacts

task.output = 'Generating transaction and waiting for confirmation'
const accounts = await web3.eth.getAccounts()
const from = accounts[0]

const transaction = await apmPublishVersion(
web3,
from,
appName,
version,
http ? 'http' : provider,
http || pathToPublish,
contractAddress,
from,
apmOptions
)

transaction.from = from
transaction.gasPrice = gasPrice
// apm.js already calculates the recommended gas

ctx.receipt = await web3.eth.sendTransaction(transaction)
},
},
],
Expand Down

0 comments on commit 8ccf6e4

Please sign in to comment.