RoyaltyPayoutHelperUpgradeable
Inherits: SanctionsComplianceUpgradeable, TransferHelper
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
RoyaltyPayoutHelperStorageLocation
bytes32 private constant RoyaltyPayoutHelperStorageLocation =
0x9ab1d1ca9bfa2c669468b724939724262b3f2887db3df18c90168701d6422700;
Functions
_getRoyaltyPayoutHelperStorage
function _getRoyaltyPayoutHelperStorage() private pure returns (RoyaltyPayoutHelperStorage storage $);
__RoyaltyPayoutHelper_init
Function to initialize the contract
function __RoyaltyPayoutHelper_init(address sanctionsOracle, address wethAddress, address royaltyEngineAddress)
internal
onlyInitializing;
Parameters
Name | Type | Description |
---|---|---|
sanctionsOracle | address | - the init sanctions oracle |
wethAddress | address | - the init weth address |
royaltyEngineAddress | address | - the init royalty engine address |
__RoyaltyPayoutHelper_init_unchained
unchained function to initialize the contract
function __RoyaltyPayoutHelper_init_unchained(address wethAddress, address royaltyEngineAddress)
internal
onlyInitializing;
Parameters
Name | Type | Description |
---|---|---|
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 |
weth
Function to get the current WETH address
function weth() public view returns (address);
royaltyEngine
Function to get the royalty registry
function royaltyEngine() public view returns (IRoyaltyEngineV1);
Structs
RoyaltyPayoutHelperStorage
struct RoyaltyPayoutHelperStorage {
address weth;
IRoyaltyEngineV1 royaltyEngine;
}