-
Notifications
You must be signed in to change notification settings - Fork 4
feat(contract): Feature/issue 374 role hat integration via Hat protocol instead of authority in module contract #378
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates role-based permissions via the Hats Protocol by replacing the old authority mapping in contracts and tests with new "Toban" mechanisms and updated module deployment flows. Key changes include:
- Introducing helper functions (createHat) in tests to create role hats like OperatorToban, TimeFrameToban and HatCreatorToban.
- Removing the Ownerable extension from the HatsTimeFrameModule and HatsHatCreatorModule contracts.
- Updating contract deployment logic (BigBang and BigBang_Mock_v2) and test setups to use role hat IDs in place of owner addresses.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
pkgs/contract/test/SplitsCreator.ts | Adds helper function and adjusts test initialization using role hat IDs. |
pkgs/contract/test/HatsTimeFrameModule.ts | Updates test setup to create role hats and align initialization data with the new pattern. |
pkgs/contract/test/HatsHatCreatorModule.ts | Refactors hat creation tests and authority checks to use role hat IDs. |
pkgs/contract/test/BigBang.ts | Updates logging and comments; deactivates upgrade tests. |
pkgs/contract/helpers/deploy/Hats.ts | Removes the tmpOwner parameter from contract deployment transactions. |
pkgs/contract/contracts/hatsmodules/timeframe/HatsTimeFrameModule.sol | Removes Ownable inheritance and updates initialization for TimeFrame Toban ID. |
pkgs/contract/contracts/hatsmodules/hatcreator/HatsHatCreatorModule.sol | Removes Ownerable inheritance and updates initialization for Creator Toban ID. |
pkgs/contract/contracts/bigbang/*.sol | Updates role hat creation and module deployment logic in BigBang contracts. |
docs/puml/class-v2.puml | Updates UML class diagram inheritance to reflect removal of Ownable. |
Comments suppressed due to low confidence (3)
pkgs/contract/test/HatsHatCreatorModule.ts:231
- The revoking authority test block is commented out. Please ensure that tests for revoking create hat authority are re-enabled or properly addressed before merging.
//#YF TODO 権限を剥奪
pkgs/contract/test/HatsHatCreatorModule.ts:259
- In the 'create hat with authority' test, the mintHat call now uses { account: address1.account } instead of the granted authority account (address2.account). Verify that this change is intentional.
{ account: address1.account },
pkgs/contract/helpers/deploy/Hats.ts:57
- The return value of getDeployTransaction is no longer assigned to a variable, yet its data is later referenced. Consider assigning the transaction result to a variable to avoid undefined behavior during deployment.
await HatsTimeFrameModuleFactory.getDeployTransaction(version);
address2Validated, | ||
]); | ||
expect(hasAuthority).to.be.false; | ||
//#YF TODO 権限を剥奪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yu23ki14 さん、ここの実装はどのようにしましょうか?Hats ProtocolのrenounceはHat保持アドレスのみができるような感じですが。
Pull Request Template
Description
このPRでは2つの変更が追加されています。
Contract内のアドレスと許可のマップでの実行権限の制御から、Hats ProtocolでのRoleベースのPermissionへの変更。
HatsHatCreator と TimeFrame のスマートコントラクトから、 Ownerable のExtensionの破棄。
2つのスマートコントラクトのアドレスをOwnerが持っているかは関係なくなるので、
その機能をなくしました。
追加されたToban(Role)
1. Operator Toban
すべてのロールの権限をもてるToban.
2. Creator Toban
HatCreatorのHatのOperationができるToban
3. Role Toban
TimeFrame のOperationができるToban
下記の図でいくと、Address1のホルダーはTimeFrame,HatCratorのオペレーションができます。

Fixes # (issue/374)
Type of change
Please delete options that are not relevant.
Screenshots
If applicable, add screenshots to help explain your problem.