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
| Name | Type | Description |
|---|---|---|
| name_ | string | Collection name. |
| symbol_ | string | Collection symbol. |
| initialOwner_ | address | Owner allowed to administer the collection. |
| baseURI_ | string | Base URI used by {tokenURI}. |
| royaltyReceiver_ | address | Initial royalty recipient; use the zero address when no royalty is configured. |
| royaltyFeeNumerator_ | uint96 | Initial royalty in basis points. |
| feeCollector_ | address payable | Recipient of ETH paid for primary mints; use zero for a free collection. |
| initialMintPrice_ | uint256 | Price for the first {priceUnitDelta_} token IDs. |
| priceIncrement_ | uint256 | Price added after each complete pricing unit. |
| priceUnitDelta_ | uint256 | Number of token IDs per price level. |
| maxSupply_ | uint256 | Maximum primary NFTs that can ever be minted; use zero for no cap. |
| bonusNumerator_ | uint256 | Numerator of the collection's exact bonus fraction. |
| mintStartTime_ | uint256 | Unix timestamp at which allowlisted users can begin minting. |
| mintEndTime_ | uint256 | Unix timestamp at which all primary mints end; use zero for no deadline. |
| publicMintStartTime_ | uint256 | Unix 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
| Name | Type | Description |
|---|---|---|
| account_ | address | Address whose eligibility is changing. |
| isWhitelisted_ | bool | New eligibility status. |
batchSetWhitelist
function batchSetWhitelist(address[] accounts_, bool isWhitelisted_) external
Updates the eligibility of multiple addresses.
Parameters
| Name | Type | Description |
|---|---|---|
| accounts_ | address[] | Addresses whose eligibility is changing. |
| isWhitelisted_ | bool | New 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
| Name | Type | Description |
|---|---|---|
| account_ | address | Address whose free-mint eligibility is changing. |
| isFreeMintWhitelisted_ | bool | New 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
| Name | Type | Description |
|---|---|---|
| accounts_ | address[] | Addresses whose free-mint eligibility is changing. |
| isFreeMintWhitelisted_ | bool | New 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
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| proof_ | bytes32[] | Sorted Merkle sibling hashes proving the caller is in {merkleRoot}. |
Return Values
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| tokenId_ | uint256 | Token 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
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| merkleRoot_ | bytes32 | Root generated from the eligible addresses. |
setBaseURI
function setBaseURI(string baseURI_) external
Updates the base URI used to resolve token metadata.
Parameters
| Name | Type | Description |
|---|---|---|
| baseURI_ | string | New base URI. |
setRoyalty
function setRoyalty(address receiver_, uint96 feeNumerator_) external
Sets the default marketplace-readable secondary-sale royalty.
Parameters
| Name | Type | Description |
|---|---|---|
| receiver_ | address | Recipient of the royalty payment. |
| feeNumerator_ | uint96 | Royalty 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
| Name | Type | Description |
|---|---|---|
| account_ | address | Address 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
| Name | Type | Description |
|---|---|---|
| tokenId_ | uint256 | Token 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
| Name | Type | Description |
|---|---|---|
| account_ | address | Address 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
| Name | Type | Description |
|---|---|---|
| account_ | address | Address 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.