diff --git a/README.md b/README.md index 3d020ea..e36b18b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ HatsEligibilityModules is a repo containing a number of separate eligility modul - ERC721Eligibility: checks if addresses meet a minimum balance of an ERC721 token - ERC1155Eligibility: checks if addresses holds at least one minimum balance of a set of ERC1155 token Ids -All contracts are based on the Hats Protocol's [hats-module repo](https://github.com/Hats-Protocol/hats-module) +All contracts are based on the Hats Protocol's repo: [hats-module](https://github.com/Hats-Protocol/hats-module) ## Development diff --git a/src/AddressEligibility.sol b/src/AddressEligibility.sol index 2b39f29..4a825e1 100644 --- a/src/AddressEligibility.sol +++ b/src/AddressEligibility.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import { HatsEligibilityModule, HatsModule } from "hats-module/HatsEligibilityModule.sol"; +import {HatsEligibilityModule, HatsModule} from "hats-module/HatsEligibilityModule.sol"; /** * @title AddressEligibility @@ -112,7 +112,9 @@ contract AddressEligibility is HatsEligibilityModule { * @notice makes addresses eligible * @param _addresses array of addresses to make eligible */ - function addEligibleAddresses(address[] calldata _addresses) external onlyHatAdmin hatIsMutable { + function addEligibleAddresses( + address[] calldata _addresses + ) external onlyHatAdmin hatIsMutable { uint len = _addresses.length; for (uint i = 0; i < len; i++) { isEligible[_addresses[i]] = true; @@ -142,7 +144,7 @@ contract AddressEligibility is HatsEligibilityModule { * @dev Returns whether this instance of ERC721Eligibility's hatId is mutable */ function _hatIsMutable() internal view returns (bool _isMutable) { - (,,,,,,, _isMutable,) = HATS().viewHat(hatId()); + (, , , , , , , _isMutable, ) = HATS().viewHat(hatId()); } /*////////////////////////////////////////////////////////////// diff --git a/src/DecentralistEligibility.sol b/src/DecentralistEligibility.sol index 50cc169..82b4eb7 100644 --- a/src/DecentralistEligibility.sol +++ b/src/DecentralistEligibility.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.18; // import { console2 } from "forge-std/Test.sol"; // remove before deploy -import { HatsEligibilityModule, HatsModule } from "hats-module/HatsEligibilityModule.sol"; +import {HatsEligibilityModule, HatsModule} from "hats-module/HatsEligibilityModule.sol"; import {DecentralistInterface} from "decentralist/DecentralistInterface.sol"; /** @@ -12,51 +12,51 @@ import {DecentralistInterface} from "decentralist/DecentralistInterface.sol"; */ contract DecentralistEligibility is HatsEligibilityModule { - /*////////////////////////////////////////////////////////////// + /*////////////////////////////////////////////////////////////// PUBLIC CONSTANTS //////////////////////////////////////////////////////////////*/ - /** - * See: https://github.com/Hats-Protocol/hats-module/blob/main/src/HatsModule.sol - * --------------------------------------------------------------------+ - * CLONE IMMUTABLE "STORAGE" | - * --------------------------------------------------------------------| - * Offset | Constant | Type | Length | | - * --------------------------------------------------------------------| - * 0 | IMPLEMENTATION | address | 20 | | - * 20 | HATS | address | 20 | | - * 40 | hatId | uint256 | 32 | | - * 72 | LIST_ADDRESS | address | 20 | | - * --------------------------------------------------------------------+ - */ - - /// The address of the ERC20 contract used to check eligibility - function LIST_ADDRESS() public pure returns (address) { - return _getArgAddress(72); - } - - /*////////////////////////////////////////////////////////////// + /** + * See: https://github.com/Hats-Protocol/hats-module/blob/main/src/HatsModule.sol + * --------------------------------------------------------------------+ + * CLONE IMMUTABLE "STORAGE" | + * --------------------------------------------------------------------| + * Offset | Constant | Type | Length | | + * --------------------------------------------------------------------| + * 0 | IMPLEMENTATION | address | 20 | | + * 20 | HATS | address | 20 | | + * 40 | hatId | uint256 | 32 | | + * 72 | LIST_ADDRESS | address | 20 | | + * --------------------------------------------------------------------+ + */ + + /// The address of the ERC20 contract used to check eligibility + function LIST_ADDRESS() public pure returns (address) { + return _getArgAddress(72); + } + + /*////////////////////////////////////////////////////////////// INITIALIZER //////////////////////////////////////////////////////////////*/ - function setUp(bytes calldata _initData) public override initializer { - //not used currently TODO: delete? - } + function setUp(bytes calldata _initData) public override initializer { + //not used currently TODO: delete? + } - /*////////////////////////////////////////////////////////////// + /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ - constructor(string memory _version) HatsModule(_version) { } + constructor(string memory _version) HatsModule(_version) {} - /*////////////////////////////////////////////////////////////// + /*////////////////////////////////////////////////////////////// HATS ELIGIBILITY FUNCTION //////////////////////////////////////////////////////////////*/ - /// - function getWearerStatus( - address _wearer, - uint256 /*_hatId */ - ) override public view returns (bool eligible, bool standing) { - eligible = DecentralistInterface(LIST_ADDRESS()).onList(_wearer); - - standing = true; - } + /// + function getWearerStatus( + address _wearer, + uint256 /*_hatId */ + ) public view override returns (bool eligible, bool standing) { + eligible = DecentralistInterface(LIST_ADDRESS()).onList(_wearer); + + standing = true; + } } diff --git a/test/ERC1155Eligibility.t.sol b/test/ERC1155Eligibility.t.sol index a58d1e1..1ab50b4 100644 --- a/test/ERC1155Eligibility.t.sol +++ b/test/ERC1155Eligibility.t.sol @@ -12,7 +12,7 @@ contract MintableERC1155 is ERC1155 { function mint(address to, uint256 tokenId, uint256 amount) public { _mint(to, tokenId, amount, ""); } -} +}F contract ERC1155EligibilityTest is Deploy, Test { string public FACTORY_VERSION = "factory test version";