Royalty
Royalty
Thirdweb's Royalty
is a contract extension to be used with any base contract. It exposes functions for setting and reading the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic that uses information about royalty fees, if desired.
The Royalty
contract is ERC2981 compliant.
Methods
getDefaultRoyaltyInfo
Returns the defualt royalty recipient and BPS for this contract's NFTs.
Returns
_0
address
undefined
_1
uint16
undefined
getRoyaltyInfoForToken
View royalty info for a given token.
Returns royalty recipient and bps for _tokenId
.
Parameters
_tokenId
uint256
The tokenID of the NFT for which to query royalty info.
Returns
_0
address
undefined
_1
uint16
undefined
royaltyInfo
View royalty info for a given token and sale price.
Returns royalty amount and recipient for tokenId
and salePrice
.
Parameters
tokenId
uint256
The tokenID of the NFT for which to query royalty info.
salePrice
uint256
Sale price of the token.
Returns
receiver
address
Address of royalty recipient account.
royaltyAmount
uint256
Royalty amount calculated at current royaltyBps value.
setDefaultRoyaltyInfo
Updates default royalty recipient and bps.
Caller should be authorized to set royalty info. See {_canSetRoyaltyInfo}. Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}.
Parameters
_royaltyRecipient
address
Address to be set as default royalty recipient.
_royaltyBps
uint256
Updated royalty bps.
setRoyaltyInfoForToken
Updates default royalty recipient and bps for a particular token.
Sets royalty info for _tokenId
. Caller should be authorized to set royalty info. See {_canSetRoyaltyInfo}. Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}.
Parameters
_tokenId
uint256
undefined
_recipient
address
Address to be set as royalty recipient for given token Id.
_bps
uint256
Updated royalty bps for the token Id.
supportsInterface
Returns true if this contract implements the interface defined by interfaceId
. See the corresponding EIP section to learn more about how these ids are created. This function call must use less than 30 000 gas.
Parameters
interfaceId
bytes4
undefined
Returns
_0
bool
undefined
Events
DefaultRoyalty
Parameters
newRoyaltyRecipient indexed
address
undefined
newRoyaltyBps
uint256
undefined
RoyaltyForToken
Parameters
tokenId indexed
uint256
undefined
royaltyRecipient indexed
address
undefined
royaltyBps
uint256
undefined
Last updated