HatsModule is a base contract for creating modules and hatter contracts for Hats Protocol. Such modules are designed to be deployed as minimal proxy clones (with immutable args) via the included HatsModuleFactory.
A HatsModule is a simple contract designed to be inherited by contracts that implement specific functionality for Hats Protocol. It exposes several functions for reading immutable storage related to the module:
IMPLEMENTATION()
: The address of the implementation contract of which the module is a clone.HATS()
: The address of the Hats Protocol contract.hatId()
: The ID of the hat that the module is associated with. This could be 0 if the module is not associated with any hat.version()
: The version of the module.
An abstract contract that inherits from HatsModule and implements the IHatsEligibility interface. This contract is designed to be inherited by contracts that implement eligibility logic for Hats Protocol.
An abstract contract that inherits from HatsModule and implements the IHatsToggle interface. This contract is designed to be inherited by contracts that implement toggle logic for Hats Protocol.
The HatsModuleFactory is a contract that deploys minimal proxy clones of HatsModules. It deploys clones of an implementation contract with customizable immutable args, and initializes the clones with the setUp
function of the implementation contract.