Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- RoyaltyFeeRegistry
- Optimization enabled
- true
- Compiler version
- v0.8.7+commit.e28d00a7
- Optimization runs
- 888888
- EVM Version
- default
- Verified at
- 2023-02-28T08:50:15.046138Z
Constructor Arguments
000000000000000000000000000000000000000000000000000000000000251c
Arg [0] (uint256) : 9500
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 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/royaltyFeeHelpers/RoyaltyFeeRegistry.sol
pragma solidity ^0.8.0;
/**
* @title RoyaltyFeeRegistry
* @notice It is a royalty fee registry for the MojitoNFT exchange.
*/
contract RoyaltyFeeRegistry is IRoyaltyFeeRegistry, Ownable {
struct FeeInfo {
address setter;
address receiver;
uint256 fee;
}
// Limit (if enforced for fee royalty in percentage (10,000 = 100%)
uint256 public royaltyFeeLimit;
mapping(address => FeeInfo) private _royaltyFeeInfoCollection;
event NewRoyaltyFeeLimit(uint256 royaltyFeeLimit);
event RoyaltyFeeUpdate(address indexed collection, address indexed setter, address indexed receiver, uint256 fee);
/**
* @notice Constructor
* @param _royaltyFeeLimit new royalty fee limit (500 = 5%, 1,000 = 10%)
*/
constructor(uint256 _royaltyFeeLimit) {
require(_royaltyFeeLimit <= 9500, "Owner: Royalty fee limit too high");
royaltyFeeLimit = _royaltyFeeLimit;
}
/**
* @notice Update royalty info for collection
* @param _royaltyFeeLimit new royalty fee limit (500 = 5%, 1,000 = 10%)
*/
function updateRoyaltyFeeLimit(uint256 _royaltyFeeLimit) external override onlyOwner {
require(_royaltyFeeLimit <= 9500, "Owner: Royalty fee limit too high");
royaltyFeeLimit = _royaltyFeeLimit;
emit NewRoyaltyFeeLimit(_royaltyFeeLimit);
}
/**
* @notice Update royalty info for collection
* @param collection address of the NFT contract
* @param setter address that sets the receiver
* @param receiver receiver for the royalty fee
* @param fee fee (500 = 5%, 1,000 = 10%)
*/
function updateRoyaltyInfoForCollection(
address collection,
address setter,
address receiver,
uint256 fee
) external override onlyOwner {
require(fee <= royaltyFeeLimit, "Registry: Royalty fee too high");
_royaltyFeeInfoCollection[collection] = FeeInfo({setter: setter, receiver: receiver, fee: fee});
emit RoyaltyFeeUpdate(collection, setter, receiver, fee);
}
/**
* @notice Calculate royalty info for a collection address and a sale gross amount
* @param collection collection address
* @param amount amount
* @return receiver address and amount received by royalty recipient
*/
function royaltyInfo(address collection, uint256 amount) external view override returns (address, uint256) {
return (
_royaltyFeeInfoCollection[collection].receiver,
(amount * _royaltyFeeInfoCollection[collection].fee) / 10000
);
}
/**
* @notice View royalty info for a collection address
* @param collection collection address
*/
function royaltyFeeInfoCollection(address collection)
external
view
override
returns (
address,
address,
uint256
)
{
return (
_royaltyFeeInfoCollection[collection].setter,
_royaltyFeeInfoCollection[collection].receiver,
_royaltyFeeInfoCollection[collection].fee
);
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint256","name":"_royaltyFeeLimit","internalType":"uint256"}]},{"type":"event","name":"NewRoyaltyFeeLimit","inputs":[{"type":"uint256","name":"royaltyFeeLimit","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoyaltyFeeUpdate","inputs":[{"type":"address","name":"collection","internalType":"address","indexed":true},{"type":"address","name":"setter","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"fee","internalType":"uint256","indexed":false}],"anonymous":false},{"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":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"royaltyFeeInfoCollection","inputs":[{"type":"address","name":"collection","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"royaltyFeeLimit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"royaltyInfo","inputs":[{"type":"address","name":"collection","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRoyaltyFeeLimit","inputs":[{"type":"uint256","name":"_royaltyFeeLimit","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRoyaltyInfoForCollection","inputs":[{"type":"address","name":"collection","internalType":"address"},{"type":"address","name":"setter","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"fee","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50604051610a2d380380610a2d83398101604081905261002f916100f0565b610038336100a0565b61251c8111156100985760405162461bcd60e51b815260206004820152602160248201527f4f776e65723a20526f79616c747920666565206c696d697420746f6f206869676044820152600d60fb1b606482015260840160405180910390fd5b600155610109565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561010257600080fd5b5051919050565b610915806101186000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063b9223c9d1161005b578063b9223c9d1461011a578063bbdf9b681461012d578063e31ef91c14610140578063f2fde38b146101bf57600080fd5b80632782d6c71461008d5780634fb7d3f9146100d1578063715018a6146100e85780638da5cb5b146100f2575b600080fd5b6100a061009b3660046107fd565b6101d2565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152015b60405180910390f35b6100da60015481565b6040519081526020016100c8565b6100f061022c565b005b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100c8565b6100f0610128366004610827565b6102be565b6100f061013b3660046107b2565b61040c565b61018c61014e366004610790565b73ffffffffffffffffffffffffffffffffffffffff908116600090815260026020819052604090912080546001820154919092015491831693921691565b6040805173ffffffffffffffffffffffffffffffffffffffff9485168152939092166020840152908201526060016100c8565b6100f06101cd366004610790565b6105c2565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600260208190526040822060018101549101549192839291169061271090610217908661087b565b6102219190610840565b915091509250929050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102bc60006106f2565b565b60005473ffffffffffffffffffffffffffffffffffffffff16331461033f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a9565b61251c8111156103d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4f776e65723a20526f79616c747920666565206c696d697420746f6f2068696760448201527f680000000000000000000000000000000000000000000000000000000000000060648201526084016102a9565b60018190556040518181527f2da7166c72ef3860ef4fb2571105533c40615269a6dbc38ce0b264910df1c2569060200160405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff16331461048d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a9565b6001548111156104f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f52656769737472793a20526f79616c74792066656520746f6f2068696768000060448201526064016102a9565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff85811680835285821660208085018281528587018881528b861660008181526002808652908a9020985189549089167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178a55935160018a0180549190991694169390931790965551950194909455935185815290927fd01984afa6e37420452e575e7d99dd7e632b3ec8ea2adec998475b76ca494d64910160405180910390a450505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a9565b73ffffffffffffffffffffffffffffffffffffffff81166106e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102a9565b6106ef816106f2565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461078b57600080fd5b919050565b6000602082840312156107a257600080fd5b6107ab82610767565b9392505050565b600080600080608085870312156107c857600080fd5b6107d185610767565b93506107df60208601610767565b92506107ed60408601610767565b9396929550929360600135925050565b6000806040838503121561081057600080fd5b61081983610767565b946020939093013593505050565b60006020828403121561083957600080fd5b5035919050565b600082610876577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108da577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50029056fea26469706673582212205816f71beee0083475c01775c88e0456aab51cd8732d42aaa3f9932c18ea781a64736f6c63430008070033000000000000000000000000000000000000000000000000000000000000251c
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063b9223c9d1161005b578063b9223c9d1461011a578063bbdf9b681461012d578063e31ef91c14610140578063f2fde38b146101bf57600080fd5b80632782d6c71461008d5780634fb7d3f9146100d1578063715018a6146100e85780638da5cb5b146100f2575b600080fd5b6100a061009b3660046107fd565b6101d2565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152015b60405180910390f35b6100da60015481565b6040519081526020016100c8565b6100f061022c565b005b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100c8565b6100f0610128366004610827565b6102be565b6100f061013b3660046107b2565b61040c565b61018c61014e366004610790565b73ffffffffffffffffffffffffffffffffffffffff908116600090815260026020819052604090912080546001820154919092015491831693921691565b6040805173ffffffffffffffffffffffffffffffffffffffff9485168152939092166020840152908201526060016100c8565b6100f06101cd366004610790565b6105c2565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600260208190526040822060018101549101549192839291169061271090610217908661087b565b6102219190610840565b915091509250929050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102bc60006106f2565b565b60005473ffffffffffffffffffffffffffffffffffffffff16331461033f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a9565b61251c8111156103d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4f776e65723a20526f79616c747920666565206c696d697420746f6f2068696760448201527f680000000000000000000000000000000000000000000000000000000000000060648201526084016102a9565b60018190556040518181527f2da7166c72ef3860ef4fb2571105533c40615269a6dbc38ce0b264910df1c2569060200160405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff16331461048d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a9565b6001548111156104f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f52656769737472793a20526f79616c74792066656520746f6f2068696768000060448201526064016102a9565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff85811680835285821660208085018281528587018881528b861660008181526002808652908a9020985189549089167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178a55935160018a0180549190991694169390931790965551950194909455935185815290927fd01984afa6e37420452e575e7d99dd7e632b3ec8ea2adec998475b76ca494d64910160405180910390a450505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a9565b73ffffffffffffffffffffffffffffffffffffffff81166106e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102a9565b6106ef816106f2565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461078b57600080fd5b919050565b6000602082840312156107a257600080fd5b6107ab82610767565b9392505050565b600080600080608085870312156107c857600080fd5b6107d185610767565b93506107df60208601610767565b92506107ed60408601610767565b9396929550929360600135925050565b6000806040838503121561081057600080fd5b61081983610767565b946020939093013593505050565b60006020828403121561083957600080fd5b5035919050565b600082610876577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108da577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50029056fea26469706673582212205816f71beee0083475c01775c88e0456aab51cd8732d42aaa3f9932c18ea781a64736f6c63430008070033