IPayerReportManager

Git Source

Inherits: IMigratable, IERC5267, IRegistryParametersErrors, ISequentialMerkleProofsErrors

This interface exposes functionality for submitting and settling payer reports.

Functions

initialize

Initializes the contract.

function initialize() external;

submit

Submits a payer report.

function submit(
    uint32 originatorNodeId_,
    uint64 startSequenceId_,
    uint64 endSequenceId_,
    uint32 endMinuteSinceEpoch_,
    bytes32 payersMerkleRoot_,
    uint32[] calldata nodeIds_,
    PayerReportSignature[] calldata signatures_
) external returns (uint256 payerReportIndex_);

Parameters

NameTypeDescription
originatorNodeId_uint32The originator node ID.
startSequenceId_uint64The start sequence ID.
endSequenceId_uint64The end sequence ID.
endMinuteSinceEpoch_uint32The timestamp of the message at endSequenceId.
payersMerkleRoot_bytes32The payers Merkle root.
nodeIds_uint32[]The active node IDs during the reporting period.
signatures_PayerReportSignature[]The signature objects for the payer report.

Returns

NameTypeDescription
payerReportIndex_uint256The index of the payer report in the originator's payer report array.

settle

Settles a subset of a payer report.

function settle(
    uint32 originatorNodeId_,
    uint256 payerReportIndex_,
    bytes[] calldata payerFees_,
    bytes32[] calldata proofElements_
) external;

Parameters

NameTypeDescription
originatorNodeId_uint32The originator node ID.
payerReportIndex_uint256The payer report index.
payerFees_bytes[]The sequential payer fees to settle.
proofElements_bytes32[]The sequential Merkle proof elements for the payer fees to settle.

updateProtocolFeeRate

Updates the protocol fee rate.

function updateProtocolFeeRate() external;

PAYER_REPORT_TYPEHASH

Returns the EIP712 typehash used in the encoding of a signed digest for a payer report.

function PAYER_REPORT_TYPEHASH() external pure returns (bytes32 payerReportTypehash_);

ONE_HUNDRED_PERCENT

One hundred percent (in basis points).

function ONE_HUNDRED_PERCENT() external pure returns (uint16 oneHundredPercent_);

migratorParameterKey

The parameter registry key used to fetch the migrator.

function migratorParameterKey() external pure returns (string memory key_);

protocolFeeRateParameterKey

The parameter registry key used to fetch the protocol fee rate.

function protocolFeeRateParameterKey() external pure returns (string memory key_);

parameterRegistry

The address of the parameter registry.

function parameterRegistry() external view returns (address parameterRegistry_);

nodeRegistry

The address of the node registry.

function nodeRegistry() external view returns (address nodeRegistry_);

payerRegistry

The address of the payer registry.

function payerRegistry() external view returns (address payerRegistry_);

protocolFeeRate

The protocol fee rate (in basis points).

function protocolFeeRate() external view returns (uint16 protocolFeeRate_);

getPayerReports

Returns an array of specific payer reports.

The node IDs in originatorNodeIds_ don't need to be unique.

function getPayerReports(uint32[] calldata originatorNodeIds_, uint256[] calldata payerReportIndices_)
    external
    view
    returns (PayerReport[] memory payerReports_);

Parameters

NameTypeDescription
originatorNodeIds_uint32[]An array of originator node IDs.
payerReportIndices_uint256[]An array of payer report indices for each of the respective originator node IDs.

Returns

NameTypeDescription
payerReports_PayerReport[]The array of payer reports.

getPayerReport

Returns a payer report.

function getPayerReport(uint32 originatorNodeId_, uint256 payerReportIndex_)
    external
    view
    returns (PayerReport memory payerReport_);

Parameters

NameTypeDescription
originatorNodeId_uint32The originator node ID.
payerReportIndex_uint256The payer report index.

Returns

NameTypeDescription
payerReport_PayerReportThe payer report.

getPayerReportDigest

Returns the EIP-712 digest for a payer report.

function getPayerReportDigest(
    uint32 originatorNodeId_,
    uint64 startSequenceId_,
    uint64 endSequenceId_,
    uint32 endMinuteSinceEpoch_,
    bytes32 payersMerkleRoot_,
    uint32[] calldata nodeIds_
) external view returns (bytes32 digest_);

Parameters

NameTypeDescription
originatorNodeId_uint32The originator node ID.
startSequenceId_uint64The start sequence ID.
endSequenceId_uint64The end sequence ID.
endMinuteSinceEpoch_uint32The timestamp of the message at endSequenceId.
payersMerkleRoot_bytes32The payers Merkle root.
nodeIds_uint32[]The active node IDs during the reporting period.

Returns

NameTypeDescription
digest_bytes32The EIP-712 digest.

Events

PayerReportSubmitted

Emitted when a payer report is submitted.

event PayerReportSubmitted(
    uint32 indexed originatorNodeId,
    uint256 indexed payerReportIndex,
    uint64 startSequenceId,
    uint64 indexed endSequenceId,
    uint32 endMinuteSinceEpoch,
    bytes32 payersMerkleRoot,
    uint32[] nodeIds,
    uint32[] signingNodeIds
);

Parameters

NameTypeDescription
originatorNodeIduint32The originator node ID.
payerReportIndexuint256The index of the newly stored report.
startSequenceIduint64The start sequence ID.
endSequenceIduint64The end sequence ID.
endMinuteSinceEpochuint32The timestamp of the message at endSequenceId.
payersMerkleRootbytes32The payers Merkle root.
nodeIdsuint32[]The active node IDs during the reporting period.
signingNodeIdsuint32[]The node IDs of the signers of the payer report.

PayerReportSubsetSettled

Emitted when a subset of a payer report is settled.

event PayerReportSubsetSettled(
    uint32 indexed originatorNodeId,
    uint256 indexed payerReportIndex,
    uint32 count,
    uint32 remaining,
    uint96 feesSettled
);

Parameters

NameTypeDescription
originatorNodeIduint32The originator node ID.
payerReportIndexuint256The payer report index.
countuint32The number of payer fees settled in this subset.
remaininguint32The number of payer fees remaining to be settled.
feesSettleduint96The amount of fees settled in this subset.

ProtocolFeeRateUpdated

Emitted when the protocol fee rate is updated.

event ProtocolFeeRateUpdated(uint16 protocolFeeRate);

Parameters

NameTypeDescription
protocolFeeRateuint16The new protocol fee rate.

Errors

ZeroParameterRegistry

Thrown when the parameter registry address is being set to zero (i.e. address(0)).

error ZeroParameterRegistry();

ZeroNodeRegistry

Thrown when the node registry address is being set to zero (i.e. address(0)).

error ZeroNodeRegistry();

ZeroPayerRegistry

Thrown when the payer registry address is being set to zero (i.e. address(0)).

error ZeroPayerRegistry();

InvalidStartSequenceId

Thrown when the start sequence ID is not the last end sequence ID.

error InvalidStartSequenceId(uint64 startSequenceId, uint64 lastSequenceId);

InvalidSequenceIds

Thrown when the start and end sequence IDs are invalid.

error InvalidSequenceIds();

UnorderedNodeIds

Thrown when the signing node IDs are not ordered and unique.

error UnorderedNodeIds();

InsufficientSignatures

Thrown when the number of valid signatures is insufficient.

error InsufficientSignatures(uint8 validSignatureCount, uint8 requiredSignatureCount);

PayerReportAlreadySubmitted

Thrown when the payer report has already been submitted.

error PayerReportAlreadySubmitted(uint32 originatorNodeId, uint64 startSequenceId, uint64 endSequenceId);

PayerReportIndexOutOfBounds

Thrown when the payer report index is out of bounds.

error PayerReportIndexOutOfBounds();

PayerReportEntirelySettled

Thrown when the payer report has already been entirely settled.

error PayerReportEntirelySettled();

PayerFeesLengthTooLong

Thrown when the length of the payer fees array is too long.

error PayerFeesLengthTooLong();

SettleUsageFailed

Thrown when failing to settle usage via the payer registry.

error SettleUsageFailed(bytes returnData_);

ArrayLengthMismatch

Thrown when the lengths of input arrays don't match.

error ArrayLengthMismatch();

InvalidProtocolFeeRate

Thrown when the protocol fee rate is invalid.

error InvalidProtocolFeeRate();

NoChange

Thrown when there is no change to an updated parameter.

error NoChange();

NoReportsForOriginator

Thrown when there are no payer reports found for the given originator node ID.

error NoReportsForOriginator(uint32 originatorNodeId);

Parameters

NameTypeDescription
originatorNodeIduint32The ID of the originator node for which no reports exist.

NodeIdsLengthMismatch

Thrown when the provided node IDs do not exactly match the registry set.

error NodeIdsLengthMismatch(uint32 expectedCount, uint32 providedCount);

NodeIdAtIndexMismatch

Element at index does not match the canonical node id at that position.

error NodeIdAtIndexMismatch(uint32 expectedId, uint32 actualId, uint32 index);

Structs

PayerReport

Represents a payer report.

struct PayerReport {
    uint64 startSequenceId;
    uint64 endSequenceId;
    uint32 endMinuteSinceEpoch;
    uint96 feesSettled;
    uint32 offset;
    bool isSettled;
    uint16 protocolFeeRate;
    bytes32 payersMerkleRoot;
    uint32[] nodeIds;
}

Properties

NameTypeDescription
startSequenceIduint64The start sequence ID.
endSequenceIduint64The end sequence ID.
endMinuteSinceEpochuint32The timestamp of the message at endSequenceId.
feesSettleduint96The total fees already settled for this report.
offsetuint32The next index in the Merkle tree that has yet to be processed/settled.
isSettledboolWhether the payer report is completely processed/settled.
protocolFeeRateuint16The portion of the fees settled that is reserved for the protocol.
payersMerkleRootbytes32The payers Merkle root.
nodeIdsuint32[]The active node IDs during the reporting period.

PayerReportSignature

Represents a payer report signature.

struct PayerReportSignature {
    uint32 nodeId;
    bytes signature;
}

Properties

NameTypeDescription
nodeIduint32The node ID.
signaturebytesThe signature by the node operator.