LM_PC_KPIRewarder_v1.sol
Last updated
Last updated
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.
The number of KPIs created.
Registry of KPIsid -> KPI.
Registry of Assertion Configurations assertionId -> RewardRoundConfiguration.
For locking certain utilities when there are assertions open.
Storage gap for future upgrades.
See {IERC165-supportsInterface}.
Returns the KPI with the given number.
Parameters
KPInum
uint256
The number of the KPI to return.
Returns
<none>
KPI
The KPI.
Returns the Assertion Configuration for a given assertionId.
Parameters
assertionId
bytes32
The id of the Assertion to return.
Returns
<none>
RewardRoundConfiguration
The Assertion Configuration.
Returns the current KPI counter.
Returns
<none>
uint256
The KPI counter.
Returns the assertion pending flag.
Returns
<none>
bool
The assertion pending flag.
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
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
assertionId
bytes32
The assertionId received for the posted assertion.
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
amount
uint256
The amount to deposit.
Creates a KPI for the Rewarder.
Parameters
_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
<none>
uint256
The KPI id.
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
amount
uint256
How much token should be staked.
Deletes a stuck assertion.
This function is only callable by the Orchestrator Admin.
Parameters
assertionId
bytes32
The id of the assertion to delete.
Callback function that is called by Optimistic Oracle V3 when an assertion is resolved.
Parameters
assertionId
bytes32
The identifier of the assertion that was resolved.
assertedTruthfully
bool
Whether the assertion was resolved as truthful or not.
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
assertionId
bytes32
The identifier of the assertion that was disputed.