diff --git a/.gitmodules b/.gitmodules index f3f4d3e..8d6beed 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ +[submodule "lib/hats-module"] + path = lib/hats-module + url = https://github.com/hats-protocol/hats-module [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std -[submodule "lib/hats-module"] - path = lib/hats-module - url = https://github.com/Hats-Protocol/hats-module [submodule "lib/multi-claims-hatter"] path = lib/multi-claims-hatter - url = https://github.com/Hats-Protocol/multi-claims-hatter + url = https://github.com/hats-protocol/multi-claims-hatter diff --git a/lib/forge-std b/lib/forge-std index 74cfb77..1714bee 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 74cfb77e308dd188d2f58864aaf44963ae6b88b1 +Subproject commit 1714bee72e286e73f76e320d110e0eaf5c4e649d diff --git a/lib/hats-module b/lib/hats-module index 38f80ee..e83bd72 160000 --- a/lib/hats-module +++ b/lib/hats-module @@ -1 +1 @@ -Subproject commit 38f80eed6ce444f924f5982858daf75e724be6f9 +Subproject commit e83bd72cb3eebdbeadabcb63e3c6f69ab61a5562 diff --git a/lib/multi-claims-hatter b/lib/multi-claims-hatter index 9f745b8..eb04a28 160000 --- a/lib/multi-claims-hatter +++ b/lib/multi-claims-hatter @@ -1 +1 @@ -Subproject commit 9f745b804f2fe3f2b45bf0a2d71b2b7cde03f4ce +Subproject commit eb04a28a75c90d7aa7a00c3ec060a37760d27d12 diff --git a/src/AgreementEligibility.sol b/src/AgreementEligibility.sol index e6aa312..aca89e0 100644 --- a/src/AgreementEligibility.sol +++ b/src/AgreementEligibility.sol @@ -218,8 +218,9 @@ contract AgreementEligibility is HatsEligibilityModule { // set bad standing in this contract _badStandings[_wearer] = true; - // revoke _wearer's hat and set their standing to false in Hats.sol - HATS().setHatWearerStatus(hatId(), _wearer, false, false); + // revoke _wearer's hat and set their standing to false in Hats.sol. We use the pull pattern (checkHatWearerStatus) + // rather than the push pattern (setHatWearerStatus) for compatibility with module chains. + HATS().checkHatWearerStatus(hatId(), _wearer); /** * @dev Hats.sol will emit the following events: @@ -236,7 +237,9 @@ contract AgreementEligibility is HatsEligibilityModule { function forgive(address _wearer) public onlyArbitrator { _badStandings[_wearer] = false; - HATS().setHatWearerStatus(hatId(), _wearer, true, true); + // return the wearer to good standing in Hats.sol. We use the pull pattern (checkHatWearerStatus) rather than the + // push pattern (setHatWearerStatus) for compatibility with module chains. + HATS().checkHatWearerStatus(hatId(), _wearer); /// @dev Hats.sol will emit a Hats.WearerStandingChanged event } diff --git a/test/AgreementEligibility.t.sol b/test/AgreementEligibility.t.sol index 95edc96..adf1612 100644 --- a/test/AgreementEligibility.t.sol +++ b/test/AgreementEligibility.t.sol @@ -25,7 +25,7 @@ contract AgreementEligibilityTest is Deploy, Test { // bytes32 public SALT; uint256 public fork; - uint256 public BLOCK_NUMBER = 18_265_713; + uint256 public BLOCK_NUMBER = 19_467_227; // deployment block for HatsModuleFactory v0.7.0 IHats public constant HATS = IHats(0x3bc1A0Ad72417f2d411118085256fC53CBdDd137); // v1.hatsprotocol.eth string public FACTORY_VERSION = "factory test version"; @@ -54,7 +54,8 @@ contract WithInstanceTest is AgreementEligibilityTest { ClaimableFor } - HatsModuleFactory public factory; + HatsModuleFactory public factory = HatsModuleFactory(0x0a3f85fa597B6a967271286aA0724811acDF5CD9); + uint256 public constant SALT_NONCE = 1; AgreementEligibility public instance; MultiClaimsHatter public claimsHatter; @@ -90,7 +91,7 @@ contract WithInstanceTest is AgreementEligibilityTest { initData = abi.encode(_ownerHat, _arbitratorHat, _agreement); // deploy the instance return AgreementEligibility( - deployModuleInstance(factory, address(implementation), _claimableHat, otherImmutableArgs, initData) + deployModuleInstance(factory, address(implementation), _claimableHat, otherImmutableArgs, initData, SALT_NONCE) ); } @@ -103,7 +104,9 @@ contract WithInstanceTest is AgreementEligibilityTest { initData = abi.encode(_claimableHats, _claimTypes); // deploy the instance return MultiClaimsHatter( - deployModuleInstance(factory, address(0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9), _hatId, "", initData) + deployModuleInstance( + factory, address(0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9), _hatId, "", initData, SALT_NONCE + ) ); } @@ -145,35 +148,35 @@ contract WithInstanceTest is AgreementEligibilityTest { } contract Deployment is WithInstanceTest { - function test_version() public { + function test_version() public view { assertEq(instance.version(), MODULE_VERSION); } - function test_implementation() public { + function test_implementation() public view { assertEq(address(instance.IMPLEMENTATION()), address(implementation)); } - function test_hats() public { + function test_hats() public view { assertEq(address(instance.HATS()), address(HATS)); } - function test_claimableHat() public { + function test_claimableHat() public view { assertEq(instance.hatId(), claimableHat); } - function test_ownerHat() public { + function test_ownerHat() public view { assertEq(instance.ownerHat(), tophat); } - function test_arbitratorHat() public { + function test_arbitratorHat() public view { assertEq(instance.arbitratorHat(), arbitratorHat); } - function test_agreement() public { + function test_agreement() public view { assertEq(instance.currentAgreement(), agreement); } - function test_agreementId() public { + function test_agreementId() public view { assertEq(instance.currentAgreementId(), 1); } }