我得到这个错误ERC1155: transfer to non ERC1155Receiver implementer
当尝试转移到智能合约时,我发现了这个文档https://docs.openzeppelin.com/contracts/4.x/api/token/erc1155,但仍然不知道如何解决这个问题,我是否必须在我的持有人令牌1155中抽象IERC1155Receiver
接口
接收合同需要根据ERC-721定义实现onERC1155BatchReceived()
功能。
pragma solidity ^0.8;
contract MyContract {
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes memory _data) external returns(bytes4) {
// here you can (but don't have to) define your own logic - emit an event, set a storage value, ...
// this is the required return value described in the EIP-721
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
}