include erc1155 metadata supportsInterface

This commit is contained in:
Moon Man 2023-01-29 17:22:15 -05:00
parent e8936b07ab
commit 02a3164658
3 changed files with 33 additions and 2 deletions

View File

@ -5,11 +5,12 @@ import "./ERC1155.sol";
import "./IMastersFedi.sol";
import "./Address.sol";
import "./IERC1155Metadata.sol";
import "./ERC1155Metadata.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable {
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, Ownable {
using Address for address;
mapping (uint256 => address) public contracts;
@ -73,6 +74,16 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable {
urls[_id] = _url;
}
/**
@notice Query if a contract implements an interface
@param _interfaceId The interface identifier, as specified in ERC-165
@return `true` if the contract implements `_interfaceId`
*/
function supportsInterface(bytes4 _interfaceId) public pure override(ERC1155, ERC1155Metadata) returns (bool) {
return ERC1155.supportsInterface(_interfaceId)
|| ERC1155Metadata.supportsInterface(_interfaceId);
}
/**
@notice If NFT ID exists
@dev Makes OpenSea happy
@ -161,7 +172,7 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable {
IMastersFedi curio = IMastersFedi(tokenContract);
require(balances[_id][msg.sender] >= _quantity, "insufficient balance");
balances[_id][msg.sender] -= _quantity;
balances[_id][msg.sender] -= _quantity;
curio.transfer(msg.sender, _quantity);

View File

@ -36,6 +36,7 @@ contract ERC1155 is IERC1155, ERC165, CommonConstants
function supportsInterface(bytes4 _interfaceId)
public
pure
virtual
returns (bool) {
if (_interfaceId == INTERFACE_SIGNATURE_ERC165 ||
_interfaceId == INTERFACE_SIGNATURE_ERC1155) {

View File

@ -0,0 +1,19 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.17;
import "./IERC1155Metadata.sol";
contract ERC1155Metadata {
/**
@notice Query if a contract implements an interface
@param _interfaceId The interface identifier, as specified in ERC-165
@return `true` if the contract implements `_interfaceID`
*/
function supportsInterface(bytes4 _interfaceId) public virtual pure returns (bool) {
if (_interfaceId == type(ERC1155Metadata_URI).interfaceId) {
return true;
}
else return false;
}
}