FixedPriceSignatureMinter
contracts/modules/FixedPriceSignatureMinter.sol
A minter that enables permissioned mints via ECDSA signatures.
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;
// The address of the signer.
address signer;
}
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 cutoffTime,
uint32 endTime,
uint16 affiliateFeeBPS,
uint32 maxMintableLower,
uint32 maxMintableUpper,
uint32 maxMintablePerAccount_
) external returns (uint128 mintId)
Initializes a range edition 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. |
price | Sale price in ETH for minting a single token in edition . |
startTime | Start timestamp of sale (in seconds since unix epoch). |
cutoffTime | The timestamp (in seconds since unix epoch) after which the max amount of tokens mintable will drop from maxMintableUpper to maxMintableLower . |
endTime | End timestamp of sale (in seconds since unix epoch). |
affiliateFeeBPS | The affiliate fee in basis points. |
maxMintableLower | The lower limit of the maximum number of tokens that can be minted. |
maxMintableUpper | The upper limit of the maximum number of tokens that can be minted. |
maxMintablePerAccount_ | The maximum number of tokens that can be minted by an account. |
setMaxMintableRange
function setMaxMintableRange(
address edition,
uint128 mintId,
uint32 maxMintableLower,
uint32 maxMintableUpper
) external
Sets the max mintable range.
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. |
maxMintableLower | The lower limit of the maximum number of tokens that can be minted. |
maxMintableUpper | The upper limit of the maximum number of tokens that can be minted. |
mint
function mint(
address edition,
uint128 mintId,
uint32 quantity,
address affiliate
) external payable
Mints tokens for a given edition.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
quantity | Token quantity to mint in song edition . |
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. |
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 |
IFixedPriceSignatureMinter | 0xa61bd96f |
Events
RangeEditionMintCreated
event RangeEditionMintCreated(
address indexed edition,
uint128 indexed mintId,
uint96 price,
uint32 startTime,
uint32 cutoffTime,
uint32 endTime,
uint16 affiliateFeeBPS,
uint32 maxMintableLower,
uint32 maxMintableUpper,
uint32 maxMintablePerAccount
)
Emitted when a range edition is created.
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 . |
startTime | Start timestamp of sale (in seconds since unix epoch). |
cutoffTime | The timestamp (in seconds since unix epoch) after which the max amount of tokens mintable will drop from maxMintableUpper to maxMintableLower . |
endTime | End timestamp of sale (in seconds since unix epoch). |
affiliateFeeBPS | The affiliate fee in basis points. |
maxMintableLower | The lower limit of the maximum number of tokens that can be minted. |
maxMintableUpper | The upper limit of the maximum number of tokens that can be minted. |
MaxMintableRangeSet
event MaxMintableRangeSet(
address indexed edition,
uint128 indexed mintId,
uint32 maxMintableLower,
uint32 maxMintableUpper
)
Emitted when the max mintable range is updated.
Params: | |
---|---|
edition | Address of the song edition contract we are minting for. |
mintId | The mint ID. |
maxMintableLower | The lower limit of the maximum number of tokens that can be minted. |
maxMintableUpper | The upper limit of the maximum number of tokens that can be minted. |
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 . |
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. |
Errors
InvalidMaxMintableRange
error InvalidMaxMintableRange()
The maxMintableLower
must not be greater than maxMintableUpper
.
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.