diff --git a/dao-deploy.sh b/dao-deploy.sh index ffa53f090..99090eb4f 100755 --- a/dao-deploy.sh +++ b/dao-deploy.sh @@ -81,6 +81,8 @@ msg "Non-aragon contracts initialized" yarn hardhat --network $NETWORK run ./scripts/scratch/15-grant-roles.js --no-compile msg "Roles granted" +yarn hardhat --network $NETWORK run ./scripts/scratch/16-plug-curated-staking-module.js --no-compile +msg "Plugged NodeOperatorsRegistry as Curated staking module" yarn hardhat --network $NETWORK run ./scripts/scratch/12-check-dao.js --no-compile msg "The deployed protocol state checked" diff --git a/scripts/scratch/16-plug-curated-staking-module.js b/scripts/scratch/16-plug-curated-staking-module.js new file mode 100644 index 000000000..e05c7bdd2 --- /dev/null +++ b/scripts/scratch/16-plug-curated-staking-module.js @@ -0,0 +1,60 @@ +const runOrWrapScript = require('../helpers/run-or-wrap-script') +const { log, logSplitter, logWideSplitter, yl, gr } = require('../helpers/log') +const { readNetworkState, assertRequiredNetworkState } = require('../helpers/persisted-network-state') + +const { APP_NAMES } = require('../constants') + + +const REQUIRED_NET_STATE = [ + "stakingRouter", + "app:node-operators-registry", + "owner", + + "app:aragon-agent", + `app:${APP_NAMES.LIDO}`, + `app:${APP_NAMES.ORACLE}`, + "app:aragon-voting", + "accountingOracle", + "burner", + "daoInitialSettings", + "eip712StETH", + "hashConsensusForAccounting", + "hashConsensusForValidatorsExitBus", + "lidoLocator", + "validatorsExitBusOracle", + "withdrawalQueueERC721", + "withdrawalVault", + "gateSealAddress", +] + +const NOR_STAKING_MODULE_TARGET_SHARE_BP = 10000 // 100% +const NOR_STAKING_MODULE_MODULE_FEE_BP = 500 // 5% +const NOR_STAKING_MODULE_TREASURY_FEE_BP = 500 // 5% +const STAKING_MODULE_MANAGE_ROLE = web3.utils.keccak256('STAKING_MODULE_MANAGE_ROLE') + + +async function deployNewContracts({ web3, artifacts }) { + const netId = await web3.eth.net.getId() + logWideSplitter() + log(`Network ID:`, yl(netId)) + + let state = readNetworkState(network.name, netId) + assertRequiredNetworkState(state, REQUIRED_NET_STATE) + + const owner = state.owner + const stakingRouter = await artifacts.require('StakingRouter').at(state.stakingRouter.address) + const nodeOperatorsRegistry = await artifacts.require('NodeOperatorsRegistry').at(state['app:node-operators-registry'].proxyAddress) + + await log.makeTx(stakingRouter, 'grantRole', [STAKING_MODULE_MANAGE_ROLE, owner], { from: owner }) + + await log.makeTx(stakingRouter, 'addStakingModule', [ + state.nodeOperatorsRegistry.parameters.stakingModuleTypeId, + nodeOperatorsRegistry.address, + NOR_STAKING_MODULE_TARGET_SHARE_BP, + NOR_STAKING_MODULE_MODULE_FEE_BP, + NOR_STAKING_MODULE_TREASURY_FEE_BP, + ], { from: owner }) + await log.makeTx(stakingRouter, 'renounceRole', [STAKING_MODULE_MANAGE_ROLE, owner], { from: owner }) +} + +module.exports = runOrWrapScript(deployNewContracts, module)