TransWikia.com

How to validate proper implementation of ERC-1155 contract?

Ethereum Asked by Steven T. Cramer on January 3, 2021

I want to implement an ERC-1155 contract. Using TDD we would first write a test. Which begs the question of is there a way to validate that your contract properly implements ERC-1155?

One Answer

With erc165 or 1820, the requirement of 1155 is include erc165 and in their eip they also say this:

Smart contracts implementing the ERC-1155 standard MUST implement the ERC-165 supportsInterface function and MUST return the constant value true if 0xd9b67a26 is passed through the interfaceID argument.

So to determine if the contract implement erc1155 you first try to check if the contract implement erc165, you can follow this guide to see if the contract implement erc165.

Then after that, you detect if the contract implement erc165, you just call to the contract supportInterface function with the interfaceId 0xd9b67a26 and if it return true, then it is erc1155 contract, else it is not properly implement erc1155.

Answered by haxerl on January 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP