-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from axieinfinity/feature/NFT-ticket-sale
feat: add template NFTPresaleCommon
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
/// @dev Interface for the NFT contract that compatible with the contract MavisPresale. | ||
/// MUST be included ERC165 interface to support the detection of the contract's capabilities. | ||
interface INFTPresale { | ||
/** | ||
* @dev Mint NFTs for the presale. | ||
* | ||
* Requirements: | ||
* - The mintedTokenIds and mintedAmounts should have the same length. | ||
* - The mintedTokenIds array should be unique. | ||
* - For ERC721 NFTs, each minted token's quantity should always be 1. | ||
* - For ERC1155 NFTs, each minted token's quantity should be actual minted amounts. | ||
* - The total of minted amounts can be different from the input `quantity`. | ||
* | ||
* Examples: | ||
* - ERC1155: If mintedTokenIds = [1, 2], then mintedAmounts = [10, 20] | ||
* - ERC721: If mintedTokenIds = [1, 2], then mintedAmounts = [1, 1] | ||
* | ||
* @param to The address to mint the NFTs to. | ||
* @param quantity The quantity of NFTs to mint. | ||
* @param extraData The extra data for further customization. | ||
* @return mintedTokenIds The token IDs of the minted NFTs. | ||
* @return mintedAmounts The minted amounts according to the `mintedTokenIds`. | ||
*/ | ||
function mintPresale(address to, uint256 quantity, bytes calldata extraData) | ||
external | ||
returns (uint256[] memory mintedTokenIds, uint256[] memory mintedAmounts); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.22; | ||
|
||
import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol"; | ||
|
||
import { INFTPresale } from "../interfaces/launchpad/INFTPresale.sol"; | ||
|
||
abstract contract NFTPresaleCommon is IERC165, INFTPresale { | ||
/// @dev Returns whether the contract supports the NFT presale interface. | ||
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { | ||
return interfaceId == type(INFTPresale).interfaceId || interfaceId == type(IERC165).interfaceId; | ||
} | ||
} |