Skip to main content

OverlayerOriginNFT

Shared implementation for an allowlisted, one-time-mint ERC-721 collection.

Mint eligibility is intentionally local to each chain deployment.

MAX_ROYALTY_BPS​

uint96 MAX_ROYALTY_BPS

Maximum default royalty in basis points.

WHITELIST_MINT_DURATION​

uint256 WHITELIST_MINT_DURATION

Duration of the initial whitelist-only mint phase for tier collections.

whitelisted​

mapping(address => bool) whitelisted

Addresses eligible to mint during whitelist-only phases on this chain.

freeMintWhitelisted​

mapping(address => bool) freeMintWhitelisted

Addresses eligible for a zero-price primary mint on this chain.

Free mints still consume the next sequential token ID and price tier.

hasMinted​

mapping(address => bool) hasMinted

Whether an address has already performed its one primary mint on this chain.

nextTokenId​

uint256 nextTokenId

The ID assigned to the next primary mint.

merkleRoot​

bytes32 merkleRoot

Merkle root for the scalable allowlist; zero disables proof-based mints.

feeCollector​

address payable feeCollector

Wallet receiving ETH paid for primary mints; zero for free collections.

initialMintPrice​

uint256 initialMintPrice

Mint price charged for token IDs in the first pricing unit.

priceIncrement​

uint256 priceIncrement

Price added after every completed pricing unit.

priceUnitDelta​

uint256 priceUnitDelta

Number of token IDs sold at each price level.

maxSupply​

uint256 maxSupply

Maximum number of primary NFTs that can ever be minted; zero disables the cap.

bonusNumerator​

uint256 bonusNumerator

Numerator of the collection's exact bonus fraction.

bonusDenominator​

uint256 bonusDenominator

Denominator of the collection's exact bonus fraction, fixed at 100.

mintStartTime​

uint256 mintStartTime

Unix timestamp at which allowlisted users can begin minting.

mintEndTime​

uint256 mintEndTime

Unix timestamp at which all primary mints end; zero disables the deadline.

publicMintStartTime​

uint256 publicMintStartTime

Unix timestamp at which direct mints become public until {mintEndTime}; zero keeps direct mints allowlisted.

WhitelistUpdated​

event WhitelistUpdated(address account, bool isWhitelisted)

Emitted when an address's allowlist status changes.

FreeMintWhitelistUpdated​

event FreeMintWhitelistUpdated(address account, bool isFreeMintWhitelisted)

Emitted when an address's free-mint eligibility changes.

Minted​

event Minted(address account, uint256 tokenId)

Emitted after an eligible address mints its only primary token.

BaseURIUpdated​

event BaseURIUpdated(string baseURI)

Emitted when the base token URI changes.

RoyaltyUpdated​

event RoyaltyUpdated(address receiver, uint96 feeNumerator)

Emitted when default secondary-sale royalty terms change.

MerkleRootUpdated​

event MerkleRootUpdated(bytes32 merkleRoot)

Emitted when the scalable allowlist root changes.

MintPaymentCollected​

event MintPaymentCollected(address minter, address feeCollector, uint256 amount)

Emitted after a paid primary mint forwards ETH to the fee collector.

MintPaymentRefunded​

event MintPaymentRefunded(address minter, uint256 amount)

Emitted after a paid mint returns excess ETH to the minter.

NotWhitelisted​

error NotWhitelisted()

Reverts when an address is not allowed to mint.

AlreadyMinted​

error AlreadyMinted()

Reverts when an address has already minted from this collection.

ZeroAddress​

error ZeroAddress()

Reverts when an allowlist address is the zero address.

InvalidRoyaltyConfiguration​

error InvalidRoyaltyConfiguration()

Reverts when the royalty receiver and fee are configured inconsistently.

RoyaltyFeeTooHigh​

error RoyaltyFeeTooHigh(uint96 feeNumerator)

Reverts when a royalty fee exceeds the collection maximum.

InvalidMerkleProof​

error InvalidMerkleProof()

Reverts when a caller cannot prove membership in the active Merkle allowlist.

InvalidMintPricing​

error InvalidMintPricing()

Reverts when paid-mint pricing parameters are inconsistent.

InsufficientMintPayment​

error InsufficientMintPayment(uint256 expected, uint256 received)

Reverts when a caller does not provide at least the active mint price.

FeeTransferFailed​

error FeeTransferFailed()

Reverts when the configured fee collector rejects a mint payment.

RefundFailed​

error RefundFailed()

Reverts when returning excess ETH to the minter fails.

InvalidTokenId​

error InvalidTokenId()

Reverts when a caller requests a price for token ID zero.

MaxSupplyReached​

error MaxSupplyReached(uint256 maxSupply)

Reverts when every token ID in the collection has been minted.

MintNotStarted​

error MintNotStarted(uint256 mintStartTime, uint256 currentTime)

Reverts when minting is attempted before {mintStartTime}.

MintEnded​

error MintEnded(uint256 mintEndTime, uint256 currentTime)

Reverts when minting is attempted at or after {mintEndTime}.

InvalidMintSchedule​

error InvalidMintSchedule()

Reverts when a mint-window configuration is internally inconsistent.

constructor​

constructor(string name_, string symbol_, address initialOwner_, string baseURI_, address royaltyReceiver_, uint96 royaltyFeeNumerator_, address payable feeCollector_, uint256 initialMintPrice_, uint256 priceIncrement_, uint256 priceUnitDelta_, uint256 maxSupply_, uint256 bonusNumerator_, uint256 mintStartTime_, uint256 mintEndTime_, uint256 publicMintStartTime_) internal

Parameters​

NameTypeDescription
name_stringCollection name.
symbol_stringCollection symbol.
initialOwner_addressOwner allowed to administer the collection.
baseURI_stringBase URI used by {tokenURI}.
royaltyReceiver_addressInitial royalty recipient; use the zero address when no royalty is configured.
royaltyFeeNumerator_uint96Initial royalty in basis points.
feeCollector_address payableRecipient of ETH paid for primary mints; use zero for a free collection.
initialMintPrice_uint256Price for the first {priceUnitDelta_} token IDs.
priceIncrement_uint256Price added after each complete pricing unit.
priceUnitDelta_uint256Number of token IDs per price level.
maxSupply_uint256Maximum primary NFTs that can ever be minted; use zero for no cap.
bonusNumerator_uint256Numerator of the collection's exact bonus fraction.
mintStartTime_uint256Unix timestamp at which allowlisted users can begin minting.
mintEndTime_uint256Unix timestamp at which all primary mints end; use zero for no deadline.
publicMintStartTime_uint256Unix timestamp at which direct mints become public until {mintEndTime}; use zero for never.

whenMintOpen​

modifier whenMintOpen()

Restricts primary mints to the configured mint window.

setWhitelist​

function setWhitelist(address account_, bool isWhitelisted_) external

Updates one address's eligibility to mint.

Parameters​

NameTypeDescription
account_addressAddress whose eligibility is changing.
isWhitelisted_boolNew eligibility status.

batchSetWhitelist​

function batchSetWhitelist(address[] accounts_, bool isWhitelisted_) external

Updates the eligibility of multiple addresses.

Parameters​

NameTypeDescription
accounts_address[]Addresses whose eligibility is changing.
isWhitelisted_boolNew eligibility status for every address.

setFreeMintWhitelist​

function setFreeMintWhitelist(address account_, bool isFreeMintWhitelisted_) external

Updates one address's zero-price mint eligibility.

Free-mint eligibility also allows direct minting during a whitelist-only phase.

Parameters​

NameTypeDescription
account_addressAddress whose free-mint eligibility is changing.
isFreeMintWhitelisted_boolNew free-mint eligibility status.

batchSetFreeMintWhitelist​

function batchSetFreeMintWhitelist(address[] accounts_, bool isFreeMintWhitelisted_) external

Updates zero-price mint eligibility for multiple addresses.

Free-mint eligibility also allows direct minting during a whitelist-only phase.

Parameters​

NameTypeDescription
accounts_address[]Addresses whose free-mint eligibility is changing.
isFreeMintWhitelisted_boolNew free-mint eligibility status for every address.

mint​

function mint() external payable returns (uint256 tokenId)

Mints the caller's sole primary NFT for this collection on this chain.

Direct mints are allowlisted until {publicMintStartTime}, when configured.

Return Values​

NameTypeDescription
tokenIduint256The newly minted token ID.

mintWithProof​

function mintWithProof(bytes32[] proof_) external payable returns (uint256 tokenId)

Mints the caller's sole primary NFT using a Merkle allowlist proof.

The leaf is keccak256(bytes.concat(keccak256(abi.encode(account)))).

Parameters​

NameTypeDescription
proof_bytes32[]Sorted Merkle sibling hashes proving the caller is in {merkleRoot}.

Return Values​

NameTypeDescription
tokenIduint256The newly minted token ID.

burn​

function burn(uint256 tokenId_) external

Burns a token owned by the caller or for which the caller is approved.

This enables an approved future redemption contract to atomically consume source NFTs.

Parameters​

NameTypeDescription
tokenId_uint256Token ID to burn.

burnBatch​

function burnBatch(uint256[] tokenIds_) external

Burns multiple tokens owned by the caller or for which the caller is approved.

Reverts atomically if any token does not exist or the caller is not authorized for it.

Parameters​

NameTypeDescription
tokenIds_uint256[]Token IDs to burn.

setMerkleRoot​

function setMerkleRoot(bytes32 merkleRoot_) external

Replaces the Merkle root used by {mintWithProof}.

Replacing the root never resets {hasMinted}; set the root to zero to disable proof-based mints.

Parameters​

NameTypeDescription
merkleRoot_bytes32Root generated from the eligible addresses.

setBaseURI​

function setBaseURI(string baseURI_) external

Updates the base URI used to resolve token metadata.

Parameters​

NameTypeDescription
baseURI_stringNew base URI.

setRoyalty​

function setRoyalty(address receiver_, uint96 feeNumerator_) external

Sets the default marketplace-readable secondary-sale royalty.

Parameters​

NameTypeDescription
receiver_addressRecipient of the royalty payment.
feeNumerator_uint96Royalty in basis points.

clearRoyalty​

function clearRoyalty() external

Clears the default marketplace-readable secondary-sale royalty.

pause​

function pause() external

Pauses direct and Merkle allowlist mints.

unpause​

function unpause() external

Resumes direct and Merkle allowlist mints.

mintPrice​

function mintPrice() public view returns (uint256)

Returns the exact ETH amount required to mint the next token ID.

mintPriceForAccount​

function mintPriceForAccount(address account_) public view returns (uint256)

Returns the exact ETH amount an account must pay to mint the next token ID.

A free-mint allowlisted account pays zero but still advances {nextTokenId}.

Parameters​

NameTypeDescription
account_addressAddress requesting the primary mint.

bonus​

function bonus() public view returns (uint256 numerator, uint256 denominator)

Returns the collection's exact bonus fraction.

isPublicMintOpen​

function isPublicMintOpen() public view returns (bool)

Returns whether direct mints are currently open to every address.

mintPriceForTokenId​

function mintPriceForTokenId(uint256 tokenId_) public view returns (uint256)

Returns the price applicable to a given token ID.

IDs 1 through {priceUnitDelta} use {initialMintPrice}; the next unit adds {priceIncrement}.

Parameters​

NameTypeDescription
tokenId_uint256Token ID whose primary mint price is being queried.

isMerkleWhitelisted​

function isMerkleWhitelisted(address account_, bytes32[] proof_) public view returns (bool)

Returns whether an address is included in the active Merkle allowlist.

Parameters​

NameTypeDescription
account_addressAddress whose membership is being checked.
proof_bytes32[]Sorted Merkle sibling hashes for the address.

supportsInterface​

function supportsInterface(bytes4 interfaceId_) public view virtual returns (bool)

See {IERC165-supportsInterface}.

merkleLeaf​

function merkleLeaf(address account_) public pure returns (bytes32)

Computes the double-hashed leaf used by the Merkle allowlist.

Parameters​

NameTypeDescription
account_addressAddress to encode as an allowlist leaf.

_baseURI​

function _baseURI() internal view virtual returns (string)

Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the baseURI and the tokenId. Empty by default, can be overridden in child contracts.