ILM_PC_KPIRewarder_v1.sol

Git Source

Functions

postAssertion

Posts an assertion to the Optimistic Oracle, specifying the KPI to use and the asserted value.

function postAssertion(
    bytes32 dataId,
    uint assertedValue,
    address asserter,
    uint targetKPI
) external returns (bytes32 assertionId);

Parameters

Name
Type
Description

dataId

bytes32

The dataId to be posted.

assertedValue

uint256

The target value that will be asserted and posted as data to the oracle.

asserter

address

The address of the asserter.

targetKPI

uint256

The KPI to be used for distribution once the assertion confirms.

Returns

Name
Type
Description

assertionId

bytes32

The assertionId received for the posted assertion.

createKPI

Creates a KPI for the Rewarder.

function createKPI(
    bool _continuous,
    uint[] calldata _trancheValues,
    uint[] calldata _trancheRewards
) external returns (uint);

Parameters

Name
Type
Description

_continuous

bool

Should the tranche rewards be distributed continuously or in steps.

_trancheValues

uint256[]

The value at which the tranches end.

_trancheRewards

uint256[]

The rewards to be distributed at completion of each tranche.

Returns

Name
Type
Description

<none>

uint256

The KPI id.

depositFeeFunds

Deposits funds into the contract so it can pay for the oracle bond and fee itself.

function depositFeeFunds(uint amount) external;

Parameters

Name
Type
Description

amount

uint256

The amount to deposit.

getKPI

Returns the KPI with the given number.

function getKPI(uint KPInum) external view returns (KPI memory);

Parameters

Name
Type
Description

KPInum

uint256

The number of the KPI to return.

Returns

Name
Type
Description

<none>

KPI

The KPI.

getAssertionConfig

Returns the Assertion Configuration for a given assertionId.

function getAssertionConfig(bytes32 assertionId)
    external
    view
    returns (RewardRoundConfiguration memory);

Parameters

Name
Type
Description

assertionId

bytes32

The id of the Assertion to return.

Returns

Name
Type
Description

<none>

RewardRoundConfiguration

The Assertion Configuration.

deleteStuckAssertion

Deletes a stuck assertion.

This function is only callable by the Orchestrator Admin.

function deleteStuckAssertion(bytes32 assertionId) external;

Parameters

Name
Type
Description

assertionId

bytes32

The id of the assertion to delete.

getKPICounter

Returns the current KPI counter.

function getKPICounter() external view returns (uint);

Returns

Name
Type
Description

<none>

uint256

The KPI counter.

getAssertionPending

Returns the assertion pending flag.

function getAssertionPending() external view returns (bool);

Returns

Name
Type
Description

<none>

bool

The assertion pending flag.

Events

KPICreated

Event emitted when a KPI is created.

event KPICreated(
    uint indexed KPI_Id,
    uint numOfTranches,
    uint totalKPIRewards,
    bool continuous,
    uint[] trancheValues,
    uint[] trancheRewards
);

Parameters

Name
Type
Description

KPI_Id

uint256

The id of the KPI.

numOfTranches

uint256

The number of tranches in the KPI.

totalKPIRewards

uint256

The total rewards for the KPI.

continuous

bool

Whether the KPI is continuous or not.

trancheValues

uint256[]

The values at which each tranche ends.

trancheRewards

uint256[]

The rewards to be distributed at completion of each tranche.

RewardRoundConfigured

Event emitted when a reward round is configured.

event RewardRoundConfigured(
    bytes32 indexed assertionId,
    uint creationTime,
    uint assertedValue,
    uint indexed KpiToUse
);

Parameters

Name
Type
Description

assertionId

bytes32

The id of the assertion.

creationTime

uint256

The timestamp the assertion was created.

assertedValue

uint256

The value that was asserted.

KpiToUse

uint256

The KPI to be used for distribution once the assertion confirms.

FeeFundsDeposited

Event emitted when funds for paying the bonding fee are deposited into the contract.

event FeeFundsDeposited(address indexed token, uint amount);

Parameters

Name
Type
Description

token

address

The token used for the deposit.

amount

uint256

The amount deposited.

DeletedStuckAssertion

Event emitted when a stuck assertion gets deleted.

event DeletedStuckAssertion(bytes32 indexed assertionId);

Errors

Module__LM_PC_KPIRewarder_v1__InvalidTrancheNumber

The KPI beinge created has either no tranches or too many.

error Module__LM_PC_KPIRewarder_v1__InvalidTrancheNumber();

Module__LM_PC_KPIRewarder_v1__InvalidKPIValueLengths

The number of tranches in the KPI does not match the number of rewards.

error Module__LM_PC_KPIRewarder_v1__InvalidKPIValueLengths();

Module__LM_PC_KPIRewarder_v1__InvalidKPITrancheValues

The values for the tranches are not in ascending order.

error Module__LM_PC_KPIRewarder_v1__InvalidKPITrancheValues();

Module__LM_PC_KPIRewarder_v1__InvalidKPINumber

The KPI number is invalid.

error Module__LM_PC_KPIRewarder_v1__InvalidKPINumber();

Module__LM_PC_KPIRewarder_v1__ModuleCannotUseStakingTokenAsBond

The Token used paying the bond cannot be the same that is being staked.

error Module__LM_PC_KPIRewarder_v1__ModuleCannotUseStakingTokenAsBond();

Module__LM_PC_KPIRewarder_v1__UnresolvedAssertionExists

An assertion can only by posted if the preceding one is resolved.

error Module__LM_PC_KPIRewarder_v1__UnresolvedAssertionExists();

Module__LM_PC_KPIRewarder_v1__CannotStakeWhenAssertionPending

The user cannot stake while an assertion is unresolved.

error Module__LM_PC_KPIRewarder_v1__CannotStakeWhenAssertionPending();

Module__LM_PC_KPIRewarder_v1__NonExistentAssertionId

Callback received references non existent assertionId.

error Module__LM_PC_KPIRewarder_v1__NonExistentAssertionId(bytes32 assertionId);

Module__LM_PC_KPIRewarder_v1__AssertionNotStuck

The assertion that is being removed was not stuck.

error Module__LM_PC_KPIRewarder_v1__AssertionNotStuck(bytes32 assertionId);

Structs

KPI

A KPI to be used for reward distribution.

struct KPI {
    uint numOfTranches;
    uint totalRewards;
    bool continuous;
    uint[] trancheValues;
    uint[] trancheRewards;
}

Properties

Name
Type
Description

numOfTranches

uint256

The number of tranches the KPI is divided into.

totalRewards

uint256

The total rewards to be distributed.

continuous

bool

If the tranche rewards should be distributed continuously or in steps.

trancheValues

uint256[]

The value at which each tranche ends.

trancheRewards

uint256[]

The rewards to be distributed at completion of each tranche.

RewardRoundConfiguration

The configuration of the reward round tied.

struct RewardRoundConfiguration {
    uint creationTime;
    uint assertedValue;
    uint KpiToUse;
    bool distributed;
}

Properties

Name
Type
Description

creationTime

uint256

The timestamp the assertion was posted.

assertedValue

uint256

The value that was asserted.

KpiToUse

uint256

The KPI to be used for distribution once the assertion confirms.

distributed

bool

If the rewards have been distributed or not.

Last updated