Sound Protocol
Core Contracts
IMinterModule

IMinterModule

contracts/core/interfaces/IMinterModule.sol (opens in a new tab)

This interface is specific for the minter modules used by sound.xyz.

If you are building contracts to interact with the minter modules, this may be of convenience.

If you are building your own minters, it is not mandatory implement this interface.

Inherits:

Structs

BaseData

struct BaseData {
    // The start unix timestamp of the mint.
    uint32 startTime;
    // The end unix timestamp of the mint.
    uint32 endTime;
    // The affiliate fee in basis points.
    uint16 affiliateFeeBPS;
    // Whether the mint is paused.
    bool mintPaused;
}

Used for internal storage of data pertaining to mints.

Write Functions

setEditionMintPaused

function setEditionMintPaused(
    address edition,
    uint128 mintId,
    bool paused
) external

Sets the paused status for (edition, mintId).

Calling conditions:

  • The caller must be the edition's owner or admin.
Params:
editionThe edition address.
mintIdThe mint ID, a global incrementing identifier used within the minter
pausedWhether the mint is paused.

setTimeRange

function setTimeRange(
    address edition,
    uint128 mintId,
    uint32 startTime,
    uint32 endTime
) external

Sets the time range for an edition mint.

Calling conditions:

  • The caller must be the edition's owner or admin.
Params:
editionThe edition address.
mintIdThe mint ID, a global incrementing identifier used within the minter
startTimeThe start time of the mint.
endTimeThe end time of the mint.

setAffiliateFee

function setAffiliateFee(
    address edition,
    uint128 mintId,
    uint16 affiliateFeeBPS
) external

Sets the affiliate fee for (edition, mintId).

Calling conditions:

  • The caller must be the edition's owner or admin.
Params:
editionThe edition address.
mintIdThe mint ID, a global incrementing identifier used within the minter
affiliateFeeBPSThe affiliate fee in basis points.

withdrawForAffiliate

function withdrawForAffiliate(address affiliate) external

Withdraws all the accrued fees for affiliate.

Params:
affiliateThe affiliate's address.

withdrawForPlatform

function withdrawForPlatform() external

Withdraws all the accrued fees for the platform.

Read-only Functions

affiliateFeesAccrued

function affiliateFeesAccrued(address affiliate) external view returns (uint128)

The total fees accrued for affiliate.

Params:
affiliateThe affiliate's address.

platformFeesAccrued

function platformFeesAccrued() external view returns (uint128)

The total fees accrued for the platform.

isAffiliated

function isAffiliated(
    address edition,
    uint128 mintId,
    address affiliate
) external view returns (bool)

Whether affiliate is affiliated for (edition, mintId).

Params:
editionThe edition's address.
mintIdThe mint ID.
affiliateThe affiliate's address.

totalPrice

function totalPrice(
    address edition,
    uint128 mintId,
    address minter,
    uint32 quantity
) external view returns (uint128)

The total price for quantity tokens for (edition, mintId).

Params:
editionThe edition's address.
mintIdThe mint ID.
mintIdThe minter's address.
quantityThe number of tokens to mint.

nextMintId

function nextMintId() external view returns (uint128)

The next mint ID. A mint ID is assigned sequentially starting from (0, 1, 2, ...), and is shared amongst all editions connected to the minter contract.

moduleInterfaceId

function moduleInterfaceId() external view returns (bytes4)

The interface ID of the minter.

feeRegistry

function feeRegistry() external view returns (ISoundFeeRegistry)

The fee registry. Used for handling platform fees.

Events

MintConfigCreated

event MintConfigCreated(
    address indexed edition,
    address indexed creator,
    uint128 mintId,
    uint32 startTime,
    uint32 endTime,
    uint16 affiliateFeeBPS
    )

Emitted when the mint instance for an edition is created.

Params:
editionThe edition address.
mintIdThe mint ID, a global incrementing identifier used within the minter
startTimeThe start time of the mint.
endTimeThe end time of the mint.
affiliateFeeBPSThe affiliate fee in basis points.

MintPausedSet

event MintPausedSet(address indexed edition, uint128 mintId, bool paused)

Emitted when the paused status of edition is updated.

Params:
editionThe edition address.
mintIdThe mint ID, to distinguish between multiple mints for the same edition.
pausedThe new paused status.

TimeRangeSet

event TimeRangeSet(address indexed edition, uint128 indexed mintId, uint32 startTime, uint32 endTime)

Emitted when the paused status of edition is updated.

Params:
editionThe edition address.
mintIdThe mint ID, to distinguish between multiple mints for the same edition.
startTimeThe start time of the mint.
endTimeThe end time of the mint.

AffiliateFeeSet

Emitted when the affiliateFeeBPS is updated.

event AffiliateFeeSet(address indexed edition, uint128 indexed mintId, uint16 bps)
Params:
editionThe edition address.
mintIdThe mint ID, to distinguish between multiple mints for the same edition.
bpsThe affiliate fee basis points.

Minted

Emitted when a mint happens.

event Minted(
    address indexed edition,
    uint128 indexed mintId,
    address indexed buyer,
    uint32 fromTokenId,
    uint32 quantity,
    uint128 requiredEtherValue,
    uint128 platformFee,
    uint128 affiliateFee,
    address affiliate,
    bool affiliated
    )
Params:
editionThe edition address.
mintIdThe mint ID, to distinguish between multiple mints for the same edition.
buyerThe buyer address.
fromTokenIdThe first token ID of the batch.
quantityThe size of the batch.
requiredEtherValueTotal amount of Ether required for payment.
platformFeeThe cut paid to the platform.
affiliateFeeThe cut paid to the affiliate.
affiliateThe affiliate's address.
affiliatedWhether the affiliate is affiliated.

Errors

Underpaid

error Underpaid(uint256 paid, uint256 required)

The Ether value paid is below the value required.

Params:
paidThe amount sent to the contract.
requiredThe amount required to mint.

ExceedsAvailableSupply

error ExceedsAvailableSupply(uint32 available)

The number minted has exceeded the max mintable amount.

Params:
availableThe number of tokens remaining available for mint.

MintNotOpen

error MintNotOpen(uint256 blockTimestamp, uint32 startTime, uint32 endTime)

The mint is not opened.

Params:
blockTimestampThe current block timestamp.
startTimeThe start time of the mint.
endTimeThe end time of the mint.

MintPaused

error MintPaused()

The mint is paused. error MintPaused();

InvalidTimeRange

error InvalidTimeRange()

The startTime is not less than the endTime.

Unauthorized

error Unauthorized()

Unauthorized caller error Unauthorized();

InvalidAffiliateFeeBPS

error InvalidAffiliateFeeBPS()

The affiliate fee numerator must not exceed MAX_BPS.

FeeRegistryIsZeroAddress

error FeeRegistryIsZeroAddress()

Fee registry cannot be the zero address.