Sound Protocol
Module Contracts
Minters
EditionMaxMinter

EditionMaxMinter

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

A minimalist fixed-price public minting module. Can implement single-schedule range mints.

Derives the following values from the edition:

  • maxMintableLower
  • maxMintableUpper
  • cutoffTime

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 by an account.
    uint32 maxMintablePerAccount;
    // The lower limit of the maximum number of tokens that can be minted.
    // This is the `editionMaxMintableLower` from the `edition`.
    uint32 maxMintableLower;
    // The upper limit of the maximum number of tokens that can be minted.
    // This is the `editionMaxMintableUpper` from the `edition`.
    uint32 maxMintableUpper;
    // The cutoff timestamp when the maximum number of tokens that can
    // be minted drops from `maxMintableUpper` to `maxMintableLower`.
    // This is the `editionCutoffTime` from the `edition`.
    uint32 cutoffTime;
}

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,
    uint96 price,
    uint32 startTime,
    uint32 endTime,
    uint16 affiliateFeeBPS,
    uint32 maxMintablePerAccount
    ) external returns (uint128 mintId)

Initializes a range 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.
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.
maxMintablePerAccountThe maximum number of tokens that can be minted by an account.

mint

function mint(
    address edition,
    uint128 mintId,
    uint32 quantity,
    address affiliate
    ) external payable

Mints tokens for a given edition.

Params:
editionAddress of the song edition contract we are minting for.
mintIdThe mint ID.
quantityToken quantity to mint in song edition.
affiliateThe affiliate address.

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.

Read-only Functions

mintInfo

function mintInfo(
	address edition,
	uint128 mintId
) external view returns (MintInfo memory)

Returns a 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
IEditionMaxMinter0xa7ea8688

Events

EditionMaxMintCreated

event EditionMaxMintCreated(
    address indexed edition,
    uint128 indexed mintId,
    uint96 price,
    uint32 startTime,
    uint32 endTime,
    uint16 affiliateFeeBPS,
    uint32 maxMintablePerAccount
    )

Emitted when a edition max is created.

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.
startTimeStart timestamp of sale (in seconds since unix epoch).
endTimeEnd timestamp of sale (in seconds since unix epoch).
affiliateFeeBPSThe affiliate fee in basis points.
maxMintablePerAccountThe maximum number of tokens that can be minted per account.

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.

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.

Errors

ExceedsMaxPerAccount

error ExceedsMaxPerAccount()

The number of tokens minted has exceeded the number allowed for each account.

MaxMintablePerAccountIsZero

error MaxMintablePerAccountIsZero()

The max mintable per account cannot be zero.