CompoundEligibility is an eligibility module for Hats Protocol. In this module, a Hat can have multiple eligibility criteria. The module has two immutable arguments to add two desired modules that need to be combined. In case you want to combine more than 2 modules, you can use a desired eligibility module as the first argument and a Compound Eligibility module as the second parameter, allowing the association of 2 new modules.
There are two different modules: one for conjunction (AND) and a second one for disjunction (OR).
ERC721Eligibility inherits from the HatsEligibilityModule base contract, from which it receives two major properties:
- It can be cheaply deployed via the HatsModuleFactory minimal proxy factory, and
- It implements the IHatsEligibility interface
A CompoundEligibility instance requires several parameters to be set at deployment, passed to the
HatsModuleFactory.createHatsModule()
function in various ways.
hatId
: The id of the hat to which this the instance will be attached as an eligibility module, passed as itselfEMODULE1
: The address of the first Elegibility module contract to be combined, abi-encoded (packed) and passed as_otherImmutableArgs
EMODULE2
: The address of the second Elegibility module contract to be combined, abi-encoded (packed) and passed as_otherImmutableArgs
The following immutable values will also automatically be set within the instance at deployment:IMPLEMENTATION
: The address of the CompoundEligibility implementation contractHATS
: The address of the Hats Protocol contract
This repo uses Foundry for development and testing. To get started:
- Fork the project
- Install Foundry
- To compile the contracts, run
forge build
- To test, run
forge test
Implementation:
CompoundEligibilityModule: 0x5ea0D0b35197561002f1caAb7d85346fcC8A3b72 DisjunctionEligibilityModule: 0xE7C3CC12A41b4f4f24BA175AEAFc2F7952B03a2b