RoyaltyModule.sol

The Story Protocol royalty module allows to set royalty policies an IP asset and pay royalties as a
derivative IP.

name

string name

Returns the string identifier associated with the module.

LICENSING_MODULE

address LICENSING_MODULE

Returns the licensing module address

isWhitelistedRoyaltyPolicy

mapping(address => bool) isWhitelistedRoyaltyPolicy

Indicates if a royalty policy is whitelisted

isWhitelistedRoyaltyToken

mapping(address => bool) isWhitelistedRoyaltyToken

Indicates if a royalty token is whitelisted

royaltyPolicies

mapping(address => address) royaltyPolicies

Indicates the royalty policy for a given IP asset

constructor

constructor(address governance) public

onlyLicensingModule

modifier onlyLicensingModule()

Modifier to enforce that the caller is the licensing module

setLicensingModule

function setLicensingModule(address licensingModule) external

Sets the license registry

Enforced to be only callable by the protocol admin

Parameters

NameTypeDescription
licensingModuleaddressThe address of the license registry

whitelistRoyaltyPolicy

function whitelistRoyaltyPolicy(address royaltyPolicy, bool allowed) external

Whitelist a royalty policy

Enforced to be only callable by the protocol admin

Parameters

NameTypeDescription
royaltyPolicyaddressThe address of the royalty policy
allowedboolIndicates if the royalty policy is whitelisted or not

whitelistRoyaltyToken

function whitelistRoyaltyToken(address token, bool allowed) external

Whitelist a royalty token

Enforced to be only callable by the protocol admin

Parameters

NameTypeDescription
tokenaddressThe token address
allowedboolIndicates if the token is whitelisted or not

onLicenseMinting

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

Executes royalty related logic on license minting

Enforced to be only callable by LicensingModule

Parameters

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

onLinkToParents

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

Executes royalty related logic on linking to parents

Enforced to be only callable by LicensingModule

Parameters

NameTypeDescription
ipIdaddressThe children ipId that is being linked to parents
royaltyPolicyaddressThe common royalty policy address of all the licenses being burned
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

payRoyaltyOnBehalf

function payRoyaltyOnBehalf(address receiverIpId, address payerIpId, address token, uint256 amount) external

Allows the function caller to pay royalties to the receiver IP asset on behalf of the payer IP asset.

Parameters

NameTypeDescription
receiverIpIdaddressThe ipId that receives the royalties
payerIpIdaddressThe ipId that pays the royalties
tokenaddressThe token to use to pay the royalties
amountuint256The amount to pay

payLicenseMintingFee

function payLicenseMintingFee(address receiverIpId, address payerAddress, address licenseRoyaltyPolicy, address token, uint256 amount) external

Allows to pay the minting fee for a license

Parameters

NameTypeDescription
receiverIpIdaddressThe ipId that receives the royalties
payerAddressaddressThe address that pays the royalties
licenseRoyaltyPolicyaddressThe royalty policy of the license being minted
tokenaddressThe token to use to pay the royalties
amountuint256The amount to pay

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

IERC165 interface support.