Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ’₯ Add Multi-Role-Based TimelockController Reference Implementation #195

Merged
merged 51 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e3b1175
🚧 TimelockController main draft w/ Access Control
cairoeth Jan 14, 2024
ae3f112
✨ Proposal execute, schedule, and cancel
cairoeth Jan 14, 2024
81b19cf
🎨 Forge formatter
cairoeth Jan 14, 2024
0e52804
βœ… TimelockController testing suite
cairoeth Jan 14, 2024
25ae332
βœ… Add more unit tests for TimelockController
cairoeth Jan 14, 2024
4517efb
βœ… Add remaining unit tests for TimelockController
cairoeth Jan 14, 2024
1f15e08
🚧 TimelockController invariant setup
cairoeth Jan 15, 2024
ee31112
🚧 Add invariant templates
cairoeth Jan 16, 2024
0623b05
βœ… Add invariant tests for TimelockController
cairoeth Jan 16, 2024
c48e0c6
βœ… Wrap up invariant tests
cairoeth Jan 16, 2024
d9f758f
πŸ’‘ Update format and add comments/natspec
cairoeth Jan 17, 2024
2330bfa
Merge branch 'main' into main
pcaversaccio Jan 18, 2024
b6ba7ea
πŸ’„ Prettify
pcaversaccio Jan 18, 2024
2857372
πŸ› Fix typos
pcaversaccio Jan 18, 2024
4049a0d
♻️ Clarify build directory root
pcaversaccio Jan 18, 2024
0b776df
πŸ“– Add `README` and `CHANGELOG` Entry
pcaversaccio Jan 18, 2024
4032693
♻️ First Refactoring
pcaversaccio Jan 19, 2024
efc01ab
♻️ Amend
pcaversaccio Jan 21, 2024
ac2b9c7
πŸ“– Add Missing Comments in Other Contracts
pcaversaccio Jan 21, 2024
669abb6
♻️ Further chore
pcaversaccio Jan 21, 2024
31a1af1
♻️ Further chore
pcaversaccio Jan 21, 2024
4ec4ada
♻️ formatting
pcaversaccio Jan 21, 2024
5b9c383
Merge branch 'main' into main
pcaversaccio Jan 22, 2024
b852bc5
πŸ“– Finetune wording
pcaversaccio Jan 22, 2024
bf6ccf5
βœ… Fix tests with interface
cairoeth Jan 22, 2024
ebc75b9
βœ… Add value-based proposal test
cairoeth Jan 22, 2024
fd2f78a
πŸ”§ Fix interface data parameters
cairoeth Jan 22, 2024
16f8fcf
πŸ“– data -> payload
pcaversaccio Jan 22, 2024
8e93c7f
♻️ Complete `ITimelockController` Interface
pcaversaccio Jan 22, 2024
f3d7967
πŸ‘· Fix Glob Pattern
pcaversaccio Jan 22, 2024
c7ef252
πŸ‘· Fix Glob Pattern in `npm` Scripts
pcaversaccio Jan 23, 2024
abe35d4
βœ… Add event emitted checks
cairoeth Jan 23, 2024
473914e
♻️ Use `constant` for `DynArray` Bound
pcaversaccio Jan 23, 2024
f05ffab
πŸ“– Correct Label in `CHANGELOG`
pcaversaccio Jan 23, 2024
c8a77c1
♻️ amend comment
pcaversaccio Jan 23, 2024
dae2b5f
βœ… Add roles for permissions checks
cairoeth Jan 23, 2024
17c1b55
Update TimelockController.t.sol
cairoeth Jan 24, 2024
fcb9209
βœ… Single operation tests
cairoeth Jan 24, 2024
76be9a9
Merge branch 'main' into main
pcaversaccio Jan 29, 2024
6cb0531
♻️ Remove `receive` Function From Interface
pcaversaccio Jan 29, 2024
92b1285
♻️ Refactor Tests
pcaversaccio Jan 30, 2024
4c0401a
♻️ Refactor Tests
pcaversaccio Jan 30, 2024
89b0bb2
πŸ’„ Remove obsolete solhint rule
pcaversaccio Jan 30, 2024
b28e00a
♻️ Refactor Tests
pcaversaccio Jan 31, 2024
4721553
♻️ Refactor Tests
pcaversaccio Jan 31, 2024
c2a5b4e
Merge branch 'main' into main
pcaversaccio Jan 31, 2024
0abe912
πŸ“– chore docs
pcaversaccio Jan 31, 2024
b7988e8
♻️ Add Further Tests
pcaversaccio Feb 1, 2024
b744bce
♻️ small chore refactor invariant tests
pcaversaccio Feb 1, 2024
defbfd5
♻️ Add `.gas-snapshot`
pcaversaccio Feb 1, 2024
4ab7065
Merge branch 'main' into main
pcaversaccio Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
318 changes: 205 additions & 113 deletions .gas-snapshot

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ venv
# Python build files
dist
*.egg-info

# Ape build files
.build
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"func-visibility": ["warn", { "ignoreConstructors": true }],
"func-name-mixedcase": "off",
"private-vars-leading-underscore": "off",
"one-contract-per-file": "off"
"one-contract-per-file": "off",
"max-states-count": "off"
}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [`0.0.5`](https://github.com/pcaversaccio/snekmate/releases/tag/v0.0.5) (Unreleased)

### πŸ’₯ New Features

- **Governance**
- [`TimelockController`](https://github.com/pcaversaccio/snekmate/blob/v0.0.5/src/governance/TimelockController.vy): A multi-role-based timelock controller reference implementation. ([#195](https://github.com/pcaversaccio/snekmate/pull/195))

### ♻️ Refactoring

- **Utility Functions**
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ src
β”‚ β”œβ”€β”€ ERC4626 β€” "Modern and Gas-Efficient ERC-4626 Tokenised Vault Implementation"
β”‚ └── interfaces
β”‚ └── IERC2981 β€” "EIP-2981 Interface Definition"
β”œβ”€β”€ governance
β”‚ └── TimelockController β€” "Multi-Role-Based Timelock Controller Reference Implementation"
β”œβ”€β”€ tokens
β”‚ β”œβ”€β”€ ERC20 β€” "Modern and Gas-Efficient ERC-20 + EIP-2612 Implementation"
β”‚ β”œβ”€β”€ ERC721 β€” "Modern and Gas-Efficient ERC-721 + EIP-4494 Implementation"
Expand Down Expand Up @@ -113,6 +115,7 @@ This repository contains [Foundry](https://github.com/foundry-rs/foundry)-based
| `AccessControl` | βœ… | βœ… | βœ… |
| `ERC2981` | βœ… | βœ… | βœ… |
| `ERC4626` | βœ… | βœ… | βœ… |
| `TimelockController` | βœ… | βœ… | βœ… |
| `ERC20` | βœ… | βœ… | βœ… |
| `ERC721` | βœ… | βœ… | βœ… |
| `ERC1155` | βœ… | βœ… | βœ… |
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"url": "https://github.com/pcaversaccio/snekmate/issues"
},
"scripts": {
"prettier:check": "npx prettier -c **/*.{md,sol,js,json,yml,yaml}",
"prettier:fix": "npx prettier -w **/*.{md,sol,js,json,yml,yaml}",
"solhint:check": "npx solhint '**/*.sol'",
"solhint:fix": "npx solhint '**/*.sol' --fix",
"prettier:check": "npx prettier -c \"**/*.{md,sol,js,json,yml,yaml}\"",
"prettier:fix": "npx prettier -w \"**/*.{md,sol,js,json,yml,yaml}\"",
"solhint:check": "npx solhint \"**/*.sol\"",
"solhint:fix": "npx solhint \"**/*.sol\" --fix",
"lint:check": "pnpm prettier:check && pnpm solhint:check && npx eslint --ext .js .",
"lint:fix": "pnpm prettier:fix && pnpm solhint:fix && npx eslint --ext .js . --fix"
},
Expand Down
7 changes: 4 additions & 3 deletions src/auth/AccessControl.vy
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ implements: IAccessControl


# @dev The default 32-byte admin role.
# @notice If you declare a variable as `public`,
# Vyper automatically generates an `external`
# getter function for the variable.
DEFAULT_ADMIN_ROLE: public(constant(bytes32)) = empty(bytes32)


Expand Down Expand Up @@ -93,9 +96,6 @@ _SUPPORTED_INTERFACES: constant(bytes4[2]) = [


# @dev Returns `True` if `account` has been granted `role`.
# @notice If you declare a variable as `public`,
# Vyper automatically generates an `external`
# getter function for the variable.
hasRole: public(HashMap[bytes32, HashMap[address, bool]])


Expand Down Expand Up @@ -226,6 +226,7 @@ def set_role_admin(role: bytes32, admin_role: bytes32):


@internal
@view
def _check_role(role: bytes32, account: address):
"""
@dev Reverts with a standard message if `account`
Expand Down
3 changes: 3 additions & 0 deletions src/auth/Ownable.vy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@


# @dev Returns the address of the current owner.
# @notice If you declare a variable as `public`,
# Vyper automatically generates an `external`
# getter function for the variable.
owner: public(address)


Expand Down
3 changes: 3 additions & 0 deletions src/auth/Ownable2Step.vy
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@


# @dev Returns the address of the current owner.
# @notice If you declare a variable as `public`,
# Vyper automatically generates an `external`
# getter function for the variable.
owner: public(address)


Expand Down
3 changes: 3 additions & 0 deletions src/extensions/ERC2981.vy
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ _SUPPORTED_INTERFACES: constant(bytes4[2]) = [


# @dev Returns the address of the current owner.
# @notice If you declare a variable as `public`,
# Vyper automatically generates an `external`
# getter function for the variable.
owner: public(address)


Expand Down
Loading
Loading