RoyaltyPayoutHelper
Inherits: TransferHelper, SanctionsCompliance
Author: transientlabs.xyz
Abstract contract to help payout royalties using the Royalty Registry
Does not manage updating the sanctions oracle and expects the child contract to implement
State Variables
weth
address public weth;
royaltyEngine
IRoyaltyEngineV1 public royaltyEngine;
Functions
constructor
constructor(address sanctionsOracle, address wethAddress, address royaltyEngineAddress)
SanctionsCompliance(sanctionsOracle);
Parameters
Name | Type | Description |
---|---|---|
sanctionsOracle | address | - the init sanctions oracle |
wethAddress | address | - the init weth address |
royaltyEngineAddress | address | - the init royalty engine address |
_setWethAddress
Function to update the WETH address
Care should be taken to ensure proper access control for this function
function _setWethAddress(address wethAddress) internal;
Parameters
Name | Type | Description |
---|---|---|
wethAddress | address | The new WETH token address |
_setRoyaltyEngineAddress
Function to update the royalty engine address
Care should be taken to ensure proper access control for this function
function _setRoyaltyEngineAddress(address royaltyEngineAddress) internal;
Parameters
Name | Type | Description |
---|---|---|
royaltyEngineAddress | address | The new royalty engine address |
_payoutRoyalties
Function to payout royalties from the contract balance based on sale price
if the call to the royalty engine reverts or if the return values are invalid, no payments are made
if the sum of the royalty payouts is greater than the salePrice, the loop exits early for gas savings (this shouldn't happen in reality)
if this is used in a call where tokens should be transferred from a sender, it is advisable to first transfer the required amount to the contract and then call this function, as it will save on gas
function _payoutRoyalties(address token, uint256 tokenId, address currency, uint256 salePrice)
internal
returns (uint256 remainingSale);
Parameters
Name | Type | Description |
---|---|---|
token | address | The contract address for the token |
tokenId | uint256 | The token id |
currency | address | The address of the currency to send to recipients (null address == ETH) |
salePrice | uint256 | The sale price for the token |
Returns
Name | Type | Description |
---|---|---|
remainingSale | uint256 | The amount left over in the sale after paying out royalties |