0

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?

0

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.

  • thanks for the input. But just because we implement an interface doesn't validate that it is implemented properly. So was hoping for some integration test harness for the ERC-1155 interfaces. – Steven T. Cramer Sep 15 at 18:30
  • 1
    @StevenT.Cramer i think the only way to do it now is to call every standard erc1155 function to see if each standard function work. Then after that you can try the fallback function for the contract. And if all that work try to transfer token to contract address one implement tokenReceived and one not to see how it’s respond. Or transfer token from contract address to another. – haxerl Sep 16 at 17:25
  • I think so. I have looked around and the reference implementation doesn't even run and there are 3 issues that have no comment. So I think the answer is ... write my own integration tests to test the standard. And I guess I hope I get it right. – Steven T. Cramer Sep 17 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.