From 7fc5c3bf916fa6946fab6232278716691c48af6d Mon Sep 17 00:00:00 2001 From: Ido Date: Thu, 25 Jan 2024 12:11:55 +0200 Subject: [PATCH] add hats elections eligibility v0.2.0 --- .../deprecatedHatsElectionEligibility.json | 402 ++++++++++++++++++ modules/hatsElectionEligibility.json | 16 +- 2 files changed, 415 insertions(+), 3 deletions(-) create mode 100644 modules/deprecatedHatsElectionEligibility.json diff --git a/modules/deprecatedHatsElectionEligibility.json b/modules/deprecatedHatsElectionEligibility.json new file mode 100644 index 0000000..b3e4e45 --- /dev/null +++ b/modules/deprecatedHatsElectionEligibility.json @@ -0,0 +1,402 @@ +{ + "deprecated": true, + "name": "Hats Election Eligibility", + "details": [ + "This module enables organizations to elect wearers of a given hat. More specifically, it makes certain accounts eligible to wear the given hat based on the submitted results of an election.", + "Election results are valid within a given term, after which the elected wearers become ineligible unless and until new election results are submitted.", + "This module works with any election mechanism that can output a list of winning addresses, such as onchain DAO proposals or an oSnap proposal." + ], + "links": [ + { + "label": "GitHub", + "link": "https://github.com/Hats-Protocol/hats-elections-eligibility" + } + ], + "parameters": [ + { + "label": "Admin Hat ID", + "functionName": "ADMIN_HAT", + "displayType": "hat" + }, + { + "label": "Ballot Box Hat ID", + "functionName": "BALLOT_BOX_HAT", + "displayType": "hat" + }, + { + "label": "Current Term End", + "functionName": "currentTermEnd", + "displayType": "timestamp" + }, + { + "label": "Next Term End", + "functionName": "nextTermEnd", + "displayType": "timestamp" + } + ], + "type": { + "eligibility": true, + "toggle": false, + "hatter": false + }, + "implementationAddress": "0x99081d45920818557203CCD62eD36dC2FaD9a43E", + "deployments": [ + { + "chainId": "5", + "block": "10038318" + } + ], + "creationArgs": { + "useHatId": true, + "immutable": [ + { + "name": "Ballot Box Hat", + "description": "This hat has the authority to submit election and recall results.", + "type": "uint256", + "example": "26959946667150639794667015087019630673637144422540572481103610249216", + "displayType": "hat" + }, + { + "name": "Admin Hat", + "description": "Optional admin hat, granted authority to set up a new term. If not provided (equals zero), then this permission is granted to the admins of the hat.", + "type": "uint256", + "example": "26959946667150639794667015087019630673637144422540572481103610249216", + "displayType": "hat", + "optional": true + } + ], + "mutable": [ + { + "name": "Current Term End", + "description": "Timestamp of the second following the end of the current term", + "type": "uint128", + "example": "1723155807", + "displayType": "timestamp" + } + ] + }, + "customRoles": [ + { + "id": "electionsBallotBox", + "name": "Elections Ballot Box", + "criteria": "BALLOT_BOX_HAT" + }, + { + "id": "electionsAdmin", + "name": "Elections Admin", + "criteria": "ADMIN_HAT", + "hatAdminsFallback": true + } + ], + "writeFunctions": [ + { + "roles": ["public"], + "functionName": "startNextTerm", + "label": "Start Next Term", + "description": "If the current term has passed and the next term's election is over, then start the next term", + "primary": true, + "args": [] + }, + { + "roles": ["electionsBallotBox"], + "functionName": "elect", + "label": "Submit Election Results", + "description": "Submit the results of an election for a specified term", + "primary": true, + "args": [ + { + "name": "Election's Term End", + "description": "Term end time of the election", + "type": "uint128", + "displayType": "timestamp" + }, + { + "name": "Winners", + "description": "The addresses of the winners of the election", + "type": "address[]", + "displayType": "default" + } + ] + }, + { + "roles": ["electionsBallotBox"], + "functionName": "recall", + "label": "Submit Recall Election Results", + "description": "Submit the results of a recall election for a specified term", + "args": [ + { + "name": "Election's Term End", + "description": "Term end time of the election", + "type": "uint128", + "displayType": "timestamp" + }, + { + "name": "Recallees", + "description": "The addresses of the Recalled accounts", + "type": "address[]", + "displayType": "default" + } + ] + }, + { + "roles": ["electionsAdmin"], + "functionName": "setNextTerm", + "label": "set Next Term", + "description": "Set the next term. This will open the election for the next term. If the next term has already been set and is still open, this function can be used to change it.", + "primary": true, + "args": [ + { + "name": "New Term End", + "description": "The end time of the term that will be opened", + "type": "uint128", + "displayType": "timestamp" + } + ] + } + ], + "abi": [ + { + "inputs": [ + { "internalType": "string", "name": "_version", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "termEnd", "type": "uint128" } + ], + "name": "ElectionClosed", + "type": "error" + }, + { "inputs": [], "name": "InvalidTermEnd", "type": "error" }, + { "inputs": [], "name": "NextTermNotReady", "type": "error" }, + { "inputs": [], "name": "NotAdmin", "type": "error" }, + { "inputs": [], "name": "NotBallotBox", "type": "error" }, + { "inputs": [], "name": "NotElected", "type": "error" }, + { "inputs": [], "name": "TermEnded", "type": "error" }, + { "inputs": [], "name": "TermNotEnded", "type": "error" }, + { "inputs": [], "name": "TooManyWinners", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "termEnd", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "winners", + "type": "address[]" + } + ], + "name": "ElectionCompleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "nextTermEnd", + "type": "uint128" + } + ], + "name": "ElectionOpened", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "termEnd", + "type": "uint128" + } + ], + "name": "NewTermStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + } + ], + "name": "Recalled", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_HAT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "BALLOT_BOX_HAT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "HATS", + "outputs": [ + { "internalType": "contract IHats", "name": "", "type": "address" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "IMPLEMENTATION", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "currentTermEnd", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "_termEnd", "type": "uint128" }, + { "internalType": "address[]", "name": "_winners", "type": "address[]" } + ], + "name": "elect", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "termEnd", "type": "uint128" }, + { "internalType": "address", "name": "candidates", "type": "address" } + ], + "name": "electionResults", + "outputs": [ + { "internalType": "bool", "name": "elected", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "termEnd", "type": "uint128" } + ], + "name": "electionStatus", + "outputs": [ + { "internalType": "bool", "name": "isElectionOpen", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_wearer", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "getWearerStatus", + "outputs": [ + { "internalType": "bool", "name": "eligible", "type": "bool" }, + { "internalType": "bool", "name": "standing", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hatId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "nextTermEnd", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "_termEnd", "type": "uint128" }, + { + "internalType": "address[]", + "name": "_recallees", + "type": "address[]" + } + ], + "name": "recall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "_newTermEnd", "type": "uint128" } + ], + "name": "setNextTerm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "_initData", "type": "bytes" } + ], + "name": "setUp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "startNextTerm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version_", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + } + ] +} diff --git a/modules/hatsElectionEligibility.json b/modules/hatsElectionEligibility.json index 959c239..3cbc384 100644 --- a/modules/hatsElectionEligibility.json +++ b/modules/hatsElectionEligibility.json @@ -38,11 +38,15 @@ "toggle": false, "hatter": false }, - "implementationAddress": "0x99081d45920818557203CCD62eD36dC2FaD9a43E", + "implementationAddress": "0xd3b916a8F0C4f9D1d5B6Af29c3C012dbd4f3149E", "deployments": [ { "chainId": "5", - "block": "10038318" + "block": "10430387" + }, + { + "chainId": "11155111", + "block": "5150097" } ], "creationArgs": { @@ -77,7 +81,7 @@ "customRoles": [ { "id": "electionsBallotBox", - "name": "Elections Bollot Box", + "name": "Elections Ballot Box", "criteria": "BALLOT_BOX_HAT" }, { @@ -237,6 +241,12 @@ { "anonymous": false, "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "termEnd", + "type": "uint128" + }, { "indexed": false, "internalType": "address[]",