Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- RoyaltyFeeManager
- Optimization enabled
- true
- Compiler version
- v0.8.7+commit.e28d00a7
- Optimization runs
- 888888
- EVM Version
- default
- Verified at
- 2023-03-20T11:08:10.556514Z
Constructor Arguments
0000000000000000000000001f244ab11440d258846c385aa0ae3be3c8cae994
Arg [0] (address) : 0x1f244ab11440d258846c385aa0ae3be3c8cae994
Contract source code
// Sources flattened with hardhat v2.9.3 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File @openzeppelin/contracts/interfaces/[email protected] // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; // File @openzeppelin/contracts/interfaces/[email protected] // OpenZeppelin Contracts v4.4.1 (interfaces/IERC2981.sol) pragma solidity ^0.8.0; /** * @dev Interface for the NFT Royalty Standard */ interface IERC2981 is IERC165 { /** * @dev 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); } // File contracts/interfaces/IRoyaltyFeeManager.sol pragma solidity ^0.8.0; interface IRoyaltyFeeManager { function calculateRoyaltyFeeAndGetRecipient( address collection, uint256 tokenId, uint256 amount ) external view returns (address, uint256); } // File contracts/interfaces/IRoyaltyFeeRegistry.sol pragma solidity ^0.8.0; interface IRoyaltyFeeRegistry { function updateRoyaltyInfoForCollection( address collection, address setter, address receiver, uint256 fee ) external; function updateRoyaltyFeeLimit(uint256 _royaltyFeeLimit) external; function royaltyInfo(address collection, uint256 amount) external view returns (address, uint256); function royaltyFeeInfoCollection(address collection) external view returns ( address, address, uint256 ); } // File contracts/RoyaltyFeeManager.sol pragma solidity ^0.8.0; /** * @title RoyaltyFeeManager * @notice It handles the logic to check and transfer royalty fees (if any). */ contract RoyaltyFeeManager is IRoyaltyFeeManager, Ownable { // https://eips.ethereum.org/EIPS/eip-2981 bytes4 public constant INTERFACE_ID_ERC2981 = 0x2a55205a; IRoyaltyFeeRegistry public immutable royaltyFeeRegistry; /** * @notice Constructor * @param _royaltyFeeRegistry address of the RoyaltyFeeRegistry */ constructor(address _royaltyFeeRegistry) { royaltyFeeRegistry = IRoyaltyFeeRegistry(_royaltyFeeRegistry); } /** * @notice Calculate royalty fee and get recipient * @param collection address of the NFT contract * @param tokenId tokenId * @param amount amount to transfer */ function calculateRoyaltyFeeAndGetRecipient( address collection, uint256 tokenId, uint256 amount ) external view override returns (address, uint256) { // 1. Check if there is a royalty info in the system (address receiver, uint256 royaltyAmount) = royaltyFeeRegistry.royaltyInfo(collection, amount); // 2. If the receiver is address(0), fee is null, check if it supports the ERC2981 interface if ((receiver == address(0)) || (royaltyAmount == 0)) { if (IERC165(collection).supportsInterface(INTERFACE_ID_ERC2981)) { (receiver, royaltyAmount) = IERC2981(collection).royaltyInfo(tokenId, amount); } } return (receiver, royaltyAmount); } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_royaltyFeeRegistry","internalType":"address"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"INTERFACE_ID_ERC2981","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateRoyaltyFeeAndGetRecipient","inputs":[{"type":"address","name":"collection","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRoyaltyFeeRegistry"}],"name":"royaltyFeeRegistry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x60a060405234801561001057600080fd5b5060405161083138038061083183398101604081905261002f9161009d565b6100383361004d565b60601b6001600160601b0319166080526100cd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100af57600080fd5b81516001600160a01b03811681146100c657600080fd5b9392505050565b60805160601c61073f6100f26000396000818161012201526103ad015261073f6000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063c16f515611610050578063c16f51561461011d578063f2fde38b14610144578063f4f635fa1461015757600080fd5b8063715018a6146100775780638da5cb5b14610081578063b060dd86146100c5575b600080fd5b61007f610196565b005b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100ec7f2a55205a0000000000000000000000000000000000000000000000000000000081565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100bc565b61009b7f000000000000000000000000000000000000000000000000000000000000000081565b61007f61015236600461063e565b610228565b61016a610165366004610690565b610358565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016100bc565b60005473ffffffffffffffffffffffffffffffffffffffff16331461021c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61022660006105c9565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b73ffffffffffffffffffffffffffffffffffffffff811661034c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610213565b610355816105c9565b50565b6040517f2782d6c700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018390526000918291829182917f00000000000000000000000000000000000000000000000000000000000000001690632782d6c790604401604080518083038186803b1580156103ee57600080fd5b505afa158015610402573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104269190610662565b909250905073ffffffffffffffffffffffffffffffffffffffff8216158061044c575080155b156105bd576040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f2a55205a00000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff8816906301ffc9a79060240160206040518083038186803b1580156104d657600080fd5b505afa1580156104ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050e91906106c5565b156105bd576040517f2a55205a000000000000000000000000000000000000000000000000000000008152600481018790526024810186905273ffffffffffffffffffffffffffffffffffffffff881690632a55205a90604401604080518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610662565b90925090505b90969095509350505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561065057600080fd5b813561065b816106e7565b9392505050565b6000806040838503121561067557600080fd5b8251610680816106e7565b6020939093015192949293505050565b6000806000606084860312156106a557600080fd5b83356106b0816106e7565b95602085013595506040909401359392505050565b6000602082840312156106d757600080fd5b8151801515811461065b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461035557600080fdfea26469706673582212200a2b4967448c7b89ef292d8d9d9f2de4b53e483efe232706fc5dcfc1131eb80964736f6c634300080700330000000000000000000000001f244ab11440d258846c385aa0ae3be3c8cae994
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063c16f515611610050578063c16f51561461011d578063f2fde38b14610144578063f4f635fa1461015757600080fd5b8063715018a6146100775780638da5cb5b14610081578063b060dd86146100c5575b600080fd5b61007f610196565b005b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100ec7f2a55205a0000000000000000000000000000000000000000000000000000000081565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100bc565b61009b7f0000000000000000000000001f244ab11440d258846c385aa0ae3be3c8cae99481565b61007f61015236600461063e565b610228565b61016a610165366004610690565b610358565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016100bc565b60005473ffffffffffffffffffffffffffffffffffffffff16331461021c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61022660006105c9565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b73ffffffffffffffffffffffffffffffffffffffff811661034c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610213565b610355816105c9565b50565b6040517f2782d6c700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018390526000918291829182917f0000000000000000000000001f244ab11440d258846c385aa0ae3be3c8cae9941690632782d6c790604401604080518083038186803b1580156103ee57600080fd5b505afa158015610402573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104269190610662565b909250905073ffffffffffffffffffffffffffffffffffffffff8216158061044c575080155b156105bd576040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f2a55205a00000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff8816906301ffc9a79060240160206040518083038186803b1580156104d657600080fd5b505afa1580156104ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050e91906106c5565b156105bd576040517f2a55205a000000000000000000000000000000000000000000000000000000008152600481018790526024810186905273ffffffffffffffffffffffffffffffffffffffff881690632a55205a90604401604080518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610662565b90925090505b90969095509350505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561065057600080fd5b813561065b816106e7565b9392505050565b6000806040838503121561067557600080fd5b8251610680816106e7565b6020939093015192949293505050565b6000806000606084860312156106a557600080fd5b83356106b0816106e7565b95602085013595506040909401359392505050565b6000602082840312156106d757600080fd5b8151801515811461065b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461035557600080fdfea26469706673582212200a2b4967448c7b89ef292d8d9d9f2de4b53e483efe232706fc5dcfc1131eb80964736f6c63430008070033