1. Description of Functions
As depicted by the following diagram:
"Owner" denotes the proprietor of the ERC-1000 contract.
"Seller" denotes individuals who swap ERC-721 NFTs for ERC-20 tokens.
"Buyer" denotes individuals who swap ERC-20 tokens for ERC-721 NFTs.
1.1 Mint ERC-20 Tokens
Through ERC-1000, Owners can mint ERC-20 tokens by:
Directly minting a batch of ERC-20 tokens via mintErc20.
Minting a specific quantity of ERC-20 tokens by burning ERC-721 NFTs via burnErc721 and mintErc20.
1.2 Mint ERC-721 NFTs
Through ERC-1000, Owners can mint ERC-721 NFTs by:
Directly minting ERC-721 NFTs via mintErc721.
Minting ERC-721 NFTs by burning designated quantities of ERC-20 tokens via burnErc20 and mintErc721.
1.3 Swap ERC-721 NFTs for ERC-20 Tokens
Through ERC-1000, Sellers can swap ERC-721 NFTs for specific quantities of ERC-20 tokens by:
Depositing ERC-721 NFTs into the contract address through the transferFrom or safeTransferFrom functions, and receiving a predetermined number of ERC-20 tokens (By default, one NFT yields 1,000 tokens).
Consigning ERC-721 NFTs to obtain designated quantities of ERC-20 tokens.
This process requires NFT sellers to lock the ERC-721 NFTs in the smart contracts via the contracts’ borrow function. In return, the ERC-1000 contract will transfer a predetermined number of ERC-20 tokens (“loanquantum”) to the NFT sellers based on the following formula: loanquantum = fragmentsVal * (fragmentsVal * blocks * ratePerBlock);
fragmentsVal represents the exchange rate between the ERC-721 NFT and ERC-20 tokens, with the default being 1,000; blocks is the number of blocks corresponding to the consignment period; and ratePerBlock is the collateral rate charged per block.
These locked NFTs can only be purchased through the purchase function of the ERC-1000 contract. If a buyer purchases the consigned NFT within the valid consignment period, the final additional number of ERC-20 tokens (“income”) the NFT sellers get would be sale price of the NFT minus the sum of loanquantum, interest (“interest”), and transaction fee (“purchaseFee”) obtained at the time of consignment, i.e. interest = fragmentsVal * delta * ratePerBlock purchaseFee = (price - fragmentsVal) * purchaseFeeRate income = price - loanquantum - interest - purchaseFee
"delta" represents the variance in block height from the initiation of the NFT sale to the moment when the NFT is sold. "purchaseFeeRate" denotes the transaction fee rate for purchasing the NFT.
The consigned NFT can be redeemed ("Redeem") at any given time, incurring a specific interest charge (“interest”), calculated using the methodology as described above. However, redemption by non-consignors is restricted to occurring after the consignment period elapses, with the block height difference utilised for interest calculation always corresponding to the duration of the consignment period. Conversely, consignors retain the flexibility to redeem the consigned NFT at any point during the consignment period, with the block height difference for interest computation being the difference between the block height at commencement of consignment and at redemption.
In the event of redemption by non-consignors, the fee incurred is denoted as "fragmentsVal," while for redemption by consignors, the fee is the sum of the prepayment and accrued interest over the consignment period.
Using the ERC-721 NFTs as collateral to borrow specific quantities of ERC-20 tokens
Similar to consigning NFTs, this process also requires Sellers to lock the ERC-721 NFTs in the smart contracts via the contracts’ borrow function. In return, the ERC-1000 contract will transfer a predetermined number of ERC-20 tokens (“loanquantum”) to the Sellers based on the same formula as above.
Sellers can redeem the collateralised ERC-721 NFTs using the same method as in the consignment and at any point during the loan period.
1.4 Swap ERC-20 Tokens for ERC-721 NFTs
Through ERC-1000, Buyers can swap specific quantities of ERC-20 tokens for ERC-721 NFTs by:
Acquiring ERC-721 NFTs at the consignment price.
Purchasing random ERC-721 NFTs via randomTrade, wherein Buyers designate the desired quantity of ERC-721 NFTs to be purchased and the ERC-1000 smart contract autonomously selects the ERC-721 NFTs based on the quantity requirement. Acquiring random ERC-721 NFTs necessitates the payment of a transaction fee, set at a predetermined rate.
Purchasing selected ERC-721 NFTs via specificTrade, allowing Buyers to specify the desired NFT IDs for purchasing. Such specific transactions involve the payment of a transaction fee at a predetermined rate.
Last updated
Was this helpful?