RoyaltyManager

Git Source

Inherits: IRoyaltyManager

Author: fx(hash)

See the documentation in {IRoyaltyManager}

State Variables

baseRoyalties

Returns royalty information of index in array list

RoyaltyInfo public baseRoyalties;

tokenRoyalties

Mapping of token ID to array of royalty information

mapping(uint256 => RoyaltyInfo) public tokenRoyalties;

Functions

getRoyalties

Gets the royalties for a specific token ID

function getRoyalties(uint256 _tokenId)
    external
    view
    returns (address[] memory receivers, uint256[] memory basisPoints);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
receiversaddress[]Total receivers and basis points
basisPointsuint256[]

royaltyInfo

Returns the royalty information for a specific token ID and sale price

function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 amount);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_salePriceuint256Sale price of the token

Returns

NameTypeDescription
receiveraddressAddress receiving royalties
amountuint256royaltyAmount Amount to royalties being paid out

_getOrCreateSplit

function _getOrCreateSplit(address[] calldata _receivers, uint32[] calldata _allocations)
    internal
    returns (address receiver);

_setBaseRoyalties

Sets the base royalties for all tokens

function _setBaseRoyalties(address[] calldata _receivers, uint32[] calldata _allocations, uint96 _basisPoints)
    internal
    virtual;

Parameters

NameTypeDescription
_receiversaddress[]Array of addresses receiving royalties
_allocationsuint32[]Array of allocation amounts for calculating royalty shares
_basisPointsuint96Total allocation scalar for calculating royalty shares

_setTokenRoyalties

compute split if necessary

Sets the royalties for a specific token ID

function _setTokenRoyalties(uint256 _tokenId, address _receiver, uint96 _basisPoints) internal;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_receiveraddressAddress receiving royalty payments
_basisPointsuint96Total allocation scalar for calculating royalty shares

_exists

Checks if the token ID exists

function _exists(uint256 _tokenId) internal view virtual returns (bool);

_checkRoyalties

*Checks if:

  1. Total basis points of royalties exceeds 10,000 (100%)
  2. A single receiver exceeds 2,500 (25%)*
function _checkRoyalties(address[] memory _receivers, uint32[] memory _allocations, uint96 _basisPoints)
    internal
    pure;