Infernet
SDK
Reference
Utilities
Reader

Reader

Git Source (opens in a new tab)

Utility contract: implements multicall like batch reading functionality

Multicall src: https://github.com/mds1/multicall (opens in a new tab)

Functions forgo validation assuming correct off-chain inputs are used

State Variables

COORDINATOR

Coordinator

Coordinator used over EIP712Coordinator since no EIP-712 functionality consumed

Coordinator private immutable COORDINATOR;

Functions

constructor

Initializes new Reader

constructor(Registry registry);

Parameters

NameTypeDescription
registryRegistryregistry contract

readSubscriptionBatch

Reads Subscription(s) from Coordinator in batch

Does not validate that subscriptions between startId and endId exist

Does not validate that startId is at least 0

Does not validate that endId is greater than startId

function readSubscriptionBatch(uint32 startId, uint32 endId) external view returns (Subscription[] memory);

Parameters

NameTypeDescription
startIduint32start subscription ID (inclusive)
endIduint32end subscription ID (exclusive)

Returns

NameTypeDescription
<none>Subscription[]Subscription(s)

readRedundancyCountBatch

Given Subscription ids and intervals, collects redundancy count of (subscription, interval)-pair

By default, if a (subscription ID, interval)-pair does not exist, function will return redundancyCount == 0

Does not validate ids.length == intervals.length

function readRedundancyCountBatch(uint32[] calldata ids, uint32[] calldata intervals)
    external
    view
    returns (uint16[] memory);

Parameters

NameTypeDescription
idsuint32[]array of subscription IDs
intervalsuint32[]array of intervals to check where each ids[idx] corresponds to intervals[idx]

Returns

NameTypeDescription
<none>uint16[]array of redundancy counts for (subscription ID, interval)-pairs