kinto-core
kinto-core copied to clipboard
Nio Governance System
Nio Governance System
Summary
This PR introduces three new contracts to implement the Nio governance system for Kinto. The NioElection contract manages the election process for Nio guardians, the NioGuardians contract represents the elected guardians as NFTs with voting power, and the NioGovernor contract handles the actual governance proposals and voting.
Implementation details
-
NioElection contract:
- Manages the entire election process for Nio guardians
- Implements a multi-phase election: candidate submission, candidate voting, compliance process, nominee voting, and final election
- Uses the BridgedKinto token for voting power in elections
- Enforces KYC requirements for candidates and nominees
- Implements a vote weighting system for the nominee voting phase
- Mints NioGuardian NFTs for elected guardians
-
NioGuardians contract:
- ERC721 token representing elected Nio guardians
- Implements ERC721Votes for on-chain voting capabilities
- Only allows minting and burning of tokens (no transfers)
- Automatically delegates voting power to the token holder upon minting
- Prevents manual delegation of votes
-
NioGovernor contract:
- Implements OpenZeppelin's Governor contract with various modules
- Uses NioGuardians tokens for voting power
- Sets specific governance parameters:
- 3-day voting delay
- 5-day voting period
- 1 token proposal threshold
- 5 Nios required for quorum
- Integrates with a timelock for executing proposals
-
The election process is designed to occur every 6 months, alternating between electing 4 and 5 Nios
-
Implements various security checks and access controls throughout the election and governance processes
-
Provides extensive view functions for querying election and governance data
This implementation aligns with the Kinto Constitution's governance framework, providing a robust and decentralized system for electing Nio guardians and managing the Kinto DAO's decision-making process.
Type of change
- [ ] Bug fix
- [x] New feature
- [ ] Breaking change
- [ ] Dependency changes
- [ ] Deployment
- [ ] Forge Script
- [ ] Code refactor / cleanup
- [ ] Documentation or wording changes
- [ ] Other
Checklist:
- [x] The diff is legible and has no extraneous changes
- [x] Complex code has been commented, including external interfaces
- [x] Tests have 100% code coverage
- [x] The base branch is either
main, or there's a description of how to merge
Issue Resolution
Nio Governance System
Generated at commit: 75a09795950f62c63f3c7eaa4ad4fa58e2854d47
🚨 Report Summary
| Severity Level | Results | |
|---|---|---|
| Contracts | Critical High Medium Low Note Total | 4 1 0 12 39 56 |
| Dependencies | Critical High Medium Low Note Total | 0 0 0 0 0 0 |
For more details view the full report in OpenZeppelin Code Inspector
Slither report
THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary
Codecov Report
Attention: Patch coverage is 98.40426% with 3 lines in your changes missing coverage. Please review.
Project coverage is 90.40%. Comparing base (
2688e83) to head (75a0979). Report is 2 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/governance/NioElection.sol | 98.76% | 2 Missing :warning: |
| src/tokens/NioGuardians.sol | 91.66% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #258 +/- ##
==========================================
+ Coverage 89.43% 90.40% +0.96%
==========================================
Files 35 38 +3
Lines 1761 1949 +188
==========================================
+ Hits 1575 1762 +187
- Misses 186 187 +1
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/KintoID.sol | 99.19% <ø> (+1.61%) |
:arrow_up: |
| src/governance/NioGovernor.sol | 100.00% <100.00%> (ø) |
|
| src/tokens/bridged/BridgedKinto.sol | 100.00% <100.00%> (ø) |
|
| src/tokens/bridged/BridgedToken.sol | 100.00% <ø> (ø) |
|
| src/tokens/NioGuardians.sol | 91.66% <91.66%> (ø) |
|
| src/governance/NioElection.sol | 98.76% <98.76%> (ø) |