MerkleDropMinter
contracts/modules/MerkleDropMinter.sol
A minter that enables permissioned mints via Merkle proofs.
Inherits:
Structs
MintInfo
struct MintInfo {
// Start timestamp of sale (in seconds since unix epoch).
uint32 startTime;
// End timestamp of sale (in seconds since unix epoch).
uint32 endTime;
// The affiliate fee in basis points.
uint16 affiliateFeeBPS;
// Whether the mint is paused.
bool mintPaused;
// Sale price in ETH for minting a single token.
uint96 price;
// The maximum number of tokens that can be minted.
uint32 maxMintable;
// The maximum number of tokens that can be minted by an account.
uint32 maxMintablePerAccount;
// The total number of tokens minted.
uint32 totalMinted;
// Hash of the root node for the merkle tree drop.
bytes32 merkleRootHash;
}
Holds information pertaining to a mint.
This struct is intended for off-chain queries, and can be retrieved via the mintInfo
function.
Write Functions
createEditionMint
function createEditionMint(
address edition,
bytes32 merkleRootHash,
uint96 price,
uint32 startTime,
uint32 endTime,
uint16 affiliateFeeBPS,
uint32 maxMintable_,
uint32 maxMintablePerAccount_
) external returns (uint128 mintId)
Initializes merkle drop mint instance.
Calling conditions:
- The caller must be the owner or an adminstrator (via the
ADMIN_ROLE
) of theedition
contract.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
merkleRootHash | bytes32 hash of the Merkle tree representing eligible mints. |
price | Sale price in ETH for minting a single token in edition . |
startTime | Start timestamp of sale (in seconds since unix epoch). |
endTime | End timestamp of sale (in seconds since unix epoch). |
affiliateFeeBPS | The affiliate fee in basis points. |
maxMintable_ | The maximum number of tokens that can can be minted for this sale. |
maxMintablePerAccount_ | The maximum number of tokens that a single account can mint. |
mint
function mint(
address edition,
uint128 mintId,
uint32 requestedQuantity,
bytes32[] calldata merkleProof,
address affiliate
) external payable
Mints a token for a particular mint instance.
Params: | |
---|---|
mintId | The ID of the mint instance. |
requestedQuantity | The quantity of tokens to mint. |
setPrice
function setPrice(
address edition,
uint128 mintId,
uint96 price
) external
Sets the price
for (edition
, mintId
).
Calling conditions:
- The caller must be the owner or an adminstrator (via the
ADMIN_ROLE
) of theedition
contract.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
price | Sale price in ETH for minting a single token in edition . |
setMaxMintablePerAccount
function setMaxMintablePerAccount(
address edition,
uint128 mintId,
uint32 maxMintablePerAccount
) external
Sets the maxMintablePerAccount
for (edition
, mintId
).
Calling conditions:
- The caller must be the owner or an adminstrator (via the
ADMIN_ROLE
) of theedition
contract.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
maxMintablePerAccount | The maximum number of tokens that can be minted by an account. |
setMaxMintable
function setMaxMintable(
address edition,
uint128 mintId,
uint32 maxMintable
) external
Sets the maxMintable
for (edition
, mintId
).
Calling conditions:
- The caller must be the owner or an adminstrator (via the
ADMIN_ROLE
) of theedition
contract.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
maxMintable | The maximum number of tokens that can be minted on this schedule. |
setMerkleRootHash
function setMerkleRootHash(
address edition,
uint128 mintId,
bytes32 merkleRootHash
) external
Sets the merkleRootHash
for (edition
, mintId
).
Calling conditions:
- The caller must be the owner or an adminstrator (via the
ADMIN_ROLE
) of theedition
contract.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
merkleRootHash | The merkle root hash of the entries. |
Read-only Functions
mintInfo
function mintInfo(
address edition,
uint128 mintId
) external view returns (MintInfo memory)
Returns MintInfo
instance containing the full minter parameter set.
Params: | |
---|---|
edition | The edition to get the mint instance for. |
mintId | The ID of the mint instance. |
supportsInterface
IERC165-supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
Returns true
if this contract implements the interface defined by interfaceId
.
See the corresponding EIP section to learn more about how these ids are created.
Params: | |
---|---|
interfaceId | The 4 byte interface ID. |
Supported Interface IDs: | |
---|---|
IERC165 | 0x01ffc9a7 |
IMinterModule | 0x37c74bd8 |
IMerkleDropMinter | 0x89691c4c |
Events
MerkleDropMintCreated
event MerkleDropMintCreated(
address indexed edition,
uint128 indexed mintId,
bytes32 merkleRootHash,
uint96 price,
uint32 startTime,
uint32 endTime,
uint16 affiliateFeeBPS,
uint32 maxMintable,
uint32 maxMintablePerAccount
)
Emitted when a new merkle drop mint is created.
Params: | |
---|---|
edition | The edition address. |
mintId | The mint ID. |
merkleRootHash | The root of the merkle tree of the approved addresses. |
price | The price at which each token will be sold, in ETH. |
startTime | The time minting can begin. |
endTime | The time minting will end. |
affiliateFeeBPS | The affiliate fee in basis points. |
maxMintable | The maximum number of tokens that can be minted. |
maxMintablePerAccount | The maximum number of tokens that an account can mint. |
DropClaimed
event DropClaimed(address recipient, uint32 quantity)
Emitted when tokens are claimed by an account.
Params: | |
---|---|
recipient | The address of the account that claimed the tokens. |
quantity | The quantity of tokens claimed. |
PriceSet
event PriceSet(
address indexed edition,
uint128 indexed mintId,
uint96 price
)
Emitted when the price
is changed for (edition
, mintId
).
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
price | Sale price in ETH for minting a single token in edition . |
MaxMintableSet
event MaxMintableSet(
address indexed edition,
uint128 indexed mintId,
uint32 maxMintable
)
Emitted when the maxMintable
is changed for (edition
, mintId
).
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
maxMintable | The maximum number of tokens that can be minted on this schedule. |
MaxMintablePerAccountSet
event MaxMintablePerAccountSet(
address indexed edition,
uint128 indexed mintId,
uint32 maxMintablePerAccount
)
Emitted when the maxMintablePerAccount
is changed for (edition
, mintId
).
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
maxMintablePerAccount | The maximum number of tokens that can be minted per account. |
MerkleRootHashSet
event MerkleRootHashSet(
address indexed edition,
uint128 indexed mintId,
bytes32 merkleRootHash
)
Emitted when the merkleRootHash
is changed for (edition
, mintId
).
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
merkleRootHash | The merkle root hash of the entries. |
Errors
InvalidMerkleProof
error InvalidMerkleProof()
The merkle proof is invalid.
ExceedsMaxPerAccount
error ExceedsMaxPerAccount()
The number of tokens minted has exceeded the number allowed for each account.
MerkleRootHashIsEmpty
error MerkleRootHashIsEmpty()
The merkle root hash is empty.
MaxMintablePerAccountIsZero
error MaxMintablePerAccountIsZero()
The max mintable per account cannot be zero.