Treasureland
Search…
Treasureland NFT Standard
Table of Contents
Introduction 1.1
NFT Standard Protocol 1.2
ERC1155 1.2.1
ERC721 1.2.2
Metadata 1.2.3
Royalty 1.3
1.1 Introduction
1.2 NFT Standard Protocol
// 20210512153646 // https://meebits.larvalabs.com/meebit/7241
{ "name": "Meebit #7241", "description": "Meebit #7241", "image": "http://meebits.larvalabs.com/meebitimages/characterimage?index=7241&type=full&imageType=jpg", "attributes": [ { "trait_type": "Type", "value": "Human" }, { "trait_type": "Hair Style", "value": "Pulled Back" }, { "trait_type": "Hair Color", "value": "Auburn" }, { "trait_type": "Shirt", "value": "Tee" }, { "trait_type": "Shirt Color", "value": "Argyle" }, { "trait_type": "Pants", "value": "Short Leggings" }, { "trait_type": "Pants Color", "value": "Blue Camo" }, { "trait_type": "Shoes", "value": "Skater" }, { "trait_type": "Shoes Color", "value": "Black" } ] }
1.2.1 ERC1155
ERC1155NFT needs to comply with the IERC1155 protocol standard and implement the following protocol standards
“`javascript
/*
* bytes4(keccak256(‘balanceOf(address,uint256)’)) == 0x00fdd58e
* bytes4(keccak256(‘balanceOfBatch(address[],uint256[])’)) == 0x4e1273f4
* bytes4(keccak256(‘setApprovalForAll(address,bool)’)) == 0xa22cb465
* bytes4(keccak256(‘isApprovedForAll(address,address)’)) == 0xe985e9c5
* bytes4(keccak256(‘safeTransferFrom(address,address,uint256,uint256,bytes)’)) == 0xf242432a
* bytes4(keccak256(‘safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)’)) == 0x2eb2c2d6
*
* => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^
* 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26
*/
bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;
/*
* bytes4(keccak256(‘uri(uint256)’)) == 0x0e89341c
*/
bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c;
“`
One needs to register the above Interface in ERC165 protocol
1.2.2 ERC721
ERC721NFT needs to comply with the IERC721 protocol standard and needs to implement the following protocol standards
/*
  • bytes4(keccak256(‘balanceOf(address)’)) == 0x70a08231
* bytes4(keccak256(‘ownerOf(uint256)’)) == 0x6352211e
  • bytes4(keccak256(‘approve(address,uint256)’)) == 0x09
  • bytes4(keccak256(‘getApproved(uint256)’)) == 0x081812
  • bytes4(keccak256(‘setApprovalForAll(address,bool)’))
  • bytes4(keccak256(‘isApprovedForAll(address,address)’)
  • bytes4(keccak256(‘transferFrom(address,address,uint25
  • bytes4(keccak256(‘safeTransferFrom(address,address,ui
  • bytes4(keccak256(‘safeTransferFrom(address,address,ui
*
* => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc
* 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
/*
  • bytes4(keccak256(‘name()’)) == 0x06fdde03
* bytes4(keccak256(‘symbol()’)) == 0x95d89b41
  • bytes4(keccak256(‘tokenURI(uint256)’)) == 0xc87b56dd
*
* => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
*/
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b
/*
  • bytes4(keccak256(‘totalSupply()’)) == 0x18160ddd
  • bytes4(keccak256(‘tokenOfOwnerByIndex(address,uint256
  • bytes4(keccak256(‘tokenByIndex(uint256)’)) == 0x4f6cc
*
* => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
*/
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x
One needs to register the above Interface in ERC165 protocol
1.2.3 metadata
Each NFT will have corresponding metadata URI that returns additional important information about the item, such as the item’s name, image, description, etc. To find this URI, we use the
tokenURI method in ERC721 and the URI method in ERC1155. A simple example of this metadata is:
There’s quite a lot you can do with metadata — including adding
rankings, boosts, animations, dates, and much more! We think you’ll definitely want to explore it in full, so please see our dedicated
metadata standards documentation for this piece of the tutorial.
TreasureLand supports metadata that is structured according to the official ERC721 metadata standard or the Enjin Metadata suggestions.
Additionally, we support several other properties that allow for
multimedia attachments — including audio, video, and 3D models — plus interactive traits for your items, giving you all the sorting and filtering capabilities on the market.
Attributes
To give your items a little more pizazz, we also allow you to add custom “attributes” to your metadata that will show up underneath each of your assets.
To generate those attributes, the following array of attributes was included in the metadata:
1.3 Royalty
Treasureland royalty standard is based on the IERC2981 protocol. And the contract is based on IERC2981 to realize the royalty solution
“`javascript
/// bytes4(keccak256(“royaltyInfo(uint256)”)) == 0xcef6d368
/// bytes4(keccak256(“onRoyaltiesReceived(address,address,uint256,address,uint256,bytes32)”)) == 0xe8cb9d99
/// bytes4(0xcef6d368) ^ bytes4(0xe8cb9d99) == 0x263d4ef1
bytes4 private constant _INTERFACE_ID_ERC721ROYALTIES = 0x263d4ef1;
“`
– IERC2981 has a numerical conversion as follows
“`javascript
amount – a percentage calculated as a fixed point with a scaling factor of 100000 (5 decimals),
such that 100% would be the value 10000000, as 10000000/100000 = 100.
1% would be the value 100000, as 100000/100000 = 1
Last modified 1mo ago
Copy link