New approach for Token Standards was created taking all best features of ERC 721, combined with ERC 20 compatible interface, gives a lot of opportunities for business. Due to ERC 721 token nature it brings non-fungibility and now it is supplied by ERC 20’s, in respect of that, your stake in ERC 20's tokens define your portion for non-fungible token, which could be presented like unique crypto asset, as example you could build shareholding or collaborative trading over of RFT NFT.
This standard outlines a smart contract interface, which allow creating a Non-Fungible assets, each of them is supplied by Fungible Token in a separate contract, with ERC-20 compatibility. Existing standards such as ERC-721 cannot provide enough features and functionality in order to be supplied by another asset. The ERC-721 standard’s Token ID is a single non-fungible unique identifier (index) and the set of such NF’s is deployed as a single contract with settings for the entire collection. Unlike, the RFT Non-Fungible ERC-20 Compatible Token allows to create Fungible Token with predefined token supply, that will be valued conformity for a set of Non-Fungible tokens.
The entry point to the pipeline of creating Non-Fungible Token, which value is supplied by Fungible once with ERC-20 compatibility starts from ‘mint’ function. Under the hood ‘mint’ creates the Fungible token with specified owner and supply and then establish Non-Fungible one, both tokens are linked between each other. By granting binding between NFT and FT we gain an opportunity to create a set of NFT’s, with different owners, the balance of Fungible Token for each holder in relative to NFT determines the measure of his possessions to a Non-Fungible asset.
Fungible token requires:
- name
- symbol
- decimals
- total supply
- address of RFT NFT
- address of owner
- NFT token id
Name, symbol, decimals and total supply are integral local variables of ERC-20 compatible interface. Address of RFT NFT is an address of NFT base contract, which initializes TGE of FT contract. NFT token id is a unique identifier of NFT, which is related to this FT.
Non-Fungble token requires:
- token id
- owner
Token id is a unique identifier for NFT, an owner is address to whom belongs NFT ownership
Non-Fungible base contract requires:
- name
- symbol
-
balanceOf(address _owner) Returns NFT Token balance of selected address (_owner), which means, how many NFT tokens owner of address has on his balance. _owner - address. Return value: uint256 Sample return value: 5
-
ownerOf(uint256 _tokenId) Returns owner address of selected NFT token (_tokenId). _tokenId - unique identifier of NFT. Return value: address Sample return value: 0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39
-
approve(address _to, uint256 _tokenId) Approves to transfer selected NFT (_tokenId) by specific address (_to). _to - receiver address of transfer approve for selected NFT _tokenId - unique identifier of NFT. Return value: void
-
getApproved(uint256 _tokenId) Returns address of approved for transfer address for selected NFT(_tokenId). _tokenId - unique idenfier of NFT. Return value: address Sample return value: 0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39
-
setApprovalForAll(address _to, bool _approved) Approve/Disapprove(depends on _approved value) transfering of all caller's NFTs by specific address (_to). _to - receiver of approvals for all NFT's owned by caller address. Return value: void
-
isApprovedForAll(address _owner, address _operator) Checks if all NFT's of certain address(_owner) is approved to transfer by another address(_operator). _owner - address of NFT's owner _operator - receipient address of transfer rights Return value: bool Sample return value: false
-
transferFrom(address _from, address _to, uint256 _tokenId) Transfer selected NFT (_tokenId) from owner (_from) to new owner(_to). _from - address of NFT's owner _to - address of NFT receiver _tokenId - unique identifier of NFT. Return value: void
-
safeTransferFrom(address _from, address _to, uint256 _tokenId) Safe implementation of transferFrom function, which additionally checks that NFT receiver address is NFT compatible by calling method of Receipient contract address and supplying sender address, previous owner of NFT, NFT id. Return value: void
-
tokenOfOwnerByIndex(address _owner, uint256 _index) Returns NFT id owned by the supplied address and index in the owner's NFT array. Index could be from 0 to n, where n is owner's balance of NFT's. _owner - address of NFT's owner _index - index inside array of owner's NFT. Return value: uint256 Sample return value: 22
-
totalSupply() Returns total amount of NFT's presented in this NFT contract. Return value: uint256 Sample return value: 100
-
tokenByIndex(uint256 _index) Returns NFT id from all NFT's array by using its index. _index - index inside array of all NFT. Return value: uint256 Sample return value: 12
-
tokenURI(uint256 _tokenId) Get Uniform Resource Identifier of selected NFT. _tokenId - unique identifier of NFT. Return value: string Sample return value: "TOKI1"
-
balanceOf(address _address) Returns fungible token balance of specific address. Return value: uint256 Sample return value: 10000
-
totalSupply() Returns all supply of tokens that was initially created. Return value: uint256 Sample return value: 2000000
-
transfer(address _to, uint256 _amount) Transfer specified amount of tokens from token holder to receipient, could throw in case function caller has not enough tokens owner - holder of FT's _to - new holder of FT's _amount - amount of FT's to be transfered
Return value: bool Sample return value: true -
approve(address _operator, uint256 _amount) Allow _operator to withdraw from your account, multiple times, up to the _amount. If this function is called again it overwrites the current allowance with _value. Return value: bool Sample return value: true
-
transferFrom(address _from, address _to, uint256 _amount)
Transfer specified amount of tokens from token holder to receipient, function caller address is approved address. _from - holder of FT's to transfer from. _to - new holder of FT's to transfer to _amount - amount of FT's to be transfered Return value: bool Sample return value: false -
increaseAllowance(address _operator, uint256 _addedAmount) Increase amount of tokens allowed to be transfered for approved address from balance of owner. owner - caller address _operator - approved address _addedAmount - amount to be added to approved address allowance balance. Return value: bool Sample return value: false
-
decreaseAllowance(address _operator, uint256 _substractedAmount) Decrease amount of tokens allowed to be transfered for approved address from balance of owner. owner - caller address _operator - approved address _substractedAmount - amount to be substracted from approved address allowance balance Return value: bool Sample return value: true
-
allowance(address _owner, address _operator) Returns amount of tokens allowed to be transfered for approved address from balance of owner. _owner - holder of FT's _operator - approved address. Return value: uint256 Sample return value: 5000
-
batchTransfer(address[] _receivers, uint256[] _values) Transfer specified token amounts from token holder to receipients _receivers - array of FT's receivers addresses _values - array of FT's amount. Return value: bool Sample return value: true
-
batchTransferFrom(address _from, address[] _receivers, uint256[] _values) Transfer specified token amounts from token holder to receipients. _from - holder of NFT's _receivers - array of FT's receivers addresses _values - array of FT's amount. Return value: bool Sample return value: true
-
holdersCount() Returns count of token holders. Return value: uint256 Sample return value: 40
-
holderByIndex(uint256 _index) Returns address of token holder by index inside array of token holders. _index - index inside array of token holders. Return value: address Sample return value: 0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39
-
holders(uint256 _from, uint256 _to) Returns token holders addresses and their balances in some range. _from - start index inside array of token holders _to - end index inside array of token holders. Return value: (address[], uint256[]) Sample return value: ([0xce42bdb34189a93c55de250e011c68faee374dd3, 0xe84da28128a48dd5585d1abb1ba67276fdd70776],[1000000,200000])
-
getNFT() Returns address of NFT contract and NFT id that was generated for FT. Return value: (address, uint256) Sample return value: (0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39, 2)
-
burn(address _owner, uint256 _tokenId) Burn NFT and delete FT data. _owner - owner address of NFT to burn _tokenId - unique identifier of NFT Return value: bool Sample return value: false
-
mint(string _name, string _symbol, uint256 _decimals, address _tokenOwner, uint256 _fungibleTokenSupply) Mint NFT token and create FT accordingly Return value: uint256 Sample return value: 2
-
createFT(string _name, string _symbol, uint256 _decimals, address _tokenOwner, uint256 _fungibleTokenSupply, uint256 _tokenId) Creates FT with specified parameters. Return value: address Sample return value: 0xce42bdb34189a93c55de250e011c68faee374dd3
-
nftValue(uint256 _tokenId) Returns value of selected NFT. _tokenId - unique identifier of NFT Return value: uint256 Sample return value: 2000000
-
ftHolderBalance(uint256 _tokenId, address _holder) Returns FT token balance of specified NFT. _tokenId - unique identifier of NFT _holder - holder address Return value: uint256 Sample return value: 12500
-
ftHoldersBalances(uint256 _tokenId) Returns all FT token holders and their balances of specified NFT. _tokenId - unique identifier of NFT Return value: (address[], uint256[]) Sample return value: ([0xe2b3204f29ab45d5fd074ff02ade098fbc381d42,0x9e1ef1ec212f5dffb41d35d9e5c14054f26c6560], [10000,20000])
-
ftHoldersCount(uint256 _tokenId) Returns FT token holders amount of specified NFT. _tokenId - unique identifier of NFT Return value: uint256 Sample return value: 40
-
ftAddress(uint256 _tokenId) Returns FT smart contract address of specified NFT. _tokenId - unique identifier of NFT Return value: address Sample return value: 0xe2b3204f29ab45d5fd074ff02ade098fbc381d42