Skip to content

Commit

Permalink
💥 Add Multi-Role-Based TimelockController Reference Implementation (#…
Browse files Browse the repository at this point in the history
…195)

Signed-off-by: Pascal Marco Caversaccio <[email protected]>
Co-authored-by: Pascal Marco Caversaccio <[email protected]>
  • Loading branch information
cairoeth and pcaversaccio authored Feb 1, 2024
1 parent ad86f8f commit ed49a04
Show file tree
Hide file tree
Showing 23 changed files with 5,870 additions and 151 deletions.
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

0 comments on commit ed49a04

Please sign in to comment.