Skip to content

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

airinterface
Copy link
Collaborator

Pull Request Template

Description

このPRでは2つの変更が追加されています。

  1. Contract内のアドレスと許可のマップでの実行権限の制御から、Hats ProtocolでのRoleベースのPermissionへの変更。

  2. 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のオペレーションができます。
toban

Fixes # (issue/374)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots

If applicable, add screenshots to help explain your problem.

@airinterface airinterface self-assigned this Jun 22, 2025
Copy link

@Copilot Copilot AI left a 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);

@airinterface airinterface requested a review from mashharuki June 23, 2025 12:56
address2Validated,
]);
expect(hasAuthority).to.be.false;
//#YF TODO 権限を剥奪
Copy link
Collaborator Author

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保持アドレスのみができるような感じですが。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants