caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

2.3 KiB

ERC2981

Simple ERC2981 NFT Royalty Standard implementation.

Custom Errors

RoyaltyOverflow()

error RoyaltyOverflow()

The royalty fee numerator exceeds the fee denominator.

RoyaltyReceiverIsZeroAddress()

error RoyaltyReceiverIsZeroAddress()

The royalty receiver cannot be the zero address.

ERC2981

_feeDenominator()

function _feeDenominator() internal pure virtual returns (uint96)

Returns the denominator for the royalty amount.
Defaults to 10000, which represents fees in basis points.
Override this function to return a custom amount if needed.

supportsInterface(bytes4)

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    returns (bool result)

Returns true if this contract implements the interface defined by interfaceId.
See: https://eips.ethereum.org/EIPS/eip-165
This function call must use less than 30000 gas.

royaltyInfo(uint256,uint256)

function royaltyInfo(uint256 tokenId, uint256 salePrice)
    public
    view
    virtual
    returns (address receiver, uint256 royaltyAmount)

Returns the receiver and royaltyAmount for tokenId sold at salePrice.

_setDefaultRoyalty(address,uint96)

function _setDefaultRoyalty(address receiver, uint96 feeNumerator)
    internal
    virtual

Sets the default royalty receiver and feeNumerator.

Requirements:

  • receiver must not be the zero address.
  • feeNumerator must not be greater than the fee denominator.

_deleteDefaultRoyalty()

function _deleteDefaultRoyalty() internal virtual

Sets the default royalty receiver and feeNumerator to zero.

_setTokenRoyalty(uint256,address,uint96)

function _setTokenRoyalty(
    uint256 tokenId,
    address receiver,
    uint96 feeNumerator
) internal virtual

Sets the royalty receiver and feeNumerator for tokenId.

Requirements:

  • receiver must not be the zero address.
  • feeNumerator must not be greater than the fee denominator.

_resetTokenRoyalty(uint256)

function _resetTokenRoyalty(uint256 tokenId) internal virtual

Sets the royalty receiver and feeNumerator for tokenId to zero.