Tokens
Drop (ERC20 & ERC721)
Drop is an extension meant for distributing ERC20 or ERC721 tokens. It allows setting up multiple claim phases unlike DropSinglePhase. This series of claim phases is ordered by their respective startTimestamp.
This extension implements the 'Drop' distribution mechanism: set multiple claim phases with restrictions such as a price to charge, an allowlist etc. for the public / allowlisted mint of your tokens.
info
It is recommended to use this extension alongside the LazyMint extension.
The Drop 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.
None of the base contracts implement this extension.
- Lets an account claim a given quantity of tokens.
- Parameter receiver: The receiver of the tokens to claim.
- Parameter quantity: The quantity of tokens 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 phases: The array where eachphasecontains a set of restrictions that will apply to the minting of tokens on the contract.- startTimestamp: The unix timestamp after which the claim condition applies. The same claim condition applies until the- startTimestampof the next claim condition.
- 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.
- metadata: Claim condition metadata.
 
- 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 conditionId: Id of the active claim condition.
- Parameter claimer: The wallet claiming tokens.
- Parameter quantity: The quantity of tokens 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 Id of currently active claim condition.
- Returns the claim condition for a given condition Id.
- Parameter conditionId: Id of the claim condition being viewed.
- Returns the number of tokens claimed by a wallet under the given condition.
- Parameter conditionId: Id of the claim condition under which to check the supply claimed.
- 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 receiver: The receiver of the tokens to claim.
- Parameter quantity: The quantity of tokens 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 receiver: The receiver of the tokens to claim.
- Parameter quantity: The quantity of tokens 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 tokens being claimed.
- Parameter primarySaleRecipient: The recipient of the primary sale value generated from a claim.
- Parameter quantityToClaim: The quantity of tokens 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 tokens being claimed to the appropriate recipient.
- Parameter to: The recipient of the tokens for a claim.
- Parameter quantityBeingClaimed: The quantity of tokens 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.