Contract 0x55091b45e4a1bb494c52191323269c3a03893be7 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x79dd5b6e601ff38e3826e30f9d59936778067bfaa56019c8261b7092d851bed20x60a0604038799882022-07-27 8:28:51132 days 18 hrs ago0xa16226396d79dc7b3bc70de0daca4eef11742a9e IN  Create: RoyaltyFeeManager0 CRO1.9025965961150
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RoyaltyFeeManager

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 8 : RoyaltyFeeManager.sol
/**
                                                ....                      ....                              ....       
                                                 #@@@?                    ^@@@@                             :@@@@       
                                                 P&&&!                    :@@@@                             :@@@@       
     ....  ....  ....     .....................  ....   ............   [email protected]@@@:...   ............  [email protected]@@@       
    [email protected]@@&  @@@@: [email protected]@@Y   [email protected]@@@@@@@@@@@@@@@@@@@@. #@@@? [email protected]@@@@@@@@@@@~ [email protected]@@@@@@@@@@@^ [email protected]@@@@@@@@@@@. [email protected]@@@@@@@@@@@       
    [email protected]@@&  @@@@: [email protected]@@5   [email protected]@@@&&&&@@@@@&&&&@@@@. #@@@? [email protected]@@@&&&&@@@@~ 7&&&&@@@@&&&&: [email protected]@@@#&&&@@@@. [email protected]@@@&&&&@@@@       
    ~&&&G  #&&&. [email protected]@@5   [email protected]@@@.   [email protected]@@5   [email protected]@@@. #@@@? [email protected]@@&    &@@@~     ^@@@@      [email protected]@@[email protected]@@@. [email protected]@@Y   ^@@@@       
                 [email protected]@@5   [email protected]@@@.   [email protected]@@5   [email protected]@@@. #@@@? [email protected]@@&    &@@@~     ^@@@@      [email protected]@@@@@@@@@@@. [email protected]@@J   :@@@@       
                 [email protected]@@5   [email protected]@@@.   [email protected]@@5   [email protected]@@@. #@@@? [email protected]@@&    &@@@~     ^@@@@      [email protected]@@@#&&&##&#. [email protected]@@J   :@@@@       
     [email protected]@@5   [email protected]@@@.   [email protected]@@5   [email protected]@@@. #@@@? [email protected]@@&    &@@@~     ^@@@@      [email protected]@@G........  [email protected]@@[email protected]@@@       
    [email protected]@@@@@@@@@@@@@@@5   [email protected]@@@.   [email protected]@@5   [email protected]@@@. #@@@? [email protected]@@&    &@@@~     ^@@@@      [email protected]@@@@@@@@@@@. [email protected]@@@@@@@@@@@       
    ~&&&&&&&&&&&&&&&&?   .&&&#    Y&&&?   .&&&#. P&&&! ~&&&G    B&&&^     :&&&#      J&&&&&&&&&&&&. 5&&&&&&&&&&&#   
                                                                                                                                                                                            
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC165, IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";

import {IRoyaltyFeeManager} from "./interfaces/IRoyaltyFeeManager.sol";
import {IRoyaltyFeeRegistry} from "./interfaces/IRoyaltyFeeRegistry.sol";

/**
 * @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);
    }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @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 3 of 8 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

File 4 of 8 : IRoyaltyFeeManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IRoyaltyFeeManager {
    function calculateRoyaltyFeeAndGetRecipient(
        address collection,
        uint256 tokenId,
        uint256 amount
    ) external view returns (address, uint256);
}

File 5 of 8 : IRoyaltyFeeRegistry.sol
// SPDX-License-Identifier: MIT
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 6 of 8 : Context.sol
// 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 7 of 8 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";

File 8 of 8 : IERC165.sol
// SPDX-License-Identifier: MIT
// 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);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_royaltyFeeRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"INTERFACE_ID_ERC2981","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateRoyaltyFeeAndGetRecipient","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyFeeRegistry","outputs":[{"internalType":"contract IRoyaltyFeeRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b5060405161066b38038061066b83398101604081905261002f9161009d565b6100383361004d565b60601b6001600160601b0319166080526100cb565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100ae578081fd5b81516001600160a01b03811681146100c4578182fd5b9392505050565b60805160601c61057c6100ef6000396000818160c70152610293015261057c6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063b060dd861461009b578063c16f5156146100c2578063f2fde38b146100e9578063f4f635fa146100fc575b600080fd5b61006f61012e565b005b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100a963152a902d60e11b81565b6040516001600160e01b03199091168152602001610092565b61007e7f000000000000000000000000000000000000000000000000000000000000000081565b61006f6100f736600461048d565b610199565b61010f61010a3660046104dd565b610264565b604080516001600160a01b039093168352602083019190915201610092565b6000546001600160a01b0316331461018d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610197600061043d565b565b6000546001600160a01b031633146101f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610184565b6001600160a01b0381166102585760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610184565b6102618161043d565b50565b604051632782d6c760e01b81526001600160a01b038481166004830152602482018390526000918291829182917f00000000000000000000000000000000000000000000000000000000000000001690632782d6c790604401604080518083038186803b1580156102d457600080fd5b505afa1580156102e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030c91906104b0565b90925090506001600160a01b0382161580610325575080155b15610431576040516301ffc9a760e01b815263152a902d60e11b60048201526001600160a01b038816906301ffc9a79060240160206040518083038186803b15801561037057600080fd5b505afa158015610384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a89190610511565b156104315760405163152a902d60e11b815260048101879052602481018690526001600160a01b03881690632a55205a90604401604080518083038186803b1580156103f357600080fd5b505afa158015610407573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042b91906104b0565b90925090505b90969095509350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561049e578081fd5b81356104a981610531565b9392505050565b600080604083850312156104c2578081fd5b82516104cd81610531565b6020939093015192949293505050565b6000806000606084860312156104f1578081fd5b83356104fc81610531565b95602085013595506040909401359392505050565b600060208284031215610522578081fd5b815180151581146104a9578182fd5b6001600160a01b038116811461026157600080fdfea26469706673582212201d3458112396465b2d3270265522f1ffd23648919107f25b17df28914553a51764736f6c6343000804003300000000000000000000000002c48e6ad5443b0439e177b7a221b3584114a1a8

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000002c48e6ad5443b0439e177b7a221b3584114a1a8

-----Decoded View---------------
Arg [0] : _royaltyFeeRegistry (address): 0x02c48e6ad5443b0439e177b7a221b3584114a1a8

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000002c48e6ad5443b0439e177b7a221b3584114a1a8


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.