Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions migrate-base.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, previousMigration }) {
async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, previousMigration, getArcVersionNumber }) {
if (!(await confirm('About to migrate base contracts. Continue?'))) {
return
}
Expand Down Expand Up @@ -98,7 +98,7 @@ async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, p
[],
web3.eth.accounts.wallet[0].address
)
if (Number(arcVersion.slice(-2)) >= 29) {
if (getArcVersionNumber(arcVersion) >= 29) {
DAOTracker = await deploy(require(`./contracts/${arcVersion}/DAOTracker.json`))
}
} else {
Expand All @@ -109,7 +109,7 @@ async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, p
[],
'0x85e7fa550b534656d04d143b9a23a11e05077da3' // DAOstack's controlled account
)
if (Number(arcVersion.slice(-2)) >= 29) {
if (getArcVersionNumber(arcVersion) >= 29) {
DAOTracker = await deploy(require(`./contracts/${arcVersion}/DAOTracker.json`))
const daoTracker = new web3.eth.Contract(
require(`./contracts/${arcVersion}/DAOTracker.json`).abi,
Expand All @@ -128,7 +128,7 @@ async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, p
[],
'0x73Db6408abbea97C5DB8A2234C4027C315094936'
)
if (Number(arcVersion.slice(-2)) >= 29) {
if (getArcVersionNumber(arcVersion) >= 29) {
DAOTracker = await deploy(require(`./contracts/${arcVersion}/DAOTracker.json`))
const daoTracker = new web3.eth.Contract(
require(`./contracts/${arcVersion}/DAOTracker.json`).abi,
Expand All @@ -146,7 +146,7 @@ async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, p

const ControllerCreator = await deploy(require(`./contracts/${arcVersion}/ControllerCreator.json`))

if (Number(arcVersion.slice(-2)) >= 29) {
if (getArcVersionNumber(arcVersion) >= 29) {
await deploy(
require(`./contracts/${arcVersion}/DaoCreator.json`),
['ControllerCreator', 'DAOTracker'],
Expand Down Expand Up @@ -177,10 +177,10 @@ async function migrateBase ({ arcVersion, web3, spinner, confirm, opts, logTx, p
await deploy(require(`./contracts/${arcVersion}/TokenCapGC.json`))
await deploy(require(`./contracts/${arcVersion}/VoteInOrganizationScheme.json`))
await deploy(require(`./contracts/${arcVersion}/OrganizationRegister.json`))
if (Number(arcVersion.slice(-2)) >= 22) {
if (getArcVersionNumber(arcVersion) >= 22) {
await deploy(require(`./contracts/${arcVersion}/Redeemer.json`))
}
if (Number(arcVersion.slice(-2)) >= 24) {
if (getArcVersionNumber(arcVersion) >= 24) {
await deploy(require(`./contracts/${arcVersion}/UGenericScheme.json`))
} else {
await deploy(require(`./contracts/${arcVersion}/GenericScheme.json`))
Expand Down
12 changes: 6 additions & 6 deletions migrate-dao.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const utils = require('./utils.js')
const sanitize = require('./sanitize')

async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migrationParams, logTx, previousMigration, customAbisLocation, restart, getState, setState, cleanState }) {
async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migrationParams, logTx, previousMigration, customAbisLocation, restart, getState, setState, cleanState, getArcVersionNumber }) {
const network = await web3.eth.net.getNetworkType()
if (restart) {
cleanState(network)
Expand Down Expand Up @@ -67,8 +67,8 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
)

const genericScheme = new web3.eth.Contract(
Number(arcVersion.slice(-2)) >= 24 ? require(`./contracts/${arcVersion}/UGenericScheme.json`).abi : require(`./contracts/${arcVersion}/GenericScheme.json`).abi,
Number(arcVersion.slice(-2)) >= 24 ? UGenericScheme : GenericScheme,
getArcVersionNumber(arcVersion) >= 24 ? require(`./contracts/${arcVersion}/UGenericScheme.json`).abi : require(`./contracts/${arcVersion}/GenericScheme.json`).abi,
getArcVersionNumber(arcVersion) >= 24 ? UGenericScheme : GenericScheme,
opts
)

Expand Down Expand Up @@ -328,14 +328,14 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
)
}

if (migrationParams.noTrack !== true && Number(arcVersion.slice(-2)) >= 29 && deploymentState.trackedDAO !== true) {
if (migrationParams.noTrack !== true && getArcVersionNumber(arcVersion) >= 29 && deploymentState.trackedDAO !== true) {
const daoTracker = new web3.eth.Contract(
require(`./contracts/${arcVersion}/DAOTracker.json`).abi,
DAOTracker,
opts
)
spinner.start('Registering DAO in DAOTracker')
tx = (Number(arcVersion.slice(-2)) >= 32
tx = (getArcVersionNumber(arcVersion) >= 32
? await daoTracker.methods.track(avatar.options.address, deploymentState.Controller, arcVersion)
: await daoTracker.methods.track(avatar.options.address, deploymentState.Controller))
.send({ nonce: ++nonce })
Expand Down Expand Up @@ -568,7 +568,7 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
}

deploymentState.schemeNames.push('Generic Scheme')
deploymentState.schemes.push(Number(arcVersion.slice(-2)) >= 24 ? UGenericScheme : GenericScheme)
deploymentState.schemes.push(getArcVersionNumber(arcVersion) >= 24 ? UGenericScheme : GenericScheme)
deploymentState.params.push(genericSchemeParams)
deploymentState.permissions.push('0x00000010')
setState(deploymentState, network)
Expand Down
3 changes: 3 additions & 0 deletions migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ const wrapCommand = fn => async options => {
console.error(err)
}
}
},
getArcVersionNumber: function getArcVersionNumber (arcVersion) {
return Number(arcVersion.slice(-2))
}
})

Expand Down