Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contracts): add hats gatekeeper contracts #1191

Merged
merged 8 commits into from Mar 18, 2024

Conversation

spengrah
Copy link
Contributor

Description

Adds two flavors of Hats Protocol-powered gatekeeper contracts:

  • HatsGatekeeperSingle gates registration to wearers of a single configured hat
  • HatsGatekeeperMultiple gates registration to wearers of multiple configured hats

Additional Notes

Inspired by this twitter conversation: https://twitter.com/zkMACI/status/1756077090800050674

Related issue(s)

n/a

Confirmation

Copy link

netlify bot commented Feb 13, 2024

Deploy Preview for maci-typedoc ready!

Name Link
🔨 Latest commit c04a23e
🔍 Latest deploy log https://app.netlify.com/sites/maci-typedoc/deploys/65f8b15c85e42c0008972c8c
😎 Deploy Preview https://deploy-preview-1191--maci-typedoc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ctrlc03 ctrlc03 linked an issue Feb 13, 2024 that may be closed by this pull request
@ctrlc03 ctrlc03 marked this pull request as ready for review February 13, 2024 09:30
@0xmad 0xmad changed the title feat(HatsGatekeepers): add Hats gatekeeper contracts feat(contracts): add hats gatekeeper contracts Feb 13, 2024
Copy link
Collaborator

@0xmad 0xmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spengrah thanks, just few comments.

contracts/contracts/gatekeepers/HatsGatekeepers.sol Outdated Show resolved Hide resolved
contracts/tests/HatsGatekeeper.test.ts Outdated Show resolved Hide resolved
contracts/tests/HatsGatekeeper.test.ts Outdated Show resolved Hide resolved
contracts/package.json Outdated Show resolved Hide resolved
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slither found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@samajammin
Copy link
Collaborator

Collabs in public FTW! Thanks for this @spengrah 🤝🏆

Copy link
Collaborator

@0xmad 0xmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spengrah thanks!

@0xmad
Copy link
Collaborator

0xmad commented Feb 16, 2024

@spengrah could you rebase the branch please?

Copy link
Collaborator

@kittybest kittybest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it looks awesome!

contracts/contracts/interfaces/IHats.sol Outdated Show resolved Hide resolved
contracts/contracts/mocks/MockHatsProtocol.sol Outdated Show resolved Hide resolved
contracts/tests/HatsGatekeeper.test.ts Outdated Show resolved Hide resolved
auto-merge was automatically disabled March 11, 2024 19:43

Head branch was pushed to by a user without write access

@ctrlc03 ctrlc03 force-pushed the hats-gatekeeper branch 3 times, most recently from abc8b53 to 65eaaae Compare March 12, 2024 09:36
Adds two flavors of Hats Protocol-powered gatekeeper contracts:

- `*Single` gates registration to wearers of a single hat
- `*Multiple` gates registration to wearers of multiple hats.
Adds new lines in tests per @0xmad suggestion
…suggestion

Breaks HatsGatekeepers.sol into multiple files to conform to solhint style guide. Also:

- Adds IHats interface
- Adds HatsGatekeeperBase abstract contract for common elements
Prevents MACI address from being set to the zero address
Applies the following changes as suggested:
- MockHatsProtocol inherits from IHats
- fixed several natspec typos
Correctly deploy contracts in tests
Adds `tx.wait()` to each test call that doesn't return a value
@ctrlc03 ctrlc03 enabled auto-merge March 18, 2024 21:28
@ctrlc03 ctrlc03 merged commit 0817d62 into privacy-scaling-explorations:dev Mar 18, 2024
18 checks passed
Copy link

gitpoap-bot bot commented Mar 18, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 MACI Contributor:

GitPOAP: 2024 MACI Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HatsProtocol gatekeeper
5 participants