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

Improve DAO deploy script and template #164

Merged
merged 2 commits into from
Nov 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 10 additions & 6 deletions contracts/0.4.24/template/LidoTemplate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ contract LidoTemplate is BaseTemplate {
}

DeployState private deployState;
BeaconSpec public beaconSpec;

constructor(
DAOFactory _daoFactory,
Expand Down Expand Up @@ -97,10 +96,6 @@ contract LidoTemplate is BaseTemplate {
require(deployState.dao == address(0), "PREVIOUS_DEPLOYMENT_NOT_FINALIZED");
require(_holders.length > 0, "COMPANY_EMPTY_HOLDERS");
require(_holders.length == _stakes.length, "COMPANY_BAD_HOLDERS_STAKES_LEN");
beaconSpec.epochsPerFrame = _beaconSpec[0];
beaconSpec.slotsPerEpoch = _beaconSpec[1];
beaconSpec.secondsPerSlot = _beaconSpec[2];
beaconSpec.genesisTime = _beaconSpec[3];

_validateId(_id);

Expand All @@ -112,7 +107,16 @@ contract LidoTemplate is BaseTemplate {
state.token = _createToken(_tokenName, _tokenSymbol, TOKEN_DECIMALS);
(state.dao, state.acl) = _createDAO();

_setupApps(state, _votingSettings, _BeaconDepositContract, _depositIterationLimit, beaconSpec.epochsPerFrame, beaconSpec.slotsPerEpoch, beaconSpec.secondsPerSlot, beaconSpec.genesisTime);
_setupApps(
state,
_votingSettings,
_BeaconDepositContract,
_depositIterationLimit,
_beaconSpec[0], // epochsPerFrame
_beaconSpec[1], // slotsPerEpoch
_beaconSpec[2], // secondsPerSlot
_beaconSpec[3] // genesisTime
);

deployState = state;
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/deploy-lido-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const { filterObject } = require('./helpers/collections')
const { readAppName } = require('./helpers/aragon')

const NETWORK_STATE_FILE = process.env.NETWORK_STATE_FILE || 'deployed.json'
const APPS_DIR_PATH = path.resolve(__dirname, '..', 'apps')
const RELEASE_TYPE = 'major'
const APPS = '*'
const RELEASE_TYPE = process.env.RELEASE_TYPE || 'major'
const APPS = process.env.APPS || '*'
const APPS_DIR_PATH = process.env.APPS_DIR_PATH || path.resolve(__dirname, '..', 'apps')

async function deployAragonStdApps({
web3,
Expand Down
28 changes: 20 additions & 8 deletions scripts/deploy-lido-dao.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const DEFAULT_DAO_SETTINGS = {
votingSupportRequired: '500000000000000000', // 50e16 basis points === 50%
votingMinAcceptanceQuorum: '50000000000000000', // 5e16 basis points === 5%
depositIterationLimit: 16,
beaconSpec: [
225, // epochsPerFrame:
32, // slotsPerEpoch
12, // secondsPerSlot
1606824000
] // genesisTime
beaconSpec: {
epochsPerFrame: 225,
slotsPerEpoch: 32,
secondsPerSlot: 12,
genesisTime: 1606824000
}
}

const APPS_DIR_PATH = path.resolve(__dirname, '..', 'apps')
Expand Down Expand Up @@ -75,7 +75,12 @@ async function deployDao({

const isPublicNet = netId <= 1000

if (!state.daoInitialSettings) {
if (state.daoInitialSettings) {
state.daoInitialSettings = {
...defaultDaoSettings,
...state.daoInitialSettings
}
} else {
if (isPublicNet) {
throw new Error(`please specify initial DAO settings in state file ${networkStateFile}`)
}
Expand Down Expand Up @@ -222,6 +227,13 @@ async function deployDAO({
daoInitialSettings.voteDuration
]

const beaconSpec = [
daoInitialSettings.beaconSpec.epochsPerFrame,
daoInitialSettings.beaconSpec.slotsPerEpoch,
daoInitialSettings.beaconSpec.secondsPerSlot,
daoInitialSettings.beaconSpec.genesisTime
]

const newDaoResult = await logTx(
`Deploying DAO from template`,
template.newDAO(
Expand All @@ -233,7 +245,7 @@ async function deployDAO({
votingSettings,
depositContractAddress,
daoInitialSettings.depositIterationLimit,
daoInitialSettings.beaconSpec,
beaconSpec,
{ from: owner }
)
)
Expand Down