The following readme describes all the functions and their parameters exposed by the reporterRegistry class of the K2 SDK. This sub-class of the SDK exposes all the functions from the reporter registry contract of the K2 Lending protocol.

getk2LendingPool function

This function can be used to get the contract address of the K2 Lending pool.

Using getk2LendingPool function

await sdk.reporterRegistry.getk2LendingPool();

Return Parameter

Returns contract address.

isReporterActive function

Check the contracts if the reporter is active.

Input Parameters

reporter: ETH Address of the reporter

Using isReporterActive function

await sdk.reporterRegistry.isReporterActive(reporter);

Return Parameter

Boolean, true if active, false otherwise.

isReporterRagequitted function

Check the contracts if the reporter has rage quitted or not.

Input Parameters

reporter: ETH address of the reporter

Using isReporterRagequitted function

await sdk.reporterRegistry.isReporterRagequitted(reporter);

Return Parameter

Boolean, true if rage quitted, false otherwise.

registerReporter function

Register a reporter to the reporter registry contract. The msg.sender will be registered as the reporter.

Using registerReporter function

await sdk.reporterRegistry.registerReporter();

Return Parameter

Transaction details if the transaction is successful.

isReporterOperational function

Check if the reporter is operational and can perform reports. An operational reporter is the one that is active and hasn’t rage quitted.

Input Parameters

reporter: ETH address of the reporter

Using isReporterOperational function

await sdk.reporterRegistry.isReporterOperational(reporter);

Return Parameter

Boolean, true if reporter is operational, false otherwise.

batchSubmitReports function

Function to submit multiple verified reports in a single transaction.

Input Parameters

reports: List of verified reports of the following structure:

{
    slashType: SlashType;
    debtor: string;     // Borrower address
    amount: number;     // Amount being slashed
    identifier: number; // Unique ID to avoid double reporting
    block: number;      // Block number
    signature: string;  // Blind signature being reported
};

reportSignatures: List of signatures (designatedVerifierSignature obtained after verifying the reports) of the respective reports. Each signature follows the following structure:

{
    v: number; // version
    r: string; // x coordinate of the curve
    s: string; // y coordinate of the curve
}

Using batchSubmitReports function

await sdk.reporterRegistry.batchSubmitReports(reports, reportSignatures);

Return Parameter

Transaction details if the transaction is successful.

reportTypedHash function

Calculate typed hash of report struct.

Input Parameters

report: verified report of the following structure:

{
    slashType: SlashType;
    debtor: string;     // Borrower address
    amount: number;     // Amount being slashed
    identifier: number; // Unique ID to avoid double reporting
    block: number;      // Block number
    signature: string;  // Blind signature being reported
};

Using reportTypedHash function

await sdk.reporterRegistry.reportTypedHash(report);

Return Parameter

bytes32 hash string

isValidReport function

Input Parameters

report: Verified report obtained from the verifyLivenessReport function, of the following structure:

{
    slashType: SlashType;
    debtor: string;     // Borrower address
    amount: number;     // Amount being slashed
    identifier: number; // Unique ID to avoid double reporting
    block: number;      // Block number
    signature: string;  // Blind signature being reported
};

reportSignature: Signature (designatedVerifierSignature obtained after verifying the reports) of the respective report. The signature follows the following structure:

{
    v: number; // version
    r: string; // x coordinate of the curve
    s: string; // y coordinate of the curve
}

Using isValidReport function

await sdk.reporterRegistry.isValidReport(report, reportSignature);

Return Parameter

Returns true if valid, false otherwise.