RoyaltyPolicyLAP.sol

Defines the logic for splitting royalties for a given ipId using a liquid absolute percentage mechanism

LAPRoyaltyData

The state data of the LAP royalty policy

Parameters

NameTypeDescription
struct LAPRoyaltyData {
  bool isUnlinkableToParents;
  address splitClone;
  address ancestorsVault;
  uint32 royaltyStack;
  bytes32 ancestorsHash;
}

TOTAL_RNFT_SUPPLY

uint32 TOTAL_RNFT_SUPPLY

Returns the percentage scale - 1000 rnfts represents 100%

MAX_PARENTS

uint256 MAX_PARENTS

Returns the maximum number of parents

MAX_ANCESTORS

uint256 MAX_ANCESTORS

Returns the maximum number of total ancestors.

The IP derivative tree is limited to 14 ancestors, which represents 3 levels of a binary tree 14 = 2+4+8

ROYALTY_MODULE

address ROYALTY_MODULE

Returns the RoyaltyModule address

LICENSING_MODULE

address LICENSING_MODULE

Returns the LicensingModule address

LIQUID_SPLIT_FACTORY

address LIQUID_SPLIT_FACTORY

Returns the 0xSplits LiquidSplitFactory address

LIQUID_SPLIT_MAIN

address LIQUID_SPLIT_MAIN

Returns the 0xSplits LiquidSplitMain address

ANCESTORS_VAULT_IMPL

address ANCESTORS_VAULT_IMPL

Returns the Ancestors Vault Implementation address

royaltyData

mapping(address => struct RoyaltyPolicyLAP.LAPRoyaltyData) royaltyData

Returns the royalty data for a given IP asset

onlyRoyaltyModule

modifier onlyRoyaltyModule()

Restricts the calls to the royalty module

constructor

constructor(address royaltyModule, address licensingModule, address liquidSplitFactory, address liquidSplitMain, address governance) public

receive

receive() external payable

setAncestorsVaultImplementation

function setAncestorsVaultImplementation(address ancestorsVaultImpl) external

Set the ancestors vault implementation address
Enforced to be only callable by the protocol admin in governance

Parameters

NameTypeDescription
ancestorsVaultImpladdressThe ancestors vault implementation address

onLicenseMinting

function onLicenseMinting(address ipId, bytes licenseData, bytes externalData) external

Executes royalty related logic on minting a license

Enforced to be only callable by RoyaltyModule

Parameters

NameTypeDescription
ipIdaddressThe ipId whose license is being minted (licensor)
licenseDatabytesThe license data custom to each the royalty policy
externalDatabytesThe external data custom to each the royalty policy

onLinkToParents

function onLinkToParents(address ipId, address[] parentIpIds, bytes[] licenseData, bytes externalData) external

Executes royalty related logic on linking to parents

Enforced to be only callable by RoyaltyModule

Parameters

NameTypeDescription
ipIdaddressThe children ipId that is being linked to parents
parentIpIdsaddress[]The parent ipIds that the children ipId is being linked to
licenseDatabytes[]The license data custom to each the royalty policy
externalDatabytesThe external data custom to each the royalty policy

_initPolicy

function _initPolicy(address ipId, address[] parentIpIds, bytes[] licenseData, bytes externalData) internal

Initializes the royalty policy for a given IP asset.
Enforced to be only callable by RoyaltyModule

Parameters

NameTypeDescription
ipIdaddressThe to initialize the policy for
parentIpIdsaddress[]The parent ipIds that the children ipId is being linked to (if any)
licenseDatabytes[]The license data custom to each the royalty policy
externalDatabytesThe external data custom to each the royalty policy

onRoyaltyPayment

function onRoyaltyPayment(address caller, address ipId, address token, uint256 amount) external

Allows the caller to pay royalties to the given IP asset

Parameters

NameTypeDescription
calleraddressThe caller is the address from which funds will transferred from
ipIdaddressThe ipId of the receiver of the royalties
tokenaddressThe token to pay
amountuint256The amount to pay

distributeIpPoolFunds

function distributeIpPoolFunds(address ipId, address token, address[] accounts, address distributorAddress) external

Distributes funds internally so that accounts holding the royalty nfts at distribution moment can
claim afterwards

This call will revert if the caller holds all the royalty nfts of the ipId - in that case can call
claimFromIpPoolAsTotalRnftOwner() instead

Parameters

NameTypeDescription
ipIdaddressThe ipId whose received funds will be distributed
tokenaddressThe token to distribute
accountsaddress[]The accounts to distribute to
distributorAddressaddressThe distributor address (if any)

claimFromIpPool

function claimFromIpPool(address account, uint256 withdrawETH, contract ERC20[] tokens) external

Claims the available royalties for a given address

If there are no funds available in split main contract but there are funds in the split clone contract
then a distributeIpPoolFunds() call should precede this call

Parameters

NameTypeDescription
accountaddressThe account to claim for
withdrawETHuint256The amount of ETH to withdraw
tokenscontract ERC20[]The tokens to withdraw

claimFromIpPoolAsTotalRnftOwner

function claimFromIpPoolAsTotalRnftOwner(address ipId, uint256 withdrawETH, address token) external

Claims the available royalties for a given address that holds all the royalty nfts of an ipId

This call will revert if the caller does not hold all the royalty nfts of the ipId

Parameters

NameTypeDescription
ipIdaddressThe ipId whose received funds will be distributed
withdrawETHuint256The amount of ETH to withdraw
tokenaddressThe token to withdraw

claimFromAncestorsVault

function claimFromAncestorsVault(address ipId, address claimerIpId, address[] ancestors, uint32[] ancestorsRoyalties, bool withdrawETH, contract ERC20[] tokens) external

Claims all available royalty nfts and accrued royalties for an ancestor of a given ipId

Parameters

NameTypeDescription
ipIdaddressThe ipId of the ancestors vault to claim from
claimerIpIdaddressThe claimer ipId is the ancestor address that wants to claim
ancestorsaddress[]The ancestors for the selected ipId
ancestorsRoyaltiesuint32[]The royalties of the ancestors for the selected ipId
withdrawETHboolIndicates if the claimer wants to withdraw ETH
tokenscontract ERC20[]The ERC20 tokens to withdraw

_checkAncestorsDataIsValid

function _checkAncestorsDataIsValid(address[] parentIpIds, uint32[] parentRoyalties, struct IRoyaltyPolicyLAP.InitParams params) internal view returns (uint32)

Checks if the ancestors data is valid

Parameters

NameTypeDescription
parentIpIdsaddress[]The parent ipIds
parentRoyaltiesuint32[]The parent royalties
paramsstruct IRoyaltyPolicyLAP.InitParamsThe init params

Return Values

NameTypeDescription
[0]uint32newRoyaltyStack The new royalty stack

_getExpectedOutputs

function _getExpectedOutputs(address[] parentIpIds, uint32[] parentRoyalties, struct IRoyaltyPolicyLAP.InitParams params) internal view returns (address[] newAncestors, uint32[] newAncestorsRoyalty, uint32 ancestorsCount, uint32 royaltyStack)

Gets the expected outputs for the ancestors and ancestors royalties

Parameters

NameTypeDescription
parentIpIdsaddress[]The parent ipIds
parentRoyaltiesuint32[]The parent royalties
paramsstruct IRoyaltyPolicyLAP.InitParamsThe init params

Return Values

NameTypeDescription
newAncestorsaddress[]The new ancestors
newAncestorsRoyaltyuint32[]The new ancestors royalty
ancestorsCountuint32The number of ancestors
royaltyStackuint32The royalty stack

_deploySplitClone

function _deploySplitClone(address ipId, address ancestorsVault, uint32 royaltyStack) internal returns (address)

Deploys a liquid split clone contract

Parameters

NameTypeDescription
ipIdaddressThe ipId
ancestorsVaultaddressThe ancestors vault address
royaltyStackuint32The number of rnfts that the ipId has to give to its parents and/or grandparents

Return Values

NameTypeDescription
[0]addressThe address of the deployed liquid split clone contract

_safeTransferETH

function _safeTransferETH(address to, uint256 amount) internal

Allows to transfers ETH

Parameters

NameTypeDescription
toaddressThe address to transfer to
amountuint256The amount to transfer