NFTKiosk.sol

The main changes included in version 1 of the Launchpad are as follows:

  1. The contract architecture has been reworked.

  2. Pricing and discount functionality have been separated into a separate contract.

  3. The ability to create an individual storefront (aka Kiosk) for its owner has been added.

  4. The ability to use a personalized pricing and discount contract for each storefront (aka Kiosk) has been added.

  5. Functionality for selling regular ERC-721 standard NFTs has been added.

  6. The ability to set individual prices for NFTs and wNFTs has been added.

  7. The ability to set prices at the storefront (aka Kiosk) level for the NFTs and wNFTs placed on it has been added.

  8. Various types of discounts have been introduced, including time-based discounts, discounts using promo codes, and referral discounts.

Restrictions:

  1. The smart contract can only work with wNFT of Wrapper v.1 version.

  2. The sellable ERC-20 tokens should be first in the collateral array of wNFTs.

  3. ERC-1155 tokens are not being supported.

  4. The contract model of prices and discounts for the Kiosk should be added in the white list of models. To do it it is necessary to send email to DAO ENVELOP. Email address is tech@niftsy.io. The technical team will contact the email sender to perform the code review of his smart contract.

Method setDisplayParams

function setDisplayParams(
        string calldata _name,
        address _beneficiary, // who will receive assets from sale
        uint256 _enableAfter,
        uint256 _disableAfter,
        address _priceModel
    ) public virtual 

The method registers a storefront (aka Kiosk) for a user. Only the owner of the storefront (aka Kiosk) can configure it, set prices, place NFTs and wNFTs on their storefront (aka Kiosk), and set the size of discounts to them.

The owner needs to come up with a name for the storefront, which users will use in the URL when they visit the launchpad dApp. For example, in the URL "https://stage.appv1.envelop.is/launchpad/5/0xb267e4067886da3566511fa508ffce4b24e656b6/brownie", the last part "brownie" represents the storefront's name.

The method emits a DisplayChanged event with the following details:

  • The hash of the storefront name using the SHA-256 algorithm.

  • The address of the storefront owner.

  • The address of the recipient for funds from the sale of NFTs and wNFTs on the storefront (when sales happen on default storefront (aka Kiosk)).

  • The start date of the sales in Unix time format.

  • The end date of the sales in Unix time format.

  • The address of the contract for the pricing and discount model for the storefront.

  • The storefront name.

Incoming parameters for calling the method:

Method transferDisplay

function transferDisplay(address _to, bytes32 _displayNameHash) 
        external 

The method transfers ownership of a storefront (aka Kiosk) from the old owner to a new owner.

The method emits a DisplayTransfer event with the following details:

  • The hash of the storefront name using the SHA-256 algorithm.

  • The old owner of the storefront.

  • |The new owner of the storefront.

Incoming parameters for calling the method:

Method addItemToDisplay

function addItemToDisplay(
        bytes32 _displayNameHash,
        ETypes.AssetItem memory _assetItem,
        KTypes.Price[] calldata _prices
    ) 
        public 
        returns  (KTypes.Place memory place)

The method places NFTs (non-fungible tokens) and wNFTs (wrapped non-fungible tokens) on a storefront (aka Kiosk). Only the owner of a specific Kiosk can call this method. Before calling the method, the owner must give permission to the Launchpad contract to use their (NFTs and wNFTs). The method transfers the NFTs and wNFTs to the address of the Launchpad smart-contract.

The method emits an event called "ItemAddedToDisplay" with the following details:

  • The hash of the storefront name using the SHA-256 algorithm.

  • The address of the NFT/wNFT smart contract.

  • The tokenId of the NFT/wNFT.

  • The index position of the NFT/wNFT in the array of tokens placed on the specific display case.

Incoming parameters for the method:

ETypes.AssetItem

ETypes.Asset

ETypes.AssetType: 3 - ERC-721.

KTypes.Price

The method returns values:

Method addBatchItemsToDisplayWithSamePrice

function addBatchItemsToDisplayWithSamePrice(
        bytes32 _displayNameHash,
        ETypes.AssetItem[] memory _assetItems,
        KTypes.Price[] calldata _prices
    ) 
        external 
        returns  (KTypes.Place[] memory)

The method allows the placement of multiple NFTs/wNFTs on a Kiosk in a single call. Only the owner of a specific Kiosk can call this method. Before calling the method, the owner must give permission to the Launchpad contract to use their NFTs and wNFTs. The method transfers the NFTs and wNFTs to the address of the Launchpad contract. Individual pricing settings apply to the entire group of NFTs/wNFTs being placed.

The method emits an event called "ItemAddedToDisplay" for each NFT/wNFT being placed, providing the following details:

  • The hash of the Kiosk name using the SHA-256 algorithm.

  • The address of the NFT/wNFT smart contract.

  • The tokenId of the NFT/wNFT.

  • The index position of the NFT/wNFT in the array of tokens placed on the specific Kiosk.

Incoming method call parameters:

The method returns an array of value pairs:

Method addAssetItemPriceAtIndex

function addAssetItemPriceAtIndex(
        ETypes.AssetItem calldata _assetItem,
        KTypes.Price[] calldata _prices
    ) 
        external 

The method adds prices for NFT/wNFT. The method can only be called by the owner of the Kiosk where the NFT/wNFT is placed.

The method emits an event called "ItemPriceChanged" with the following details:

  • The hash of the Kiosk name using the SHA-256 algorithm, where the NFT/wNFT is placed.

  • The address of the NFT/wNFT smart-contract.

  • The tokenId of the NFT/wNFT.

Incoming parameters for the method:

Method editAssetItemPriceAtIndex

function editAssetItemPriceAtIndex(
        ETypes.AssetItem calldata _assetItem,
        uint256 _priceIndex,
        KTypes.Price calldata _price
    ) 
        external

The method replaces the price record in the array of individual prices for the NFT/wNFT placed on the Kiosk. The method can only be called by the owner of the Kiosk where the NFT/wNFT is placed.

The method emits an event called "ItemPriceChanged" with the following details:

  • The hash of the Kiosk name using the SHA-256 algorithm, where the NFT/wNFT is placed.

  • The address of the NFT/wNFT smart-contract.

  • The tokenId of the NFT/wNFT.

Incoming parameters for the method:

Method removeLastPersonalPriceForAssetItem

function removeLastPersonalPriceForAssetItem(
        ETypes.AssetItem calldata _assetItem
    ) 
        external 

The method deletes the last record in the array of individual prices for the NFT/wNFT placed on the Kiosk. The method can only be called by the owner of the Kiosk, where the NFT/wNFT is placed.

The method emits an event called "ItemPriceChanged" with the following details:

  • The hash of the Kiosk name using the SHA-256 algorithm, where the NFT/wNFT is placed.

  • The address of the NFT/wNFT smart-contract.

  • The tokenId of the NFT/wNFT.

Incoming parameters for the method:

Method buyAssetItem

function buyAssetItem(
        ETypes.AssetItem calldata _assetItem,
        uint256 _priceIndex,
        address _buyer,
        address _referrer,
        string calldata _promo
    ) external payable nonReentrantol

The method allows a user to purchase the NFT/wNFT placed on the Kiosk. When call the method, the user can send a certain amount of native network coins if he decide to buy for native tokens. Before calling the method, the user must give permission to use ERC-20 tokens, which they intend to use for payment of the NFT/wNFT (if the payment is made with ERC-20 tokens that the Kiosk owner is willing to accept as payment). The purchase can only be made during the period between the start and end dates of trading the NFT/wNFT on the Kiosk.

The method emits an event called "EnvelopPurchase" with the following details:

  • The hash of the Kiosk name using the SHA-256 algorithm, where the NFT/wNFT is placed.

  • The address of the NFT/wNFT smart-contract.

  • The tokenId of the NFT/wNFT.

The method emits an event called "EnvelopReferrer" with the following details (if buyer calls method with filled referrer address):

  • The address of referrer.

  • The address of buyer.

  • The address of payment token smart contract using by buyer to pay

  • The amount of payment

  • The percent of referrer discount

Incoming parameters for the method:

Method getDisplayOwner

function getDisplayOwner(bytes32 _displayNameHash) public view returns (address)

The method returns the address of the Kiosk owner.

Incoming parameters for the method:

Returned values:

Method getDisplay

function getDisplay(bytes32 _displayNameHash) 
        public 
        view 
        returns (KTypes.Display memory)

The method returns information about the Kiosk.

Incoming parameters for the method:

Returned values:

KTypes.Display

KTypes.ItemForSale

Method getAssetItemPlace

function getAssetItemPlace(ETypes.AssetItem memory _assetItem) 
        public 
        view 
        returns  (KTypes.Place memory)

The method returns data about the Kiosk where the NFT/wNFT is placed.

Incoming parameters for the method:

Returned values:

Method getAssetItemPricesAndDiscounts

function getAssetItemPricesAndDiscounts(
        ETypes.AssetItem memory _assetItem,
        address _buyer,
        address _referrer,
        string calldata _promo
    ) 
        external 
        view
        returns (KTypes.Price[] memory, KTypes.Discount[] memory)

The method returns data about prices and discounts for placed NFT/wNFT.

Incoming parameters for the method:

Returned values:

KTypes.Discount:

DiscountType:

  • 0 - promo-discount (PROMO)

  • 1 - referral-discount (REFERRAL)

  • 2 - discount by volume of purchases (BATCH)

  • 3 - discount by time (TIME)

  • 4 - discount for members of "white-lists" (WHITELIST)

  • 5, 6, 7 - discounts which can be set in the contract price and discount models by the the kiosk owner (CUSTOM1, CUSTOM2, CUSTOM3)

Method getDisplayAssetItems

function getDisplayAssetItems(bytes32 _displayNameHash) 
        public 
        view 
        virtual
        returns (KTypes.ItemForSale[] memory) 

The method returns for the Kiosk information about all NFTs and wNFT placed on it and not yet sold.

Incoming parameters for the method:

Returned values:

Method getAssetItem

function getAssetItem(ETypes.AssetItem memory _assetItem)
        public
        view
        returns (KTypes.ItemForSale memory)

The method returns settings data for a particular NFT/wNFT.

Incoming parameters for the method:

Returned values:

Method hlpHashString

function hlpHashString(string memory _name) public pure returns (bytes32)

The method returns SHA-256 hash for a value.

Incoming parameters for the method:

Returned values:

Last updated