From 46388b0d0ed8f40fd18d78a92d663ce40d0f7008 Mon Sep 17 00:00:00 2001 From: John Cairns Date: Mon, 31 Oct 2022 19:16:44 +0000 Subject: [PATCH] add metaId to ProposalMeta event --- .vscode/tasks.json | 20 ++++- abi/Governance.json | 114 +++++++++++++++++++++++++++++ abi/Storage.json | 39 ++++++++++ contracts/CollectiveGovernance.sol | 2 +- contracts/Constant.sol | 3 +- contracts/Governance.sol | 2 +- 6 files changed, 175 insertions(+), 5 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 55cdf5c..6b8e96f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -90,6 +90,19 @@ "isDefault": false } }, + { + "label": "deployconstant", + "type": "shell", + "command": "forge create --contracts contracts/Constant.sol --rpc-url ${DEVNET_RPC_URL} --private-key ${ETH_DEV_PRIVATE} --etherscan-api-key ${ETHERSCAN_API_KEY} --verify Constant", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "production", + "group": { + "kind": "test", + "isDefault": false + } + }, { "label": "deployfactory", "type": "shell", @@ -106,9 +119,12 @@ { "label": "deploybuilder", "type": "shell", - "command": "forge create --contracts contracts/GovernanceBuilder.sol --rpc-url ${DEVNET_RPC_URL} --private-key ${ETH_DEV_PRIVATE} --etherscan-api-key ${ETHERSCAN_API_KEY} --verify GovernanceBuilder", + "command": "forge create --libraries contracts/Constant.sol:Constant:${CONSTANT_LIB_ADDRESS} --contracts contracts/GovernanceBuilder.sol --rpc-url ${DEVNET_RPC_URL} --private-key ${ETH_DEV_PRIVATE} --etherscan-api-key ${ETHERSCAN_API_KEY} --verify GovernanceBuilder", "options": { - "cwd": "${workspaceFolder}" + "cwd": "${workspaceFolder}", + "env": { + "CONSTANT_LIB_ADDRESS": "0xaDFDc9ADe7B4199179E0eeF0ce8e67E12a92A50F" + } }, "dependsOn": "production", "group": { diff --git a/abi/Governance.json b/abi/Governance.json index 4dd0bf6..fbd8c48 100644 --- a/abi/Governance.json +++ b/abi/Governance.json @@ -42,6 +42,31 @@ "name": "ProposalCreated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "ProposalDescription", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -61,6 +86,43 @@ "name": "ProposalExecuted", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "metaId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ProposalMeta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -278,6 +340,35 @@ "name": "RebatePaid", "type": "event" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_proposalId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_name", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "_value", + "type": "string" + } + ], + "name": "addMeta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -394,6 +485,29 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_proposalId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_description", + "type": "string" + }, + { + "internalType": "string", + "name": "_url", + "type": "string" + } + ], + "name": "describe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "description", diff --git a/abi/Storage.json b/abi/Storage.json index ce46bce..00ccdea 100644 --- a/abi/Storage.json +++ b/abi/Storage.json @@ -632,6 +632,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "community", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -651,6 +664,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "description", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1382,6 +1408,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "url", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "version", diff --git a/contracts/CollectiveGovernance.sol b/contracts/CollectiveGovernance.sol index 1ad7a4a..9fd98b8 100644 --- a/contracts/CollectiveGovernance.sol +++ b/contracts/CollectiveGovernance.sol @@ -235,7 +235,7 @@ contract CollectiveGovernance is Governance, VoteStrategy, ERC165 { string memory _value ) external returns (uint256) { uint256 metaId = _storage.addMeta(_proposalId, _name, _value, msg.sender); - emit ProposalMeta(_proposalId, _name, _value, msg.sender); + emit ProposalMeta(_proposalId, metaId, _name, _value, msg.sender); return metaId; } diff --git a/contracts/Constant.sol b/contracts/Constant.sol index 257cb35..56e7731 100644 --- a/contracts/Constant.sol +++ b/contracts/Constant.sol @@ -44,7 +44,8 @@ pragma solidity ^0.8.15; /** - @notice extract global manifest constants + * @notice extract global manifest constants + * @dev hash b28717930d5c821c80736e02d025efa7f9cb615e deployed to 0xaDFDc9ADe7B4199179E0eeF0ce8e67E12a92A50F */ library Constant { uint256 public constant UINT_MAX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; diff --git a/contracts/Governance.sol b/contracts/Governance.sol index 55c7146..abbe360 100644 --- a/contracts/Governance.sol +++ b/contracts/Governance.sol @@ -84,7 +84,7 @@ interface Governance is IERC165 { ); /// @notice ProposalMeta attached - event ProposalMeta(uint256 proposalId, bytes32 name, string value, address sender); + event ProposalMeta(uint256 proposalId, uint256 metaId, bytes32 name, string value, address sender); /// @notice The proposal description event ProposalDescription(uint256 proposalId, string description, string url); /// @notice The proposal is now open for voting