0

Is it possible to use both ERC721 and ERC1155 standards in the same staking contract, or would that require 2 separate contracts?

1
  • I have tried many approaches to get this to work, but no success. Even though I successfully corrected the event Declaration error, I couldn't get it to work. I don't think that the both ERCs are created to work in the same contract for now. Apr 10, 2023 at 16:09

2 Answers 2

1

Well, technically, why not.

You may need to implement some parts twice, with weird if/else statements. But some parts you can keep common.

Another, perhaps more important questions is whether you should use the same contract or not. There is no correct answer to that question. I would probably implement them separately to keep the contract(s) as small as possible, but possibly share some common functionality (via inheritance, for example).

-1

I am trying to do this right now and I am getting DeclarationError:

"error[5883]: DeclarationError: Event with same name and parameter types defined twice. --> lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol:25:5: | 25 | event ApprovalForAll(address indexed owner, address indexed operator, bool approved); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Note: Other declaration is here: --> lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol:36:5: | 36 | event ApprovalForAll(address indexed account, address indexed operator, bool approved); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "

I will try to work through this and post the result.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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