IOracleV1

Alluvial Finance Inc.

Oracle Interface (v1)

This interface exposes methods to handle the input from the allowed oracle members.Highly inspired by Lido's implementation.

Methods

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

Name
Type
Description

_newOracleMember

address

Address of the new member

_newQuorum

uint256

New quorum value

getGlobalReportStatus

function getGlobalReportStatus() external view returns (uint256)

Retrieve member report status

Returns

Name
Type
Description

_0

uint256

The raw report status value

getLastReportedEpochId

function getLastReportedEpochId() external view returns (uint256)

Retrieve the last reported epoch id

The Oracle contracts expects reports on an epoch id >= that the returned value

Returns

Name
Type
Description

_0

uint256

The last reported epoch id

getMemberReportStatus

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

Retrieve member report status

Parameters

Name
Type
Description

_oracleMember

address

Address of member to check

Returns

Name
Type
Description

_0

bool

True if member has reported

getOracleMembers

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

Retrieve the list of oracle members

Returns

Name
Type
Description

_0

address[]

The oracle members

getQuorum

function getQuorum() external view returns (uint256)

Retrieve the current quorum

Returns

Name
Type
Description

_0

uint256

The current quorum

getReportVariantDetails

function getReportVariantDetails(uint256 _idx) external view returns (struct ReportsVariants.ReportVariantDetails)

Retrieve the details of a report variant

Parameters

Name
Type
Description

_idx

uint256

The index of the report variant

Returns

Name
Type
Description

_0

ReportsVariants.ReportVariantDetails

The report variant details

getReportVariantsCount

function getReportVariantsCount() external view returns (uint256)

Retrieve report variants count

Returns

Name
Type
Description

_0

uint256

The count of report variants

getRiver

function getRiver() external view returns (address)

Retrieve River address

Returns

Name
Type
Description

_0

address

The address of River

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

Name
Type
Description

_river

address

Address of the River contract, able to receive oracle input data after quorum is met

_administratorAddress

address

Address able to call administrative methods

_epochsPerFrame

uint64

CL spec parameter. Number of epochs in a frame.

_slotsPerEpoch

uint64

CL spec parameter. Number of slots in one epoch.

_secondsPerSlot

uint64

CL spec parameter. Number of seconds between slots.

_genesisTime

uint64

CL spec parameter. Timestamp of the genesis slot.

_annualAprUpperBound

uint256

CL bound parameter. Maximum apr allowed for balance increase. Delta between updates is extrapolated on a year time frame.

_relativeLowerBound

uint256

CL bound parameter. Maximum relative balance decrease.

initOracleV1_1

function initOracleV1_1() external nonpayable

Initializes the oracle

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

Name
Type
Description

_memberAddress

address

Address of the member

Returns

Name
Type
Description

_0

bool

True if address is a member

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

Name
Type
Description

_oracleMember

address

Address to remove

_newQuorum

uint256

New quorum value

reportConsensusLayerData

function reportConsensusLayerData(IOracleManagerV1.ConsensusLayerReport _report) external nonpayable

Parameters

Name
Type
Description

_report

IOracleManagerV1.ConsensusLayerReport

undefined

setMember

function setMember(address _oracleMember, address _newAddress) external nonpayable

Changes the address of an oracle member

Only callable by the adminitrator or the member itselfCannot use an address already in use

Parameters

Name
Type
Description

_oracleMember

address

Address to change

_newAddress

address

New address for the member

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

Name
Type
Description

_newQuorum

uint256

New quorum parameter

Events

AddMember

event AddMember(address indexed member)

A member has been added to the oracle member list

Parameters

Name
Type
Description

member indexed

address

The address of the member

ClearedReporting

event ClearedReporting()

Cleared reporting data

RemoveMember

event RemoveMember(address indexed member)

A member has been removed from the oracle member list

Parameters

Name
Type
Description

member indexed

address

The address of the member

ReportedConsensusLayerData

event ReportedConsensusLayerData(address indexed member, bytes32 indexed variant, IOracleManagerV1.ConsensusLayerReport report, uint256 voteCount, uint256 quorum)

An oracle member performed a report

Parameters

Name
Type
Description

member indexed

address

The oracle member

variant indexed

bytes32

The variant of the report

report

IOracleManagerV1.ConsensusLayerReport

The raw report structure

voteCount

uint256

The vote count

quorum

uint256

undefined

SetBounds

event SetBounds(uint256 annualAprUpperBound, uint256 relativeLowerBound)

The report bounds have been changed

Parameters

Name
Type
Description

annualAprUpperBound

uint256

The maximum allowed apr. 10% means increases in balance extrapolated to a year should not exceed 10%.

relativeLowerBound

uint256

The maximum allowed balance decrease as a relative % of the total balance

SetLastReportedEpoch

event SetLastReportedEpoch(uint256 lastReportedEpoch)

The last reported epoch has changed

Parameters

Name
Type
Description

lastReportedEpoch

uint256

undefined

SetMember

event SetMember(address indexed oldAddress, address indexed newAddress)

A member address has been edited

Parameters

Name
Type
Description

oldAddress indexed

address

The previous member address

newAddress indexed

address

The new member address

SetQuorum

event SetQuorum(uint256 newQuorum)

The storage quorum value has been changed

Parameters

Name
Type
Description

newQuorum

uint256

The new quorum value

SetRiver

event SetRiver(address _river)

The storage river address value has been changed

Parameters

Name
Type
Description

_river

address

The new river address

SetSpec

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

The consensus layer spec has been changed

Parameters

Name
Type
Description

epochsPerFrame

uint64

The number of epochs inside a frame (225 = 24 hours)

slotsPerEpoch

uint64

The number of slots inside an epoch (32 on ethereum mainnet)

secondsPerSlot

uint64

The time between two slots (12 seconds on ethereum mainnet)

genesisTime

uint64

The timestamp of block #0

Errors

AddressAlreadyInUse

error AddressAlreadyInUse(address newAddress)

The address is already in use by an oracle member

Parameters

Name
Type
Description

newAddress

address

The address already in use

AlreadyReported

error AlreadyReported(uint256 epochId, address member)

The member already reported on the given epoch id

Parameters

Name
Type
Description

epochId

uint256

The epoch id provided as input

member

address

The oracle member

EpochTooOld

error EpochTooOld(uint256 providedEpochId, uint256 minExpectedEpochId)

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

Parameters

Name
Type
Description

providedEpochId

uint256

The epoch id provided as input

minExpectedEpochId

uint256

The minimum epoch id expected

InvalidEpoch

error InvalidEpoch(uint256 epoch)

Thrown when the reported epoch is invalid

Parameters

Name
Type
Description

epoch

uint256

The invalid epoch

ReportIndexOutOfBounds

error ReportIndexOutOfBounds(uint256 index, uint256 length)

Thrown when the report indexs fetched is out of bounds

Parameters

Name
Type
Description

index

uint256

Requested index

length

uint256

Size of the variant array

Last updated