royalty reporting and default royalty, untested, may add specific royalties later
This commit is contained in:
parent
abb21e0873
commit
4d66247dd3
|
@ -10,13 +10,16 @@ import "@openzeppelin/contracts/utils/Strings.sol";
|
||||||
import "@openzeppelin/contracts/utils/Base64.sol";
|
import "@openzeppelin/contracts/utils/Base64.sol";
|
||||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||||
import "@openzeppelin/contracts/security/Pausable.sol";
|
import "@openzeppelin/contracts/security/Pausable.sol";
|
||||||
|
import "@openzeppelin/contracts/token/common/ERC2981.sol";
|
||||||
|
|
||||||
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, Ownable, Pausable {
|
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, ERC2981, Ownable, Pausable {
|
||||||
using Address for address;
|
using Address for address;
|
||||||
|
|
||||||
mapping (uint256 => address) public contracts;
|
mapping (uint256 => address) public contracts;
|
||||||
mapping (uint256 => string) public urls;
|
mapping (uint256 => string) public urls;
|
||||||
|
|
||||||
|
uint96 internal defaultRoyalty = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@notice Initialize an nft id's data
|
@notice Initialize an nft id's data
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +44,13 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
||||||
create(7, 0x5e7318f75b177a0F27A31CB20bB26bd0C049620c, "https://twitter.com/sonyasupposedly");
|
create(7, 0x5e7318f75b177a0F27A31CB20bB26bd0C049620c, "https://twitter.com/sonyasupposedly");
|
||||||
create(8, 0x5539907D45a608828756765429f2B4e6311c295c, "https://shpposter.club/users/shpuld");
|
create(8, 0x5539907D45a608828756765429f2B4e6311c295c, "https://shpposter.club/users/shpuld");
|
||||||
create(9, 0x0a0e64067B1F7aDfbF876Dde4322633Ff7Df9702, "https://bbs.kawa-kun.com/users/tk");
|
create(9, 0x0a0e64067B1F7aDfbF876Dde4322633Ff7Df9702, "https://bbs.kawa-kun.com/users/tk");
|
||||||
|
|
||||||
|
_setDefaultRoyalty(msg.sender, defaultRoyalty);
|
||||||
|
}
|
||||||
|
|
||||||
|
function transferOwnership(address newOwner) public override onlyOwner {
|
||||||
|
_setDefaultRoyalty(newOwner, defaultRoyalty);
|
||||||
|
super.transferOwnership(newOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,9 +91,11 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
||||||
@param _interfaceId The interface identifier, as specified in ERC-165
|
@param _interfaceId The interface identifier, as specified in ERC-165
|
||||||
@return `true` if the contract implements `_interfaceId`
|
@return `true` if the contract implements `_interfaceId`
|
||||||
*/
|
*/
|
||||||
function supportsInterface(bytes4 _interfaceId) public pure override(ERC1155, ERC1155Metadata) returns (bool) {
|
function supportsInterface(bytes4 _interfaceId) public view override(ERC1155, ERC1155Metadata, ERC2981) returns (bool) {
|
||||||
return ERC1155.supportsInterface(_interfaceId)
|
return ERC1155.supportsInterface(_interfaceId)
|
||||||
|| ERC1155Metadata.supportsInterface(_interfaceId);
|
|| ERC1155Metadata.supportsInterface(_interfaceId)
|
||||||
|
|| ERC2981.supportsInterface(_interfaceId)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,7 +36,7 @@ contract ERC1155 is IERC1155, IERC165, CommonConstants
|
||||||
|
|
||||||
function supportsInterface(bytes4 _interfaceId)
|
function supportsInterface(bytes4 _interfaceId)
|
||||||
public
|
public
|
||||||
pure
|
view
|
||||||
virtual
|
virtual
|
||||||
returns (bool) {
|
returns (bool) {
|
||||||
if (_interfaceId == INTERFACE_SIGNATURE_ERC165 ||
|
if (_interfaceId == INTERFACE_SIGNATURE_ERC165 ||
|
||||||
|
|
|
@ -10,7 +10,7 @@ contract ERC1155Metadata {
|
||||||
@param _interfaceId The interface identifier, as specified in ERC-165
|
@param _interfaceId The interface identifier, as specified in ERC-165
|
||||||
@return `true` if the contract implements `_interfaceID`
|
@return `true` if the contract implements `_interfaceID`
|
||||||
*/
|
*/
|
||||||
function supportsInterface(bytes4 _interfaceId) public virtual pure returns (bool) {
|
function supportsInterface(bytes4 _interfaceId) public virtual view returns (bool) {
|
||||||
if (_interfaceId == type(ERC1155Metadata_URI).interfaceId) {
|
if (_interfaceId == type(ERC1155Metadata_URI).interfaceId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
pragma solidity ^0.8.17;
|
||||||
|
|
||||||
|
import "@openzeppelin/contracts/interfaces/IERC165.sol";
|
||||||
|
|
||||||
|
interface IERC2981 is IERC165 {
|
||||||
|
/// ERC165 bytes to add to interface array - set in parent contract
|
||||||
|
/// implementing this standard
|
||||||
|
///
|
||||||
|
/// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
|
||||||
|
/// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
|
||||||
|
/// _registerInterface(_INTERFACE_ID_ERC2981);
|
||||||
|
|
||||||
|
/// @notice Called with the sale price to determine how much royalty
|
||||||
|
// is owed and to whom.
|
||||||
|
/// @param _tokenId - the NFT asset queried for royalty information
|
||||||
|
/// @param _salePrice - the sale price of the NFT asset specified by _tokenId
|
||||||
|
/// @return receiver - address of who should be sent the royalty payment
|
||||||
|
/// @return royaltyAmount - the royalty payment amount for _salePrice
|
||||||
|
function royaltyInfo(
|
||||||
|
uint256 _tokenId,
|
||||||
|
uint256 _salePrice
|
||||||
|
) external view returns (
|
||||||
|
address receiver,
|
||||||
|
uint256 royaltyAmount
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue