Sound Protocol
Module Contracts
Minters
MerkleDropMinter

MerkleDropMinter

contracts/modules/MerkleDropMinter.sol (opens in a new tab)

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 the edition contract.
Params:
editionAddress of the song edition contract we are minting for.
merkleRootHashbytes32 hash of the Merkle tree representing eligible mints.
priceSale price in ETH for minting a single token in edition.
startTimeStart timestamp of sale (in seconds since unix epoch).
endTimeEnd timestamp of sale (in seconds since unix epoch).
affiliateFeeBPSThe 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:
mintIdThe ID of the mint instance.
requestedQuantityThe 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 the edition contract.
Params:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
priceSale 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 the edition contract.
Params:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
maxMintablePerAccountThe 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 the edition contract.
Params:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
maxMintableThe 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 the edition contract.
Params:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
merkleRootHashThe 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:
editionThe edition to get the mint instance for.
mintIdThe 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 (opens in a new tab) to learn more about how these ids are created.

Params:
interfaceIdThe 4 byte interface ID.
Supported Interface IDs:
IERC1650x01ffc9a7
IMinterModule0x37c74bd8
IMerkleDropMinter0x89691c4c

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:
editionThe edition address.
mintIdThe mint ID.
merkleRootHashThe root of the merkle tree of the approved addresses.
priceThe price at which each token will be sold, in ETH.
startTimeThe time minting can begin.
endTimeThe time minting will end.
affiliateFeeBPSThe affiliate fee in basis points.
maxMintableThe maximum number of tokens that can be minted.
maxMintablePerAccountThe 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:
recipientThe address of the account that claimed the tokens.
quantityThe 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:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
priceSale 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:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
maxMintableThe 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:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
maxMintablePerAccountThe 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:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
merkleRootHashThe 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.