MintPass

Git Source

Inherits: EIP712

Author: fx(hash)

Extension for claiming tokens through mint passes

State Variables

reserveNonce

Mapping of token address to reserve ID to reserve nonce

mapping(address => mapping(uint256 => uint256)) public reserveNonce;

signingAuthorities

Mapping of token address to reserve ID to address of mint pass authority

mapping(address => mapping(uint256 => address)) public signingAuthorities;

Functions

constructor

Initializes EIP-712

constructor() EIP712("MINT_PASS", "1");

generateTypedDataHash

Generates the typed data hash for a mint pass claim

function generateTypedDataHash(
    address _token,
    uint256 _reserveId,
    uint256 _reserveNonce,
    uint256 _index,
    address _claimer
) public view returns (bytes32);

Parameters

NameTypeDescription
_tokenaddressaddress of token for the reserve
_reserveIduint256Id of the reserve to mint the token from
_reserveNonceuint256
_indexuint256Index of the mint pass
_claimeraddressAddress of mint pass claimer

Returns

NameTypeDescription
<none>bytes32Digest of typed data hash claimer

_claimMintPass

Validates a mint pass claim

function _claimMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _index,
    address _claimer,
    bytes calldata _signature,
    LibBitmap.Bitmap storage _bitmap
) internal;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve
_indexuint256Index of the mint pass
_claimeraddressAccount associated with the mint pass
_signaturebytesSignature of the mint pass claimer
_bitmapLibBitmap.BitmapBitmap used for checking if index is already claimed

Events

PassClaimed

Event emitted when mint pass is claimed

event PassClaimed(address indexed _token, uint256 indexed _reserveId, address indexed _claimer, uint256 _index);

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_reserveIduint256ID of the reserve
_claimeraddressAddress of the mint pass claimer
_indexuint256Index of purchase info inside the BitMap

Errors

InvalidSignature

Error thrown when the signature of mint pass claimer is invalid

error InvalidSignature();

PassAlreadyClaimed

Error thrown when a mint pass has already been claimed

error PassAlreadyClaimed();