OracleV1

Kiln

Oracle (v1)

This contract handles the input from the allowed oracle members. Highly inspired by Lido's implementation.

Methods

acceptAdmin

function acceptAdmin() external nonpayable

Accept the transfer of ownership

Only callable by the pending admin. Resets the pending admin if succesful.

addMember

function addMember(address _newOracleMember, uint256 _newQuorum) external nonpayable

Adds new address as oracle member, giving the ability to push cl reports.

Only callable by the adminstratorModifying the quorum clears all the reporting data

Parameters

getAdmin

function getAdmin() external view returns (address)

Retrieves the current admin address

Returns

getCLSpec

function getCLSpec() external view returns (struct CLSpec.CLSpecStruct)

Retrieve the current cl spec

Returns

getCurrentEpochId

function getCurrentEpochId() external view returns (uint256)

Retrieve the current epoch id based on block timestamp

Returns

getCurrentFrame

function getCurrentFrame() external view returns (uint256 _startEpochId, uint256 _startTime, uint256 _endTime)

Retrieve the current frame details

Returns

getExpectedEpochId

function getExpectedEpochId() external view returns (uint256)

Retrieve expected epoch id

Returns

getFrameFirstEpochId

function getFrameFirstEpochId(uint256 _epochId) external view returns (uint256)

Retrieve the first epoch id of the frame of the provided epoch id

Parameters

Returns

getGlobalReportStatus

function getGlobalReportStatus() external view returns (uint256)

Retrieve member report status

Returns

getLastCompletedEpochId

function getLastCompletedEpochId() external view returns (uint256)

Retrieve the last completed epoch id

Returns

getMemberReportStatus

function getMemberReportStatus(address _oracleMember) external view returns (bool)

Retrieve member report status

Parameters

Returns

getOracleMembers

function getOracleMembers() external view returns (address[])

Retrieve the list of oracle members

Returns

getPendingAdmin

function getPendingAdmin() external view returns (address)

Retrieve the current pending admin address

Returns

getQuorum

function getQuorum() external view returns (uint256)

Retrieve the current quorum

Returns

getReportBounds

function getReportBounds() external view returns (struct ReportBounds.ReportBoundsStruct)

Retrieve the report bounds

Returns

getReportVariant

function getReportVariant(uint256 _idx) external view returns (uint64 _clBalance, uint32 _clValidators, uint16 _reportCount)

Retrieve decoded report at provided index

Parameters

Returns

getReportVariantsCount

function getReportVariantsCount() external view returns (uint256)

Retrieve report variants count

Returns

getRiver

function getRiver() external view returns (address)

Retrieve River address

Returns

getTime

function getTime() external view returns (uint256)

Retrieve the block timestamp

Returns

initOracleV1

function initOracleV1(address _river, address _administratorAddress, uint64 _epochsPerFrame, uint64 _slotsPerEpoch, uint64 _secondsPerSlot, uint64 _genesisTime, uint256 _annualAprUpperBound, uint256 _relativeLowerBound) external nonpayable

Initializes the oracle

Parameters

isMember

function isMember(address _memberAddress) external view returns (bool)

Returns true if address is member

Performs a naive search, do not call this on-chain, used as an off-chain helper

Parameters

Returns

proposeAdmin

function proposeAdmin(address _newAdmin) external nonpayable

Proposes a new address as admin

This security prevents setting an invalid address as an admin. The pendingadmin has to claim its ownership of the contract, and prove that the newaddress is able to perform regular transactions.

Parameters

removeMember

function removeMember(address _oracleMember, uint256 _newQuorum) external nonpayable

Removes an address from the oracle members.

Only callable by the adminstratorModifying the quorum clears all the reporting dataRemaining members that have already voted should vote again for the same frame.

Parameters

reportConsensusLayerData

function reportConsensusLayerData(uint256 _epochId, uint64 _clValidatorsBalance, uint32 _clValidatorCount) external nonpayable

Report cl chain data

Only callable by an oracle memberThe epoch id is expected to be >= to the expected epoch id stored in the contractThe epoch id is expected to be the first epoch of its frameThe Consensus Layer Validator count is the amount of running validators managed by River.Until withdrawals are enabled, this count also takes into account any exited and slashed validatoras funds are still locked on the consensus layer.

Parameters

setCLSpec

function setCLSpec(uint64 _epochsPerFrame, uint64 _slotsPerEpoch, uint64 _secondsPerSlot, uint64 _genesisTime) external nonpayable

Edits the cl spec parameters

Only callable by the adminstrator

Parameters

setMember

function setMember(address _oracleMember, address _newAddress) external nonpayable

Changes the address of an oracle member

Only callable by the adminitratorCannot use an address already in useThis call will clear all the reporting data

Parameters

setQuorum

function setQuorum(uint256 _newQuorum) external nonpayable

Edits the quorum required to forward cl data to River

Modifying the quorum clears all the reporting data

Parameters

setReportBounds

function setReportBounds(uint256 _annualAprUpperBound, uint256 _relativeLowerBound) external nonpayable

Edits the cl bounds parameters

Only callable by the adminstrator

Parameters

Events

AddMember

event AddMember(address indexed member)

A member has been added to the oracle member list

Parameters

CLReported

event CLReported(uint256 epochId, uint128 newCLBalance, uint32 newCLValidatorCount, address oracleMember)

Consensus Layer data has been reported by an oracle member

Parameters

ExpectedEpochIdUpdated

event ExpectedEpochIdUpdated(uint256 epochId)

The expected epoch id has been changed

Parameters

Initialize

event Initialize(uint256 version, bytes cdata)

Emitted when the contract is properly initialized

Parameters

PostTotalShares

event PostTotalShares(uint256 postTotalEth, uint256 prevTotalEth, uint256 timeElapsed, uint256 totalShares)

The report has been submitted to river

Parameters

RemoveMember

event RemoveMember(address indexed member)

A member has been removed from the oracle member list

Parameters

SetAdmin

event SetAdmin(address indexed admin)

The admin address changed

Parameters

SetBounds

event SetBounds(uint256 annualAprUpperBound, uint256 relativeLowerBound)

The report bounds have been changed

Parameters

SetMember

event SetMember(address indexed oldAddress, address indexed newAddress)

A member address has been edited

Parameters

SetPendingAdmin

event SetPendingAdmin(address indexed pendingAdmin)

The pending admin address changed

Parameters

SetQuorum

event SetQuorum(uint256 newQuorum)

The storage quorum value has been changed

Parameters

SetRiver

event SetRiver(address _river)

The storage river address value has been changed

Parameters

SetSpec

event SetSpec(uint64 epochsPerFrame, uint64 slotsPerEpoch, uint64 secondsPerSlot, uint64 genesisTime)

The consensus layer spec has been changed

Parameters

Errors

AddressAlreadyInUse

error AddressAlreadyInUse(address newAddress)

The address is already in use by an oracle member

Parameters

AlreadyReported

error AlreadyReported(uint256 epochId, address member)

The member already reported on the given epoch id

Parameters

EpochTooOld

error EpochTooOld(uint256 providedEpochId, uint256 minExpectedEpochId)

The provided epoch is too old compared to the expected epoch id

Parameters

InvalidArgument

error InvalidArgument()

The argument was invalid

InvalidCall

error InvalidCall()

The call was invalid

InvalidInitialization

error InvalidInitialization(uint256 version, uint256 expectedVersion)

An error occured during the initialization

Parameters

InvalidZeroAddress

error InvalidZeroAddress()

The address is zero

NotFrameFirstEpochId

error NotFrameFirstEpochId(uint256 providedEpochId, uint256 expectedFrameFirstEpochId)

The provided epoch is not at the beginning of its frame

Parameters

TotalValidatorBalanceDecreaseOutOfBound

error TotalValidatorBalanceDecreaseOutOfBound(uint256 prevTotalEth, uint256 postTotalEth, uint256 timeElapsed, uint256 relativeLowerBound)

The negative delta in balance is above the allowed lower bound

Parameters

TotalValidatorBalanceIncreaseOutOfBound

error TotalValidatorBalanceIncreaseOutOfBound(uint256 prevTotalEth, uint256 postTotalEth, uint256 timeElapsed, uint256 annualAprUpperBound)

The delta in balance is above the allowed upper bound

Parameters

Unauthorized

error Unauthorized(address caller)

The operator is unauthorized for the caller

Parameters

Last updated