From c2bab93fe2c08f00da4e3aec6347a58ffeb15fe2 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 9 Aug 2024 13:57:55 +0800 Subject: [PATCH] Simply (#1) --- README.md | 48 ++++++------------------------- script/Deploy.s.sol | 70 ++++----------------------------------------- 2 files changed, 14 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index bfa2e7e..eb07503 100644 --- a/README.md +++ b/README.md @@ -2,60 +2,30 @@ ## Koi ``` - Multisig Plugin Setup: 0xC93c3931a2045FCb9C2280f710717900F9C14fBc - TokenVoting Plugin Setup: 0x91943aa31Db7c43761318F0191156044c0f86021 - OptimisticTokenVoting Plugin Setup: 0x71111E17BC5597595d80b2fEc787fAbAD69a98e2 - Multisig Plugin Repo: 0xee93c838B32b70680f36f43652b643712e4ED28f - TokenVoting Plugin Repo: 0x1149E11017DE9C0D1943B7B764134dB4640DC7b3 - OptimisticTokenVoting Plugin Repo: 0x733b9C8d6762d3FAC6C2Ee61F55971492644C0D7 - Ring DAO: 0x638A95b929977bFe720290e12C71B3901d310afE + TokenVoting Plugin Setup: 0xDd571cd0E2b3Ee0f27D6C5C4D991Aefd6AFE10bC + TokenVoting Plugin Repo: 0x1576A49553E4a57515688392b88489DAa0271e9c + Ring DAO: 0x5791F849b27cf3d3794eAA2aDECa00f475508d20 Installed Plugins: - - 0x005D4B92F66dB792b375c274550b11BE41BD93eB - - 0x875D59D1058425F0c945e9193B29638c5622e657 - - 0xE4615D1F35B5A589c65a5A1720E1b65A3965aB18 + - 0xbD7837d84C5028B81b0CDFEc699f53F5C9594422 ``` -## Optimistic Token Voting plugin +## Token Voting plugin -This plugin is an adapted version of Aragon's [Optimistic Token Voting plugin](https://github.com/aragon/optimistic-token-voting-plugin). +This plugin is an adapted version of Aragon's [Token Voting plugin](https://github.com/aragon/osx/tree/v1.3.0/packages/contracts/src/plugins/governance/majority-voting/token). -Only addresses that have been granted `PROPOSER_PERMISSION_ID` on the plugin can create proposals. These adresses belong to the multisig's governed by the Security Council. +Only community members(who owns enough tokens or has enough voting power from being a delegatee) can create proposals. -Proposals can only be executed when the veto threshold hasn't been reached after a minimum period of time. +Proposals can only be executed when the support threshold and minimum participation have been reached after a minimum period of time. The governance settings need to be defined when the plugin is installed but the DAO can update them at any time. ### Permissions -- Only proposers can create proposals on the plugin +- Only community members can create proposals on the plugin - The plugin can execute actions on the DAO - The DAO can update the plugin settings - The DAO can upgrade the plugin -## Standard Multisig - -It allows the Security Council members to create and approve proposals. After a certain minimum of approvals is met, proposals can be relayed to the [Optimistic Token Voting plugin](#optimistic-token-voting-plugin) only. - -![Standard proposal flow](./img/std-proposal-flow.png) - -### Permissions - -- Only members can create proposals -- Only members can approve -- The plugin can only create proposals on the [Optimistic Token Voting plugin](#optimistic-token-voting-plugin) provided that the `duration` is equal or greater than the minimum defined -- The DAO can update the plugin settings - -## Emergency Multisig - -Like before, this plugin allows Security Council members to create and approve proposals. If a super majority approves, proposals can be executed immediately. - -### Permissions - -- Only members can create proposals -- Only members can approve -- The plugin can execute actions on the DAO immediately -- The DAO can update the plugin settings - ## DO's and DONT's - Never grant `ROOT_PERMISSION` unless you are just trying things out diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 1f175de..9eb48da 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -10,30 +10,18 @@ import {PluginRepo} from "@aragon/osx/framework/plugin/repo/PluginRepo.sol"; import {hashHelpers, PluginSetupRef} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessorHelpers.sol"; import {MajorityVotingBase} from "@aragon/osx/plugins/governance/majority-voting/MajorityVotingBase.sol"; -import {MultisigPluginSetup, Multisig} from "../src/plugins/multisig/MultisigPluginSetup.sol"; import {TokenVotingPluginSetup} from "../src/plugins/token-voting/TokenVotingPluginSetup.sol"; -import { - OptimisticTokenVotingPluginSetup, - OptimisticTokenVotingPlugin -} from "../src/plugins/optimistic-token-voting/OptimisticTokenVotingPluginSetup.sol"; contract Deploy is Script { address gRING = 0x87BD07263D0Ed5687407B80FEB16F2E32C2BA44f; - address multisigPlugin = 0x005D4B92F66dB792b375c274550b11BE41BD93eB; address maintainer = 0x0f14341A7f464320319025540E8Fe48Ad0fe5aec; address pluginRepoFactory; DAOFactory daoFactory; address[] pluginAddress; - MultisigPluginSetup multisigPluginSetup; TokenVotingPluginSetup tokenVotingPluginSetup; - OptimisticTokenVotingPluginSetup optimisticTokenVotingPluginSetup; - - PluginRepo multisigPluginRepo; PluginRepo tokenVotingPluginRepo; - PluginRepo optimisticTokenVotingPluginRepo; - DAO ringDAO; function setUp() public { @@ -44,6 +32,8 @@ contract Deploy is Script { function run() public { vm.startBroadcast(); + require(msg.sender == maintainer, "!maintainer"); + console2.log("Chain ID:", block.chainid); console2.log("Deploying from:", msg.sender); @@ -75,12 +65,8 @@ contract Deploy is Script { vm.stopBroadcast(); // 7. Logging the resulting addresses - console2.log("Multisig Plugin Setup: ", address(multisigPluginSetup)); console2.log("TokenVoting Plugin Setup: ", address(tokenVotingPluginSetup)); - console2.log("OptimisticTokenVoting Plugin Setup: ", address(optimisticTokenVotingPluginSetup)); - console2.log("Multisig Plugin Repo: ", address(multisigPluginRepo)); console2.log("TokenVoting Plugin Repo: ", address(tokenVotingPluginRepo)); - console2.log("OptimisticTokenVoting Plugin Repo: ", address(optimisticTokenVotingPluginRepo)); console2.log("Ring DAO: ", address(ringDAO)); console2.log("Installed Plugins: "); for (uint256 i = 0; i < pluginAddress.length; i++) { @@ -89,32 +75,14 @@ contract Deploy is Script { } function deployPluginSetup() public { - multisigPluginSetup = new MultisigPluginSetup(); tokenVotingPluginSetup = new TokenVotingPluginSetup(); - optimisticTokenVotingPluginSetup = new OptimisticTokenVotingPluginSetup(); } function deployPluginRepo() public { - multisigPluginRepo = PluginRepoFactory(pluginRepoFactory).createPluginRepoWithFirstVersion( - string.concat("ringdao-multisig-", vm.toString(block.timestamp)), - address(multisigPluginSetup), - msg.sender, - hex"12", // TODO: Give these actual values on prod - hex"34" - ); - tokenVotingPluginRepo = PluginRepoFactory(pluginRepoFactory).createPluginRepoWithFirstVersion( string.concat("ringdao-token-voting-", vm.toString(block.timestamp)), address(tokenVotingPluginSetup), - msg.sender, - hex"12", // TODO: Give these actual values on prod - hex"34" - ); - - optimisticTokenVotingPluginRepo = PluginRepoFactory(pluginRepoFactory).createPluginRepoWithFirstVersion( - string.concat("ringdao-optimistic-token-voting-", vm.toString(block.timestamp)), - address(optimisticTokenVotingPluginSetup), - msg.sender, + maintainer, hex"12", // TODO: Give these actual values on prod hex"34" ); @@ -125,21 +93,8 @@ contract Deploy is Script { } function getPluginSettings() public view returns (DAOFactory.PluginSettings[] memory pluginSettings) { - pluginSettings = new DAOFactory.PluginSettings[](3); - pluginSettings[0] = getMultisigPluginSetting(); - pluginSettings[1] = getTokenVotingPluginSetting(); - pluginSettings[2] = getOptimisticTokenVotingPluginSetting(); - } - - function getMultisigPluginSetting() public view returns (DAOFactory.PluginSettings memory) { - address[] memory members = new address[](1); - members[0] = maintainer; - bytes memory pluginSettingsData = abi.encode( - members, - Multisig.MultisigSettings({onlyListed: true, minApprovals: 1, destinationProposalDuration: 60 minutes}) - ); - PluginRepo.Tag memory tag = PluginRepo.Tag(1, 1); - return DAOFactory.PluginSettings(PluginSetupRef(tag, multisigPluginRepo), pluginSettingsData); + pluginSettings = new DAOFactory.PluginSettings[](1); + pluginSettings[0] = getTokenVotingPluginSetting(); } function getTokenVotingPluginSetting() public view returns (DAOFactory.PluginSettings memory) { @@ -156,19 +111,4 @@ contract Deploy is Script { PluginRepo.Tag memory tag = PluginRepo.Tag(1, 1); return DAOFactory.PluginSettings(PluginSetupRef(tag, tokenVotingPluginRepo), pluginSettingsData); } - - function getOptimisticTokenVotingPluginSetting() public view returns (DAOFactory.PluginSettings memory) { - address[] memory proposers = new address[](1); - proposers[0] = multisigPlugin; - bytes memory pluginSettingsData = abi.encode( - OptimisticTokenVotingPlugin.OptimisticGovernanceSettings({ - minVetoRatio: 500_000, // 50% - minDuration: 60 minutes - }), - OptimisticTokenVotingPluginSetup.TokenSettings({addr: gRING, underlyingTotalSupply: 1_000_000_000e18}), - proposers - ); - PluginRepo.Tag memory tag = PluginRepo.Tag(1, 1); - return DAOFactory.PluginSettings(PluginSetupRef(tag, optimisticTokenVotingPluginRepo), pluginSettingsData); - } }