IRevenueDistributor

Git Source

Title: IRevenueDistributor

Interface for simple revenue distribution to configured recipients

Non-upgradeable contract implementing EIP-2981 royalty standard

Pure distribution logic - payment timing and penalties handled by calling contracts (e.g., Marketplace)

Functions

configureSplit

Configures revenue split for an IP asset

Only callable by IP asset owner or CONFIGURATOR_ROLE

function configureSplit(uint256 ipAssetId, address[] memory recipients, uint256[] memory shares) external;

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID
recipientsaddress[]Array of recipient addresses
sharesuint256[]Array of share amounts in basis points (must sum to 10000)

distributePayment

Distributes a payment according to configured splits

Deducts platform fee then splits remainder among recipients

function distributePayment(uint256 ipAssetId, uint256 amount, address seller, bool isPrimarySale) external payable;

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID
amountuint256Payment amount to distribute
selleraddressAddress of the seller (receives remainder for secondary sales)
isPrimarySaleboolTrue for primary sales (100% to split), false for secondary (royalty to split, remainder to seller)

withdraw

Withdraws accumulated funds

All recipients (including platform treasury) use this function to withdraw

function withdraw() external;

getBalance

Gets the principal balance for a recipient

function getBalance(address recipient) external view returns (uint256 balance);

Parameters

NameTypeDescription
recipientaddressAddress to query

Returns

NameTypeDescription
balanceuint256Principal amount available for withdrawal

setDefaultRoyalty

Sets the default royalty rate

Only callable by admin

function setDefaultRoyalty(uint256 basisPoints) external;

Parameters

NameTypeDescription
basisPointsuint256Royalty rate in basis points

setAssetRoyalty

Configure royalty rate for a specific IP asset

Only callable by CONFIGURATOR_ROLE

function setAssetRoyalty(uint256 ipAssetId, uint256 basisPoints) external;

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID
basisPointsuint256Royalty rate in basis points (e.g., 1000 = 10%)

getAssetRoyalty

Get royalty rate for an IP asset (custom or default)

function getAssetRoyalty(uint256 ipAssetId) external view returns (uint256);

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID

Returns

NameTypeDescription
<none>uint256Royalty rate in basis points

grantConfiguratorRole

Grants CONFIGURATOR_ROLE to the IPAsset contract

Only callable by admin. Should be called after IPAsset deployment.

function grantConfiguratorRole(address ipAssetContract) external;

Parameters

NameTypeDescription
ipAssetContractaddressAddress of the IPAsset contract

ipSplits

Gets the configured split for an IP asset

function ipSplits(uint256 ipAssetId) external view returns (address[] memory recipients, uint256[] memory shares);

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID

Returns

NameTypeDescription
recipientsaddress[]Array of recipient addresses
sharesuint256[]Array of share amounts

isSplitConfigured

Checks if a split is configured for an IP asset

function isSplitConfigured(uint256 ipAssetId) external view returns (bool configured);

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID

Returns

NameTypeDescription
configuredboolTrue if split exists, false otherwise

Events

PaymentDistributed

Emitted when a payment is distributed

event PaymentDistributed(uint256 indexed ipAssetId, uint256 amount, address indexed seller, bool isPrimarySale);

Parameters

NameTypeDescription
ipAssetIduint256The IP asset the payment is for
amountuint256Total payment amount
selleraddressAddress of the seller
isPrimarySaleboolWhether this is a primary sale (seller is in split recipients)

SplitConfigured

Emitted when a revenue split is configured

event SplitConfigured(uint256 indexed ipAssetId, address[] recipients, uint256[] shares);

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID
recipientsaddress[]Array of recipient addresses
sharesuint256[]Array of share amounts

Withdrawal

Emitted when a recipient withdraws funds

event Withdrawal(address indexed recipient, uint256 principal);

Parameters

NameTypeDescription
recipientaddressAddress withdrawing
principaluint256Principal amount withdrawn

RoyaltyUpdated

Emitted when default royalty rate is updated

event RoyaltyUpdated(uint256 newRoyaltyBasisPoints);

Parameters

NameTypeDescription
newRoyaltyBasisPointsuint256New royalty rate in basis points

AssetRoyaltyUpdated

Emitted when a per-asset royalty rate is updated

event AssetRoyaltyUpdated(uint256 indexed ipAssetId, uint256 basisPoints);

Parameters

NameTypeDescription
ipAssetIduint256The IP asset ID
basisPointsuint256New royalty rate in basis points

Errors

ArrayLengthMismatch

Thrown when array lengths don't match

error ArrayLengthMismatch();

NoRecipientsProvided

Thrown when no recipients are provided

error NoRecipientsProvided();

InvalidRecipient

Thrown when a recipient address is zero

error InvalidRecipient();

InvalidSharesSum

Thrown when shares don't sum to 10000 basis points

error InvalidSharesSum();

IncorrectPaymentAmount

Thrown when msg.value doesn't match amount parameter

error IncorrectPaymentAmount();

InvalidIPAsset

Thrown when IP asset does not exist

error InvalidIPAsset();

NoBalanceToWithdraw

Thrown when attempting to withdraw with zero balance

error NoBalanceToWithdraw();

TransferFailed

Thrown when ETH transfer fails during withdrawal

error TransferFailed();

InvalidTreasuryAddress

Thrown when treasury address is zero

error InvalidTreasuryAddress();

InvalidPlatformFee

Thrown when platform fee exceeds 100%

error InvalidPlatformFee();

InvalidRoyalty

Thrown when royalty rate exceeds 100%

error InvalidRoyalty();

InvalidIPAssetAddress

Thrown when IPAsset contract address is zero

error InvalidIPAssetAddress();

InvalidBasisPoints

Thrown when basis points exceeds 10000 (100%)

error InvalidBasisPoints();

InvalidRoyaltyRate

Thrown when royalty rate exceeds 100%

error InvalidRoyaltyRate();

Structs

Split

Revenue split configuration for an IP asset

struct Split {
    address[] recipients;
    uint256[] shares;
}

Properties

NameTypeDescription
recipientsaddress[]Array of addresses to receive revenue shares
sharesuint256[]Array of share amounts in basis points (must sum to 10000)