Skip to main content

Solidity API

Contract: CRS

registerRoyaltyDue

function registerRoyaltyDuefunction registerRoyaltyDue(uint256 tokenId, uint256 amountDue, uint256 startDate, uint256 endDate, uint256 royaltyInfoIndex) external
Registers or updates the royalty amount due for a specific token and period index.

Parameters

NameDescription
tokenIdThe ID of the token.
amountDueThe amount of royalty due for the period.
startDateThe start date of the royalty period (Unix timestamp).
endDateThe end date of the royalty period (Unix timestamp).
royaltyInfoIndexThe index for the royalty period (0-based).
Dev: Can only be called by the VR creator. Creates a new period if index equals current count.

payRoyalty

function payRoyaltyfunction payRoyalty(uint256 tokenId, uint256 amountPaid, uint256 periodIndex, address culturaBoundAccount, bytes signature) external
Processes an on-chain royalty payment for a specific token and period.

Parameters

NameDescription
tokenIdThe ID of the token.
amountPaidThe amount being paid on-chain.
periodIndexThe index of the royalty period being paid.
culturaBoundAccountThe address of the associated Cultura Rights Bound Account.
signatureSignature required by the CulturaRightsBoundAccount’s setPaymentInfo function.
Dev: Can only be called by the VR creator. Interacts with the CulturaRightsBoundAccount.

reportOffChainPayment

function reportOffChainPaymentfunction reportOffChainPayment(uint256 tokenId, uint256 periodIndex, uint256 amount, string metadata) external
Reports an off-chain payment made for a specific royalty period.

Parameters

NameDescription
tokenIdThe ID of the VR token.
periodIndexThe index of the royalty period.
amountThe amount reported as paid off-chain.
metadataOptional metadata about the payment (e.g., transaction ID).
Dev: Can only be called by the VR creator. Sets the payment status to PENDING.

acceptOffChainPayment

function acceptOffChainPaymentfunction acceptOffChainPayment(uint256 tokenId, uint256 periodIndex, address culturaBoundAccount, bytes signature) external
Accepts a pending off-chain payment report.

Parameters

NameDescription
tokenIdThe ID of the VR token.
periodIndexThe index of the royalty period.
culturaBoundAccountThe address of the associated Cultura Rights Bound Account.
signatureThe VR owner’s EIP712 signature confirming acceptance.
Dev: Can only be called by the current owner of the VR. Requires EIP712 signature. Transfers calculated fees from the VR owner to the Cultura Rights Bound Account.

denyOffChainPayment

function denyOffChainPaymentfunction denyOffChainPayment(uint256 tokenId, uint256 periodIndex, bytes signature) external
Denies a pending off-chain payment report.

Parameters

NameDescription
tokenIdThe ID of the VR token.
periodIndexThe index of the royalty period.
signatureThe VR owner’s EIP712 signature confirming denial.
Dev: Can only be called by the current owner of the VR. Requires EIP712 signature.

getFullRoyaltyInfo

function getFullRoyaltyInfofunction getFullRoyaltyInfo(uint256 tokenId) external view returns (struct ICRS.RoyaltyInfoView[])
Retrieves all royalty information views for a specific token.

Parameters

NameDescription
tokenIdThe ID of the token.

Return Values

Description
An array of RoyaltyInfoView structs.

getRoyaltyInfoPeriod

function getRoyaltyInfoPeriodfunction getRoyaltyInfoPeriod(uint256 tokenId, uint256 periodIndex) external view returns (uint256 periodStart, uint256 periodEnd, uint256 amountDue, uint256 amountPaid, uint256[] parentPendingClaims)
Retrieves royalty information for a specific token and period index.

Parameters

NameDescription
tokenIdThe ID of the token.
periodIndexThe index of the royalty period.

Return Values

Description
The start of the royalty period.
The end of the royalty period.
The amount currently due for the period.
The amount already paid for the period.
Empty array (placeholder for signature compatibility).

getRoyaltyInfoCount

function getRoyaltyInfoCountfunction getRoyaltyInfoCount(uint256 tokenId) external view returns (uint256)
Retrieves the count of royalty periods registered for a specific token.

Parameters

NameDescription
tokenIdThe ID of the token.

Return Values

Description
The number of royalty periods.

Public Functions

constructor

function constructorconstructor(address _culturaDigitalAssetAddress, address _culturaPaymentTokenAddress) public
Dev: Initializes the contract with necessary addresses and EIP712 domain.

Custom Errors

InvalidAddress

error InvalidAddresserror InvalidAddress()

NotCreatorOfVR

error NotCreatorOfVRerror NotCreatorOfVR()

NotOwnerOfParentVR

error NotOwnerOfParentVRerror NotOwnerOfParentVR()

NoParentDigitalAssetToPay

error NoParentDigitalAssetToPayerror NoParentDigitalAssetToPay()

NoRoyaltyDue

error NoRoyaltyDueerror NoRoyaltyDue()

AmountPaidExceedsDue

error AmountPaidExceedsDueerror AmountPaidExceedsDue()

InvalidDateRange

error InvalidDateRangeerror InvalidDateRange()

InvalidPeriodIndex

error InvalidPeriodIndexerror InvalidPeriodIndex()

RoyaltyInfoIndexOutOfBounds

error RoyaltyInfoIndexOutOfBoundserror RoyaltyInfoIndexOutOfBounds()

RoyaltyInfoAlreadyExists

error RoyaltyInfoAlreadyExistserror RoyaltyInfoAlreadyExists()

NotVROwner

error NotVROwnererror NotVROwner()

IncorrectOffChainPaymentStatus

error IncorrectOffChainPaymentStatuserror IncorrectOffChainPaymentStatus(enum ICRS.OffChainPaymentStatus currentStatus, enum ICRS.OffChainPaymentStatus requiredStatus)

InsufficientBalanceForFees

error InsufficientBalanceForFeeserror InsufficientBalanceForFees(uint256 required, uint256 available)

InsufficientAllowanceForFees

error InsufficientAllowanceForFeeserror InsufficientAllowanceForFees(uint256 required, uint256 allowed)

OffChainPaymentAlreadyExists

error OffChainPaymentAlreadyExistserror OffChainPaymentAlreadyExists()

InvalidSignature

error InvalidSignatureerror InvalidSignature()

InvalidCulturaBoundAccount

error InvalidCulturaBoundAccounterror InvalidCulturaBoundAccount()

RoyaltyPeriodNotFound

error RoyaltyPeriodNotFounderror RoyaltyPeriodNotFound()

InvalidFeeCalculation

error InvalidFeeCalculationerror InvalidFeeCalculation()