Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
Thirdweb Token Drop
copy icon
thirdweb
โ€ข version 1.0.0
Token
ERC20
Sale
Whitelist
Audited

Thirdweb Token Drop

Audited

The Token Drop contract is a way of releasing your ERC20 tokens for a set price. It allows you to define the conditions for when and how your users can claim your tokens; including allowlists, release dates, and claim limits. In the Token Drop, you define the price for your tokens in each claim phase and can set a limit on how many tokens you want to release. Other users can then claim your tokens under the conditions you defined.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

thirdweb

Recent Use

๐Ÿž 0xA78F downloaded
๐Ÿฅ 0x5DF1 downloaded
๐Ÿฅ– 0x5DF1 saved
๐Ÿฅจ 0xDE29 downloaded
๐Ÿฅฏ 0x63A6 downloaded
๐Ÿฅž 0x5E07 downloaded
๐Ÿง€ 0x70F8 downloaded

Last Publish

10/23/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
initialize(address,string,string,string,address,address,uint256) :
This function is used to initialize the contract. It sets up the ERC2771Context, ERC20Permit, and ERC20 contracts, as well as setting up the contractURI, primarySaleRecipient, platformFeeRecipient, and platformFeeBps variables. It also sets up the DEFAULT_ADMIN_ROLE and TRANSFER_ROLE roles, giving the default admin and address(0) access to the TRANSFER_ROLE. (autogenerated documentation)
contractType() :
This function returns a bytes32 value that represents the type of the contract. It does this by simply returning the value of the MODULE_TYPE constant, which is set when the contract is deployed. (autogenerated documentation)
contractVersion() :
This function is a getter function that returns the version of the contract. It is a pure function, meaning that it does not modify the state of the contract and does not interact with the blockchain. It simply returns the value of the constant variable VERSION, which is a uint8 (unsigned 8-bit integer) that stores the version of the contract. (autogenerated documentation)
supportsInterface(bytes4) :
This function is used to check if a given interface is supported by the AccessControlEnumerableUpgradeable contract. It takes a bytes4 interfaceId as an argument and returns a boolean value indicating whether the interface is supported or not. The function calls the supportsInterface() function of the parent contract (AccessControlEnumerableUpgradeable) to check if the interface is supported. (autogenerated documentation)
_afterTokenTransfer(address,address,uint256) :
This function is an internal virtual override of the _afterTokenTransfer function from the ERC20Upgradeable and ERC20VotesUpgradeable contracts. It is used to execute any additional logic that needs to be performed after a token transfer has taken place. This could include updating balances, sending notifications, or any other action that needs to be taken after a token transfer. (autogenerated documentation)
_beforeTokenTransfer(address,address,uint256) :
This function is an override of the _beforeTokenTransfer function from the ERC20Upgradeable contract. It is used to restrict token transfers from and to addresses that do not have the TRANSFER_ROLE. If the transfer is from or to address(0), then the restriction does not apply. The function checks if the from and to addresses have the TRANSFER_ROLE, and if not, it will throw an error. (autogenerated documentation)
claim(address,uint256,address,uint256,bytes32[],uint256) :
This function allows a user to claim tokens from a specific condition. It requires the user to provide a valid Merkle proof, the quantity of tokens to be claimed, the currency to be used, the price per token, and the maximum quantity per transaction. The function then verifies the Merkle proof and the claim, collects the claim price, and transfers the claimed tokens to the receiver. Finally, it emits an event to notify that the tokens have been claimed. (autogenerated documentation)
setClaimConditions(bool) :
This function sets the claim conditions for a given set of phases. It requires the caller to have the DEFAULT_ADMIN_ROLE. It takes in an array of ClaimCondition objects and a boolean value to indicate whether the claim eligibility should be reset. It then checks that the startTimestamp of each phase is in ascending order and that the maxClaimableSupply is not exceeded. It then sets the claimCondition.count and claimCondition.currentStartId to the length of the array and the newStartIndex respectively. It then sets the claimCondition.phases and claimCondition.limitMerkleProofClaim to the new values. Finally, it emits a ClaimConditionsUpdated event with the new phases. (autogenerated documentation)
collectClaimPrice(uint256,address,uint256) :
This function is used to collect the claim price for a given quantity of tokens. It takes in three parameters: the quantity of tokens to claim, the currency to use, and the price per token. It then calculates the total price by multiplying the quantity by the price per token, and then divides it by 1 ether. It then calculates the platform fees by multiplying the total price by the platform fee BPS and dividing it by the maximum BPS. If the currency is the native token, it requires that the message value is equal to the total price. Finally, it transfers the currency to the platform fee recipient and the primary sale recipient, subtracting the platform fees from the total price. (autogenerated documentation)
transferClaimedTokens(address,uint256,uint256) :
This function is used to transfer tokens that have been claimed by a user. It takes in three parameters: the address of the recipient, the ID of the condition being claimed, and the quantity of tokens being claimed. It then updates the supplyClaimed value of the condition to reflect the amount of tokens that have been claimed, updates the limitLastClaimTimestamp to reflect the timestamp of the claim, and increments the walletClaimCount of the sender. Finally, it calls the _mint function to mint the specified amount of tokens to the recipient. (autogenerated documentation)
verifyClaim(uint256,address,uint256,address,uint256,bool) :
This function is used to verify a claim made by a user. It takes in the condition ID, the address of the claimant, the quantity of tokens being claimed, the currency being used, the price per token, and a boolean value to verify the maximum quantity per transaction. It then checks to make sure that the currency and price per token match the current claim phase, that the quantity is greater than 0 and less than or equal to the quantity limit per transaction (if the boolean value is true), that the total supply claimed is less than the maximum claimable supply, that the total supply is less than the maximum total supply, and that the wallet claim count is less than the maximum wallet claim count. Finally, it checks to make sure (autogenerated documentation)
verifyClaimMerkleProof(uint256,address,uint256,bytes32[],uint256) :
This function verifies a Merkle proof for a claim condition. It takes in the condition ID, the claimant's address, the quantity of the claim, an array of proofs, and the maximum quantity per transaction. It then checks that the Merkle root of the claim condition matches the proofs, that the claimant has not already claimed the proof, and that the quantity of the claim is less than or equal to the maximum quantity per transaction. If all of these checks pass, the function returns true and the index of the proof in the array. (autogenerated documentation)
s function getActiveClaimConditionId() :
This function returns the ID of the active claim condition. It does this by looping through the claimCondition.phases array, starting from the currentStartId + count and decrementing until it finds a phase with a startTimestamp that is less than the current block timestamp. If no active mint condition is found, the function reverts. (autogenerated documentation)
getClaimTimestamp(uint256,address) :
This function retrieves the timestamp of the last claim made by a particular address for a given condition ID, as well as the next valid claim timestamp. It does this by first retrieving the last claim timestamp from the limitLastClaimTimestamp mapping, and then calculating the next valid claim timestamp by adding the waitTimeInSecondsBetweenClaims value from the phases mapping to the last claim timestamp. If the addition of these two values results in an overflow, the next valid claim timestamp is set to the maximum value of a uint256. (autogenerated documentation)
getClaimConditionById(uint256) :
This function retrieves a ClaimCondition from the contract's storage based on the provided conditionId. It does this by accessing the "phases" mapping in the claimCondition struct and returning the ClaimCondition associated with the provided conditionId. (autogenerated documentation)
getPlatformFeeInfo() :
This function returns the address of the platform fee recipient and the platform fee rate (in basis points) for the contract. The platform fee rate is a percentage of the total amount of a transaction that is charged as a fee. The platform fee recipient is the address that will receive the fee. (autogenerated documentation)
s function setWalletClaimCount(address,uint256) :
This function sets the wallet claim count for a given address. It takes two parameters, an address and a uint256, and stores the uint256 in a mapping with the address as the key. It also emits an event, WalletClaimCountUpdated, with the address and the uint256 as parameters. This function can only be called by the DEFAULT_ADMIN_ROLE. (autogenerated documentation)
setMaxWalletClaimCount(uint256) :
This function sets the maximum number of wallet claims that can be made by a user. It is only accessible to the default admin role and requires a uint256 value as an argument. When the function is called, the maxWalletClaimCount variable is set to the argument value and an event is emitted to notify other users of the change. (autogenerated documentation)
setMaxTotalSupply(uint256) :
This function sets the maximum total supply of a token. It is only accessible to the default admin role, and it emits an event when the maximum total supply is updated. The function takes in a uint256 parameter, which is the new maximum total supply. (autogenerated documentation)
setPrimarySaleRecipient(address) :
This function sets the primary sale recipient address for the contract. It can only be called by the default admin role, and it updates the primarySaleRecipient variable with the address passed in as an argument. It also emits an event to notify that the primary sale recipient has been updated. (autogenerated documentation)
setPlatformFeeInfo(address,uint256) :
This function sets the platform fee recipient and platform fee bps for the contract. It requires that the platform fee bps is less than or equal to the maximum bps (10000). It then sets the platform fee bps to a uint64 and sets the platform fee recipient to the address passed in. Finally, it emits an event to indicate that the platform fee info has been updated. (autogenerated documentation)
setContractURI(string) :
This function sets the contractURI variable to a new value passed in as an argument. It also emits an event, ContractURIUpdated, which contains the previous and new values of the contractURI variable. This function can only be called by an account with the DEFAULT_ADMIN_ROLE. (autogenerated documentation)
_mint(address,uint256) :
This function is an internal virtual override of the _mint function from the ERC20Upgradeable and ERC20VotesUpgradeable contracts. It is used to mint a specified amount of tokens to a specified account. It works by calling the _mint function from the parent contracts, which will create the specified amount of tokens and add them to the specified account. (autogenerated documentation)
_burn(address,uint256) :
This function is an internal virtual override of the _burn function from the ERC20Upgradeable and ERC20VotesUpgradeable contracts. It allows for the burning of a specified amount of tokens from a given account. The function first calls the _burn function from the parent contracts, and then executes any additional code that is specific to this contract. (autogenerated documentation)
_msgSender() :
This function is used to retrieve the address of the sender of the current message. It works by calling the _msgSender() function from the ERC2771ContextUpgradeable contract, which returns the address of the sender. (autogenerated documentation)
_msgData() :
This function is used to retrieve the data associated with a given message call. It works by calling the _msgData() function from the ERC2771ContextUpgradeable contract, which returns the data associated with the message call as a byte array. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i thirdweb-token-drop
copy icon

Recent Use

๐Ÿž 0xA78F downloaded
๐Ÿฅ 0x5DF1 downloaded
๐Ÿฅ– 0x5DF1 saved
๐Ÿฅจ 0xDE29 downloaded
๐Ÿฅฏ 0x63A6 downloaded
๐Ÿฅž 0x5E07 downloaded
๐Ÿง€ 0x70F8 downloaded

Last Publish

10/23/2022

Version

1.0.0

Creator

thirdweb

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.