Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pumpedlunch committed Jul 10, 2023
1 parent 6774b53 commit 382999a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions src/AddressEligibility.sol
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

/*//////////////////////////////////////////////////////////////
Expand Down
74 changes: 37 additions & 37 deletions src/DecentralistEligibility.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand All @@ -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;
}
}
2 changes: 1 addition & 1 deletion test/ERC1155Eligibility.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 382999a

Please sign in to comment.