diff --git a/README.md b/README.md index 5a0a0b1..b8b0660 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,18 @@ Successfully verified contract "contracts/EarlyAdopters.sol:EarlyAdopters" for n | BetaBuildersRootstockCollective impl | 0x19760b39a3378E368ceD7C43c9244a0a22e55035 | | BetaBuildersRootstockCollective proxy | 0x7a67640BC00Dacc3b73cCb579B9Fe98EAd5451cf | +### Rootstock Production Testnet + +| Contract Name | Address | +| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| GovernorRootstockCollective impl | [0x357Cb4f62A74F39ca26046A9A208A393172dF1bb](https://rootstock-testnet.blockscout.com/address/0x357Cb4f62A74F39ca26046A9A208A393172dF1bb#code) | +| GovernorRootstockCollective proxy | [0x25b7eb94f76cC682A402DA980e6599478a596379](https://rootstock-testnet.blockscout.com/address/0x25b7eb94f76cC682A402DA980e6599478a596379#code) | +| StRIFTokenV02 impl | [0x8158aBDAEdD7770F372031aC0AaB8FB4BC9ABe75](https://rootstock-testnet.blockscout.com/address/0x8158aBDAEdD7770F372031aC0AaB8FB4BC9ABe75#code) | +| StRIFTokenV02 proxy | [0xE88d04062060b196B0f220afa784168d4B3657E9](https://rootstock-testnet.blockscout.com/address/0xE88d04062060b196B0f220afa784168d4B3657E9#code) | +| DaoTimelockUpgradableRootstockCollective impl | [0x0025e59f281bc06e7A54afe780673bd6A8D3a7E9](https://rootstock-testnet.blockscout.com/address/0x0025e59f281bc06e7A54afe780673bd6A8D3a7E9#code) | +| DaoTimelockUpgradableRootstockCollective proxy | [0x5b20eDd661a2B87A9C9AE55d3e3b09281Dc71C48](https://rootstock-testnet.blockscout.com/address/0x5b20eDd661a2B87A9C9AE55d3e3b09281Dc71C48#code) | +| TreasuryRootstockCollective | [0xc4DAcee263B0D1f2a09006dbc0170a4fDa861B68](https://rootstock-testnet.blockscout.com/address/0xc4DAcee263B0D1f2a09006dbc0170a4fDa861B68#code) | + ### Rootstock Dev | Contract Name | Dev Address | diff --git a/ignition/modules/GovernorModule.ts b/ignition/modules/GovernorModule.ts index 0cbc887..8712ab1 100644 --- a/ignition/modules/GovernorModule.ts +++ b/ignition/modules/GovernorModule.ts @@ -1,6 +1,6 @@ import { buildModule } from '@nomicfoundation/hardhat-ignition/modules' -import TimelockModule from './TimelockModule' import StRifModule from './StRifModule' +import TimelockModule from './TimelockModule' import TreasuryModule from './TreasuryModule' /** diff --git a/ignition/modules/GovernorWithStRifV02Module.ts b/ignition/modules/GovernorWithStRifV02Module.ts new file mode 100644 index 0000000..231e1e1 --- /dev/null +++ b/ignition/modules/GovernorWithStRifV02Module.ts @@ -0,0 +1,77 @@ +import { buildModule } from '@nomicfoundation/hardhat-ignition/modules' +import StRifV02DeployModule from './StRifV02DeployModule' +import TimelockModule from './TimelockModule' +import TreasuryModule from './TreasuryModule' + +/** + * Deploys proxy contract before deploying the Governor with StRIF V02 + */ +export const governorProxyModule = buildModule('GovernorProxy', m => { + const owner = m.getParameter('owner') + const guardian = m.getParameter('guardian') + const votingDelay = m.getParameter('votingDelay') + const votingPeriod = m.getParameter('votingPeriod') + const proposalThreshold = m.getParameter('proposalThreshold') + const quorumFraction = m.getParameter('quorumFraction') + + // deploy implementation + const governor = m.contract('GovernorRootstockCollective') + // deploy ERC1967 proxy in order to use UUPS upgradable smart contracts + const { timelock } = m.useModule(TimelockModule) + const { stRif } = m.useModule(StRifV02DeployModule) + const governorProxy = m.contract('ERC1967Proxy', [ + governor, + m.encodeFunctionCall(governor, 'initialize', [ + stRif, + timelock, + owner, + guardian, + votingDelay, + votingPeriod, + proposalThreshold, + quorumFraction, + ]), + ]) + return { governorProxy, timelock, stRif } +}) + +/** + * Main DAO deployment module with StRIF V02. + * Deploys Governor along with other related contracts + * (Timelock, StRIF V02 with CollectiveRewards, Treasury). + * + * Usage: + * ```shell + * npx hardhat ignition deploy \ + * ignition/modules/GovernorWithStRifV02Module.ts \ + * --parameters params/prod-testnet.json \ + * --network rootstockTestnet + * ``` + */ +const governorModule = buildModule('Governor', m => { + const { governorProxy, timelock, stRif } = m.useModule(governorProxyModule) + + // set Timelock as the Executor on the Treasury + const { treasury } = m.useModule(TreasuryModule) + const treasuryExecutorRole = m.staticCall(treasury, 'EXECUTOR_ROLE') + m.call(treasury, 'grantRole', [treasuryExecutorRole, timelock]) + + // Use proxy address to interact with the deployed Governor contract + const governor = m.contractAt('GovernorRootstockCollective', governorProxy) + + // grant Timelock Proposer role to the Governor + const proposerRole = m.staticCall(timelock, 'PROPOSER_ROLE') + m.call(timelock, 'grantRole', [proposerRole, governor], { + id: 'grant_proposer_role', + }) + + // grant Timelock Executor role to the Governor + const timelockExecutorRole = m.staticCall(timelock, 'EXECUTOR_ROLE') + m.call(timelock, 'grantRole', [timelockExecutorRole, governor], { + id: 'grant_executor_role', + }) + + return { governor, timelock, stRif, treasury } +}) + +export default governorModule diff --git a/ignition/modules/StRifV02DeployModule.ts b/ignition/modules/StRifV02DeployModule.ts new file mode 100644 index 0000000..024d8ea --- /dev/null +++ b/ignition/modules/StRifV02DeployModule.ts @@ -0,0 +1,28 @@ +import { buildModule } from '@nomicfoundation/hardhat-ignition/modules' + +export const stRifV02ProxyModule = buildModule('stRifV02Proxy', m => { + const owner = m.getParameter('owner') + // deploy StRIF V02 implementation + const rifAddress = m.getParameter('rifAddress') + const stRifV02 = m.contract('StRIFTokenV02', [], { id: 'Implementation' }) + // deploy ERC1967 proxy in order to use UUPS upgradable smart contracts + const stRifV02Proxy = m.contract( + 'ERC1967Proxy', + [stRifV02, m.encodeFunctionCall(stRifV02, 'initialize', [rifAddress, owner])], + { id: 'Proxy' }, + ) + return { stRifV02Proxy } +}) + +/** + * Deploys StRIF V02 contract with CollectiveRewards support. + * This is for fresh deployments, not upgrades. + */ +const stRifV02DeployModule = buildModule('stRifV02', m => { + const { stRifV02Proxy } = m.useModule(stRifV02ProxyModule) + const stRifV02 = m.contractAt('StRIFTokenV02', stRifV02Proxy) + + return { stRif: stRifV02 } +}) + +export default stRifV02DeployModule diff --git a/params/prod-testnet.json b/params/prod-testnet.json new file mode 100644 index 0000000..24c43b8 --- /dev/null +++ b/params/prod-testnet.json @@ -0,0 +1,23 @@ +{ + "stRifV02Proxy": { + "rifAddress": "0x19F64674D8A5B4E652319F5e239eFd3bc969A1fE", + "owner": "0x96ee33c87027Be941583A5CAec4B677F269e7C2a" + }, + "GovernorProxy": { + "owner": "0x96ee33c87027Be941583A5CAec4B677F269e7C2a", + "guardian": "0x96ee33c87027Be941583A5CAec4B677F269e7C2a", + "votingDelay": 1, + "votingPeriod": 50, + "proposalThreshold": "50000000000000000000", + "quorumFraction": 4 + }, + "TimelockProxy": { + "minDelay": 600, + "admin": "0x96ee33c87027Be941583A5CAec4B677F269e7C2a" + }, + "Treasury": { + "owner": "0x96ee33c87027Be941583A5CAec4B677F269e7C2a", + "guardian": "0x96ee33c87027Be941583A5CAec4B677F269e7C2a", + "whitelist": ["0x19F64674D8A5B4E652319F5e239eFd3bc969A1fE"] + } +}