LM_PC_KPIRewarder_v1.sol

Git Source

Inherits: ILM_PC_KPIRewarder_v1, LM_PC_Staking_v1, OptimisticOracleIntegrator

Author: Inverter Network

Provides a mechanism for distributing rewards to stakers based on Key Performance Indicators (KPIs).

Extends {LM_PC_Staking_v1} and integrates with {OptimisticOracleIntegrator} to enable KPI-based reward distribution within the staking manager.

State Variables

KPICounter

The number of KPIs created.

uint internal KPICounter;

registryOfKPIs

Registry of KPIsid -> KPI.

mapping(uint => KPI) internal registryOfKPIs;

assertionConfig

Registry of Assertion Configurations assertionId -> RewardRoundConfiguration.

mapping(bytes32 => RewardRoundConfiguration) internal assertionConfig;

assertionPending

For locking certain utilities when there are assertions open.

__gap

Storage gap for future upgrades.

Functions

supportsInterface

See {IERC165-supportsInterface}.

init

getKPI

Returns the KPI with the given number.

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.

Parameters

Name
Type
Description

assertionId

bytes32

The id of the Assertion to return.

Returns

Name
Type
Description

<none>

RewardRoundConfiguration

The Assertion Configuration.

getKPICounter

Returns the current KPI counter.

Returns

Name
Type
Description

<none>

uint256

The KPI counter.

getAssertionPending

Returns the assertion pending flag.

Returns

Name
Type
Description

<none>

bool

The assertion pending flag.

postAssertion

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

about the asserter address: any address can be set as asserter, it will be expected to pay for the bond on posting. The bond tokens can also be deposited in the Module and used to pay for itself, but ONLY if the bond token is different from the one being used for staking. If the asserter is set to 0, whomever calls postAssertion will be paying the bond.

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.

depositFeeFunds

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

Top up funds to pay the optimistic oracle fee

Parameters

Name
Type
Description

amount

uint256

The amount to deposit.

createKPI

Creates a KPI for the Rewarder.

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.

stake

Stake a specified amount of tokens to earn rewards.

Should tokens already be staked, then the sending address will collect the rewards up until this point.

Parameters

Name
Type
Description

amount

uint256

How much token should be staked.

deleteStuckAssertion

Deletes a stuck assertion.

This function is only callable by the Orchestrator Admin.

Parameters

Name
Type
Description

assertionId

bytes32

The id of the assertion to delete.

assertionResolvedCallback

Callback function that is called by Optimistic Oracle V3 when an assertion is resolved.

Parameters

Name
Type
Description

assertionId

bytes32

The identifier of the assertion that was resolved.

assertedTruthfully

bool

Whether the assertion was resolved as truthful or not.

assertionDisputedCallback

Callback function that is called by Optimistic Oracle V3 when an assertion is disputed.

This OptimisticOracleV3 callback function needs to be defined so the OOv3 doesn't revert when it tries

Parameters

Name
Type
Description

assertionId

bytes32

The identifier of the assertion that was disputed.

Last updated