Skip to content
Lattice

ERC2981

Git Source

Inherits: IERC2981

Title: ERC2981

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)

Stateless Diamond facet for the ERC-2981 NFT Royalty Standard.

All logic — including admin auth — lives in ERC2981Lib. Pure delegator.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.6.1

Functions

royaltyInfo

Returns royalty information for a token sale.

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

Parameters

NameTypeDescription
tokenIduint256The NFT being sold.
salePriceuint256The sale price of the NFT (in any unit of exchange).

Returns

NameTypeDescription
<none>addressAddress of the royalty recipient.
<none>uint256The royalty payment amount.

setDefaultRoyalty

Sets the default royalty receiver and fraction. Admin-gated.

function setDefaultRoyalty(address receiver, uint96 feeNumerator) public virtual;

Parameters

NameTypeDescription
receiveraddress
feeNumeratoruint96

deleteDefaultRoyalty

Deletes the default royalty configuration. Admin-gated.

function deleteDefaultRoyalty() public virtual;

setTokenRoyalty

Sets a per-token royalty override. Admin-gated.

function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) public virtual;

Parameters

NameTypeDescription
tokenIduint256
receiveraddress
feeNumeratoruint96

resetTokenRoyalty

Removes the per-token royalty override. Admin-gated.

function resetTokenRoyalty(uint256 tokenId) public virtual;

Parameters

NameTypeDescription
tokenIduint256

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect ERC2981 methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: deleteDefaultRoyalty() 0xaa1b103f resetTokenRoyalty(uint256) 0x8a616bc0 royaltyInfo(uint256,uint256) 0x2a55205a setDefaultRoyalty(address,uint96) 0x04634d8d setTokenRoyalty(uint256,address,uint96) 0x5944c753

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes