A Hats Protocol eligibility module that uses an allowlist to determine eligibility.
This module sets up a simple allowlist to determine eligibility for a hat. For a given account (i.e., potential hat wearer), the allowlist stores values for that account's eligibility and standing for the hat. The wearer(s) of the ownerHat
can add or remove accounts from the allowlist. The wearer(s) of the arbitratorHat
can set the standing of accounts.
This module serves as both a "mechanistic" and "humanistic passthrough" eligibility module.
- Wearer(s) of the
ownerHat
can simply add account(s) to the allowlist by callingaddAccount()
oraddAccounts()
. - Wearer(s) of the
ownerHat
can simply remove account(s) from the allowlist by callingremoveAccount()
orremoveAccounts()
. - Wearer(s) of the
arbitratorHat
can simply set the standing of account(s) by callingsetStandingForAccount()
orsetStandingForAccounts()
.
In each of these cases, Hats Protocol will pull eligibility and standing data from the module via getWearerStatus()
. Hats Protocol will not emit an event with any of these eligibility and resulting wearer changes, so front ends pointing only at Hats Protocol events (or the subgraph) will not automatically reflect these changes.
- Wearer(s) of the
ownerHat
can manually revoke an account's hat by callingremoveAccountAndBurnHat()
. - Wearer(s) of the
arbitratorHat
can manually put an account in bad standing and burn their hatsetStandingForAccountAndBurnHat()
.
In these cases, the module pushes eligibility and standing data to Hats Protocol, causing Hats Protocol to emit event(s) reflecting the eligibility and resulting wearer changes. Front ends pointing at Hats Protocol events (or the subgraph) will automatically reflect these changes.
This repo uses Foundry for development and testing. To get started:
- Fork the project
- Install Foundry
- To install dependencies, run
forge install
- To compile the contracts, run
forge build
- To test, run
forge test
This repo also supports contracts compiled via IR. Since compiling all contracts via IR would slow down testing workflows, we only want to do this for our target contract(s), not anything in this test
or script
stack. We accomplish this by pre-compiled the target contract(s) and then loading the pre-compiled artifacts in the test suite.
First, we compile the target contract(s) via IR by runningFOUNDRY_PROFILE=optimized forge build
(ensuring that FOUNDRY_PROFILE is not in our .env file)
Next, ensure that tests are using the DeployOptimized
script, and run forge test
as normal.
See the wonderful Seaport repo for more details and options for this approach.