Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Refactor aragen #105

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
24 changes: 13 additions & 11 deletions scripts/deploy/apm.js → scripts/bases/deploy-apm.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const logDeploy = require('@aragon/os/scripts/helpers/deploy-logger')
const getAccounts = require('@aragon/os/scripts/helpers/get-accounts')
const namehash = require('eth-ens-namehash').hash
const keccak256 = require('js-sha3').keccak_256

const deployENS = require('./test-ens')
const deployDaoFactory = require('./daofactory')
const logDeploy = require('@aragon/os/scripts/helpers/deploy-logger')
const getAccounts = require('@aragon/os/scripts/helpers/get-accounts')
const deployENS = require('./deploy-test-ens')
const deployDaoFactory = require('./deploy-daofactory')

const globalArtifacts = this.artifacts // Not injected unless called directly via truffle
const globalWeb3 = this.web3 // Not injected unless called directly via truffle
Expand Down Expand Up @@ -95,11 +95,13 @@ module.exports = async (
)
} else {
log('Deploying DAOFactory with EVMScripts...')
daoFactory = (await deployDaoFactory(null, {
artifacts,
withEvmScriptRegistryFactory: true,
verbose: false,
})).daoFactory
daoFactory = (
await deployDaoFactory(null, {
artifacts,
withEvmScriptRegistryFactory: true,
verbose: false,
})
).daoFactory
}

log('Deploying APMRegistryFactory...')
Expand All @@ -115,7 +117,7 @@ module.exports = async (

log(`Assigning ENS name (${labelName}.${tldName}) to factory...`)

if ((await ens.owner(apmNode)) === owner) {
if ((await ens.owner(apmNode)) === accounts[0]) {
log('Transferring name ownership from deployer to APMRegistryFactory')
await ens.setOwner(apmNode, apmFactory.address)
} else {
Expand All @@ -135,7 +137,7 @@ module.exports = async (
const receipt = await apmFactory.newAPM(tldHash, labelHash, owner)

log('=========')
const apmAddr = receipt.logs.filter(l => l.event == 'DeployAPM')[0].args.apm
const apmAddr = receipt.logs.filter((l) => l.event == 'DeployAPM')[0].args.apm
log('# APM:')
log('Address:', apmAddr)
log('Transaction hash:', receipt.tx)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const ZERO_ADDR = '0x0000000000000000000000000000000000000000'

const defaultKernelBase = process.env.KERNEL_BASE
const defaultAclBaseAddress = process.env.ACL_BASE
const defaultEvmScriptRegistryFactoryAddress = process.env.EVM_REG_FACTORY

module.exports = async (
truffleExecCallback,
{
artifacts = globalArtifacts,
kernelBaseAddress = defaultKernelBase,
aclBaseAddress = defaultAclBaseAddress,
evmScriptRegistryFactoryAddress = defaultEvmScriptRegistryFactoryAddress,
withEvmScriptRegistryFactory = true,
verbose = true,
} = {}
Expand Down Expand Up @@ -55,8 +57,18 @@ module.exports = async (
const EVMScriptRegistryFactory = artifacts.require(
'EVMScriptRegistryFactory'
)
evmScriptRegistryFactory = await EVMScriptRegistryFactory.new()
await logDeploy(evmScriptRegistryFactory, { verbose })

if (evmScriptRegistryFactoryAddress) {
evmScriptRegistryFactory = EVMScriptRegistryFactory.at(
evmScriptRegistryFactoryAddress
)
log(
`Skipping deploying new EVMScriptRegistryFactory, using provided address: ${evmScriptRegistryFactoryAddress}`
)
} else {
evmScriptRegistryFactory = await EVMScriptRegistryFactory.new()
await logDeploy(evmScriptRegistryFactory, { verbose })
}
}
const daoFactory = await DAOFactory.new(
kernelBase.address,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = async (
await logDeploy(factory, { verbose })
const receipt = await factory.newENS(owner)

const ensAddr = receipt.logs.filter(l => l.event == 'DeployENS')[0].args.ens
const ensAddr = receipt.logs.filter((l) => l.event == 'DeployENS')[0].args.ens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce the diff, create a .prettierrc which sets the parameters in order to prevent unnecessary changes. In this case, arrowParens: "avoid"

https://prettier.io/docs/en/options.html#arrow-function-parentheses

log('====================')
log('Deployed ENS:', ensAddr)

Expand Down
10 changes: 5 additions & 5 deletions scripts/deploy-base
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sleep 2; # let the people read

echo "Deploying ENS instance"
npx truffle compile;
DEPLOYED_ENS=$(npx truffle exec --network rpc scripts/deploy/test-ens.js | tail -n 1)
DEPLOYED_ENS=$(npx truffle exec --network rpc scripts/bases/deploy-test-ens.js | tail -n 1)
if [ "${ENS}" = "${DEPLOYED_ENS}" ]; then
echo "ENS deployed $DEPLOYED_ENS"
else
Expand All @@ -18,11 +18,11 @@ else
exit 1;
fi

echo "Deploying APM registry to aragonpm.eth and open.aragonpm.eth and hatch.aragonpm.eth"
npx truffle exec --network rpc scripts/deploy/apm-registries.js
echo "Deploying APM registry to aragonpm.eth"
npx truffle exec --network rpc scripts/bases/deploy-apm.js

echo "Deploying aragonID registry to aragonpm.eth"
npx truffle exec --network rpc scripts/deploy/beta-aragonid.js;
npx truffle exec --network rpc scripts/bases/deploy-aragonid.js;

echo "Deploying Minime factory"
npx truffle exec --network rpc scripts/deploy/minimefactory.js;
npx truffle exec --network rpc scripts/bases/deploy-minimefactory.js;
107 changes: 0 additions & 107 deletions scripts/deploy/apm-open.js

This file was deleted.

146 changes: 0 additions & 146 deletions scripts/deploy/apm-registries.js

This file was deleted.

Loading