SemaphoreGatekeeper
A gatekeeper contract which allows users to sign up to MACI only if they can prove they are part of a semaphore group.
Please note that once a identity is used to register, it cannot be used again. This is because we store the nullifier which is hash(secret, groupId)
groupId
uint256 groupId
The group id of the semaphore group
semaphoreContract
contract ISemaphore semaphoreContract
The semaphore contract
maci
address maci
The address of the MACI contract
registeredIdentities
mapping(uint256 => bool) registeredIdentities
The registered identities
ZeroAddress
error ZeroAddress()
Errors
OnlyMACI
error OnlyMACI()
AlreadyRegistered
error AlreadyRegistered()
InvalidGroup
error InvalidGroup()
InvalidProof
error InvalidProof()
constructor
constructor(address _semaphoreContract, uint256 _groupId) public payable
Create a new instance of the gatekeeper
Parameters
Name | Type | Description |
---|---|---|
_semaphoreContract | address | The address of the semaphore contract |
_groupId | uint256 | The group id of the semaphore group |
setMaciInstance
function setMaciInstance(address _maci) public
Adds an uninitialised MACI instance to allow for token signups
Parameters
Name | Type | Description |
---|---|---|
_maci | address | The MACI contract interface to be stored |
register
function register(address, bytes _data) public
Register an user if they can prove they belong to a semaphore group
Throw if the proof is not valid or just complete silently
Parameters
Name | Type | Description |
---|---|---|
address | ||
_data | bytes | The ABI-encoded schemaId as a uint256. |