RoyaltyEngineV1
RoyaltyEngineV1
Author: Ninfa's fork of Manifold's RoyaltyRegistryV1 *
Custom implementation of Manifold RoyaltyEngineV1 *
*> "Marketplaces may choose to directly inherit the * Royalty Engine to save a bit of gas". **
*ERC165 was removed because interface selector will * be different from Manifold's (0xcb23f816) and this engine * implementation is not meant for used by other contracts **
*the original RoyaltyEngineV1 has been modified by removing the _specCache and the associated code, using try catch statements is very cheap, no need to store _specCache mapping, see {RoyaltyEngineV1-_specCache}.
https://www.reddit.com/r/ethdev/comments/szot8r/comment/hy5vsxb/*
Note: security-contact: [email protected] *
State Variables
SUPERRARE_REGISTRY
address internal constant SUPERRARE_REGISTRY = 0x17B0C8564E53f22364A6C8de6F7ca5CE9BEa4e5D;SUPERRARE_V1
address internal constant SUPERRARE_V1 = 0x41A322b28D0fF354040e2CbC676F0320d8c8850d;SUPERRARE_V2
Functions
getRoyalty
Get the royalties for a given token and sale amount.
Parameters
tokenAddress
address
- address of token
tokenId
uint256
- id of token
value
uint256
- sale value of token Returns two arrays, first is the list of royalty recipients, second is the amounts for each recipient.
_getRoyalty
Control-flow hijack and gas griefing vulnerability within Manifold's RoyaltyEngine, mitigated in https://github.com/manifoldxyz/royalty-registry-solidity/commit/c5ba6db3e04e0b364f7afd7aae853a25542a7439. "To mitigate the griefing vector and other potential vulnerabilities, limit the gas by default that _getRoyalty is given to at most 50,000 gas, but certainly no more than 100,000 gas."
https://githubrecord.com/issue/manifoldxyz/royalty-registry-solidity/17/1067105243 However, Ninfa's ERC-2981 implementation (ERC2981N) needs to write to storage upon primary sales, this consumes 800,000 at most gas, while it only reads from storage upon secondary sales, see {ERC2981N-rotaltyInfo}*
Get the royalty for a given token
*the original RoyaltyEngineV1 has been modified by removing the _specCache and the associated code, using try catch statements is very cheap, no need to store _specCache mapping, see {RoyaltyEngineV1-_specCache}.
https://www.reddit.com/r/ethdev/comments/szot8r/comment/hy5vsxb/*
EIP-2981 standard lookup is performed first unlike Manifold's implementation, as it is the most prevalent royalty standard as well as the one being used by Ninfa's collections
Returns
recipients
address payable[]
array and amounts array, if no royalty standard has been found, the returned arrays will be empty
amounts
uint256[]
_computeAmounts
Compute royalty amounts
Errors
Unauthorized
InvalidAmount
LengthMismatch
Last updated