Skip to content

Commit

Permalink
re-label "criterion" as "controller"
Browse files Browse the repository at this point in the history
  • Loading branch information
spengrah committed Sep 11, 2024
1 parent 2e5e867 commit 167bfd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/HatControlledModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ contract HatControlledModule is HatsEligibilityModule, HatsToggleModule {
* 0 | IMPLEMENTATION | address | 20 | HatsModule |
* 20 | HATS | address | 20 | HatsModule |
* 40 | hatId | uint256 | 32 | HatsModule |
* 72 | CRITERION_HAT | uint256 | 32 | PassthroughModule |
* 72 | CONTROLLER_HAT | uint256 | 32 | HatControlledModule |
* ----------------------------------------------------------------------+
*/
function CRITERION_HAT() public pure returns (uint256) {
function CONTROLLER_HAT() public pure returns (uint256) {
return _getArgUint256(72);
}

Expand Down Expand Up @@ -158,7 +158,7 @@ contract HatControlledModule is HatsEligibilityModule, HatsToggleModule {

/// @notice Reverts if the caller is not wearing the {hatId} hat
modifier onlyController() {
if (!HATS().isWearerOfHat(msg.sender, CRITERION_HAT())) revert NotAuthorized();
if (!HATS().isWearerOfHat(msg.sender, CONTROLLER_HAT())) revert NotAuthorized();
_;
}
}
12 changes: 6 additions & 6 deletions test/HatControlledModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract HatControlledModuleTest is Deploy, Test {

uint256 public tophat;
uint256 public targetHat;
uint256 public criterionHat;
uint256 public controllerHat;

address public caller;
address public controller = makeAddr("controller");
Expand Down Expand Up @@ -53,11 +53,11 @@ contract WithInstanceTest is HatControlledModuleTest {
tophat = HATS.mintTopHat(org, "org's tophat", "");
vm.startPrank(org);
targetHat = HATS.createHat(tophat, "target hat", 2, address(999), address(999), true, "");
criterionHat = HATS.createHat(tophat, "criterion hat", 2, address(999), address(999), true, "");
HATS.mintHat(criterionHat, controller);
controllerHat = HATS.createHat(tophat, "controller hat", 2, address(999), address(999), true, "");
HATS.mintHat(controllerHat, controller);
vm.stopPrank();

otherImmutableArgs = abi.encodePacked(criterionHat);
otherImmutableArgs = abi.encodePacked(controllerHat);
initArgs;

instance = HatControlledModule(
Expand Down Expand Up @@ -103,8 +103,8 @@ contract Deployment is WithInstanceTest {
assertEq(instance.hatId(), 0);
}

function test_criterionHat() public view {
assertEq(instance.CRITERION_HAT(), criterionHat);
function test_controllerHat() public view {
assertEq(instance.CONTROLLER_HAT(), controllerHat);
}
}

Expand Down

0 comments on commit 167bfd7

Please sign in to comment.