Skip to main content
Version: v1.3_alpha

SignUpTokenGatekeeper

This contract allows to gatekeep MACI signups by requiring new voters to own a certain ERC721 token

token

contract SignUpToken token

the reference to the SignUpToken contract

maci

address maci

the reference to the MACI contract

registeredTokenIds

mapping(uint256 => bool) registeredTokenIds

a mapping of tokenIds to whether they have been used to sign up

AlreadyRegistered

error AlreadyRegistered()

custom errors

NotTokenOwner

error NotTokenOwner()

OnlyMACI

error OnlyMACI()

constructor

constructor(contract SignUpToken _token) public payable

creates a new SignUpTokenGatekeeper

Parameters

NameTypeDescription
_tokencontract SignUpTokenthe address of the SignUpToken contract

setMaciInstance

function setMaciInstance(address _maci) public

Adds an uninitialised MACI instance to allow for token signups

Parameters

NameTypeDescription
_maciaddressThe MACI contract interface to be stored

register

function register(address _user, bytes _data) public

Registers the user if they own the token with the token ID encoded in _data. Throws if the user does not own the token or if the token has already been used to sign up.

Parameters

NameTypeDescription
_useraddressThe user's Ethereum address.
_databytesThe ABI-encoded tokenId as a uint256.