DropSinglePhase (ERC1155)
The DropSinglePhase1155 smart contract is an extension meant for distributing ERC1155 tokens.
This extension implements the 'Drop' distribution mechanism: set restrictions such as a price to charge, an allowlist etc. for the public / allowlisted mint of your tokens.
It is recommended to use this extension alongside the LazyMint extension.
View on GitHub
The DropSinglePhase1155 extension is an abstract contract, and expects you to implement the following functions by yourself:
| Name | Type | Description | 
|---|---|---|
| _afterClaim | internal virtual | Runs after every claimfunction call. | 
| _beforeClaim | internal virtual | Runs before every claimfunction call. | 
| _collectPriceOnClaim | internal virtual | Collects and distributes the primary sale value of NFTs being claimed. | 
| _transferTokensOnClaim | internal virtual | Transfers the NFTs being claimed. | 
| _canSetClaimConditions | internal view virtual | Runs on every attempt to set the claim condition on the contract. Returns whether the claim condition can be set in the given execution context. | 
This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.
- Lets an account claim a given quantity of tokens.
- Parameter receiver: The receiver of the NFTs to claim.
- Parameter tokenId: The tokenId of the NFTs to claim.
- Parameter quantity: The quantity of NFTs to claim.
- Parameter currency: The currency in which to pay for the claim.
- Parameter pricePerToken: The price per token to pay for the claim.
- Parameter allowlistProof: The proof of the claimer's inclusion in the merkle root allowlist.
- Parameter data: Arbitrary bytes data that can be leveraged in the implementation of this interface.
- Lets an authorized wallet set the claim condition for the contract.
- Parameter tokenId: The tokenId for which to set the claim condition.
- Parameter phase: The set of restrictions that will apply to the minting of tokens on the contract.- startTimestamp: The unix timestamp after which the claim condition applies.
- maxClaimableSupply: The maximum total number of tokens that can be claimed under the claim condition.
- supplyClaimed: At any given point, the number of tokens that have been claimed under the claim condition.
- quantityLimitPerWallet: The maximum number of tokens that can be claimed by a wallet.
- merkleRoot: The allowlist of addresses that can claim tokens under the claim condition.
- pricePerToken: The price required to pay per token claimed.
- currency: The currency in which the price must be paid.
 
- Parameter resetClaimEligibility: Whether to carry over the restrictions active for wallets that claimed tokens in the incumbent claim condition (e.g. next valid claim timestamp for a given wallet).
- The _canSetClaimConditionsfunction is run on every call to this function. If the return value of_canSetClaimConditionsisfalse, thesetClaimConditionscall will revert.
- Checks a request to claim tokens against the active claim condition's criteria.
- Parameter tokenId: The tokenId of the NFTs to claim.
- Parameter claimer: The wallet claiming tokens.
- Parameter quantity: The quantity of NFTs to claim.
- Parameter currency: The currency in which to pay the price for the claim.
- Parameter pricePerToken: The price to pay per token claimed.
- Parameter allowlistProof: Struct containing below elements:- proof: Proof of concerned wallet's inclusion in an allowlist.
- quantityLimitPerWallet: The total quantity of tokens the allowlisted wallet is eligible to claim over time.
- pricePerToken: The price per token the allowlisted wallet must pay to claim tokens.
- currency: The currency in which the allowlisted wallet must pay the price for claiming tokens.
 
- Returns the number of tokens claimed by a wallet under the active condition.
- Parameter tokenId: The tokenId of the NFTs to claim.
- Parameter claimer: The wallet claiming tokens.
- Exposes the ability to override the msg sender.
- Runs before every claimfunction call. Exposes the ability to add custom logic that runs before every claim of tokens.
- Parameter tokenId: The tokenId of the NFTs to claim.
- Parameter receiver: The receiver of the NFTs to claim.
- Parameter quantity: The quantity of NFTs to claim.
- Parameter currency: The currency in which to pay for the claim.
- Parameter pricePerToken: The price per token to pay for the claim.
- Parameter allowlistProof: The proof of the claimer's inclusion in the merkle root allowlist.
- Parameter data: Arbitrary bytes data that can be leveraged in the implementation of this interface.
- Runs after every claimfunction call. Exposes the ability to add custom logic that runs after every claim of tokens.
- Parameter tokenId: The tokenId of the NFTs to claim.
- Parameter receiver: The receiver of the NFTs to claim.
- Parameter quantity: The quantity of NFTs to claim.
- Parameter currency: The currency in which to pay for the claim.
- Parameter pricePerToken: The price per token to pay for the claim.
- Parameter allowlistProof: The proof of the claimer's inclusion in the merkle root allowlist.
- Parameter data: Arbitrary bytes data that can be leveraged in the implementation of this interface.
- Collects and distributes the primary sale value of NFTs being claimed.
- Parameter primarySaleRecipient: The recipient of the primary sale value generated from a claim.
- Parameter quantityToClaim: The quantity of NFTs being claimed.
- Parameter currency: The currency used to pay for the claim.
- Parameter pricePerToken: The price per token to pay for the claim.
- Transfers the NFTs being claimed to the appropriate recipient.
- Parameter to: The recipient of the tokens for a claim.
- Parameter tokenId: The tokenId of the NFTs being claimed.
- Parameter quantityBeingClaimed: The quantity of NFTs being claimed.
- Runs on every setClaimConditionsfunction call.
- Returns whether the claim condition can be set in the given execution context.
- For example, this function can check whether the wallet calling setClaimConditionsis the contract owner, and enforce that only the owner should be able to successfully callsetClaimConditions.