# Drop Contract

As code speaks for itself we recommend all the approved users for creating their own drop to fork our template and adapt their own smart contract code from it.

Our template for creating a drop can be found at [`LuxyTemplate`](https://github.com/Luxy-io/luxy-contracts/tree/main/contracts/launchpad/ERC721LuxyDrop.sol)`.`

`Anyways you're free to design the contract as you wish we just have as minimal requirement that your contract has the following functions in order to be compatible with our front-end (as we will be reading data straight from the contract to fetch information at the Drop page and to call in the mint function).`

## Public Constants

### Mandatory Public Constants

All the public constants in this section are mandatory we need those in order to be able to present your collection properly at Luxy's front-end

**MAX\_BATCH\_MINT** (uint256): maximum number of units that can be minted per mint function call.

**MAX\_SUPPLY** (uint256): maximum supply for the drop.

**DROP\_START\_TIME** (uint256):  timestamp when mint starts in Unix time.

**PRICE\_PER\_TOKEN** (uint256): The amount of tokens paid per NFT bought in WEI of the native blockchain token.&#x20;

### Optional Public Constants

The public constants in this section are optional, but if the contract creator chooses to implement a whitelist and enable the LuxySale period (we recommend you do as it will give an incentive for Luxy's community to buy your collection).

**WHITELIST\_EXPIRE\_TIME** (uint256): time in which minting will be exclusive for whitelisted addresses after **DROP\_*****START\_TIME.***&#x20;

**LUXY\_SALE\_EXPIRE\_TIME** (uint256): time in which minting will be exclusive for luxy holders after&#x20;

**MINIMUM\_LUXY\_AMOUNT** (uint256): The minimum amount of tokens for a user to be eligible to participate luxy\_sale

## Public Variables

### Mandatory Public Variables

**artist** (address)**:** Address who receives the drop gains.

**luxyLaunchpadFeeManagerProxy** (address): The address of LuxyFeeManagerProxy that will be responsible for the minting function call

### Optional Public Variables

**whitelistSize** (uint256)**:** Size of the whitelist mapping, to display at luxy front-end.

## Mint Function

The mint functions must be done in a format that enables only the LuxyLaunchpadFeeManager to call the minting function at the contract of the drop. The LuxyLaunchpadFeeManager will be responsible for handling the minting process and will send Luxy Marketplace fees to the proper address and also the amount due for the Artist.

```solidity
// Mint function on drop contract example
function mint(uint256 num) external {
        require(_msgSender() == luxyLaunchpadFeeManagerProxy, "Not allowed");
        require(block.timestamp > DROP_START_TIME, "Drop hasnt started yet");
        require(num <= MAX_BATCH_MINT, "Exceeds max batch per mint");
        require(totalSupply() + num <= MAX_SUPPLY, "Exceeds drop max supply");

        for (uint256 i; i < num; i++) {
            uint256 tokenId = _tokenIds.current();
            _safeMint(tx.origin, tokenId);
            _tokenIds.increment();
        }
    }
```

Note that even though you're free to implement the minting function in your own way the absolute mandatory parts would be the initially required functions (all four of them), also that the first requirement be that the \_msgSender() is equal to the luxyLaunchpadFeeManagerProxy and the revert error message must be the same as defined there. And finally that the input argument is a uint256 (it's the amount of tokens that will be minted per that function call).

## Whitelist Functions Example

At the Github example for the Luxy template, there are a few commented functions regarding an optional way to implement a whitelist and luxy sale period on your project. They are commented and there is a marker comment that's written `Uncomment this section to enable whitelist` above each of them. Those functions offer an easy and working way to implement the whitelist at your contract. Note that even if you don't use such functions it would be good to have the whitelistSize variable at your own custom implementation so the number of wallets can be displayed at luxy front-end.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.luxy.io/help-center/developers/smart-contracts/drop-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
