A Hats Protocol Module that determines eligibility for a hat based on ownership of the most recently auctioned NFT for a DAO using the Nouns Builder V2 framework.
Nounish DAOs auction off a new NFT automatically on a regular, periodic basis (often daily). Nounish DAOs can use this module to automatically assign eligibility for a given hat to the owner of the NFT that was most recently auctioned off.
An account is considered the owner of the most recently auctioned NFT (and therefore eligible) if the following are true:
- The account is the current owner of the NFT
- The auction for their NFT has been settled
- No subsequent auctions have been settled
Additionally...
- If a subsequent auction has been settled without a winner (e.g. because there were no valid bids) then no account is considered eligible.
- If the subsequent auction(s) was skipped for founder tokens, then the account that owns that last actually-auctioned NFT is considered eligible.
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.