RiverV1

Kiln

River (v1)

This contract merges all the manager contracts and implements all the virtual methods stitching all components together.

  1. Operators add BLS Public Keys of validators running in their infrastructure.

  2. User deposits ETH to the system and gets LsTokens minted in exchange.

  3. Upon deposit, the system verifies if the User is allowed to depositby querying the Allowlist.

  4. When the system has enough funds to deposit validators, keys are pulled from the Operators Registry.

  5. The deposit data is computed and the validators are funded via the OfficialDeposit contract.

  6. Oracles report the total balance of the running validators and the total countof running validators.

  7. The running validators propose blocks that reward the EL Fee Recipient. The funds are pulled back in the system.

Methods

DEPOSIT_SIZE

function DEPOSIT_SIZE() external view returns (uint256)

Size of a deposit in ETH

Returns

PUBLIC_KEY_LENGTH

function PUBLIC_KEY_LENGTH() external view returns (uint256)

Size of a BLS Public key in bytes

Returns

SIGNATURE_LENGTH

function SIGNATURE_LENGTH() external view returns (uint256)

Size of a BLS Signature in bytes

Returns

acceptAdmin

function acceptAdmin() external nonpayable

Accept the transfer of ownership

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

allowance

function allowance(address _owner, address _spender) external view returns (uint256)

Retrieve the allowance value for a spender

Parameters

Returns

approve

function approve(address _spender, uint256 _value) external nonpayable returns (bool)

Approves an account for future spendings

An approved account can use transferFrom to transfer funds on behalf of the token owner

Parameters

Returns

balanceOf

function balanceOf(address _owner) external view returns (uint256)

Retrieve the balance of an account

Parameters

Returns

balanceOfUnderlying

function balanceOfUnderlying(address _owner) external view returns (uint256)

Retrieve the underlying asset balance of an account

Parameters

Returns

decimals

function decimals() external pure returns (uint8)

Retrieve the decimal count

Returns

decreaseAllowance

function decreaseAllowance(address _spender, uint256 _subtractableValue) external nonpayable returns (bool)

Decrease allowance to another account

Parameters

Returns

deposit

function deposit() external payable

Explicit deposit method to mint on msg.sender

depositAndTransfer

function depositAndTransfer(address _recipient) external payable

Explicit deposit method to mint on msg.sender and transfer to _recipient

Parameters

depositToConsensusLayer

function depositToConsensusLayer(uint256 _maxCount) external nonpayable

Deposits current balance to the Consensus Layer by batches of 32 ETH

Parameters

getAdmin

function getAdmin() external view returns (address)

Retrieves the current admin address

Returns

getAllowlist

function getAllowlist() external view returns (address)

Retrieve the allowlist address

Returns

getBalanceToDeposit

function getBalanceToDeposit() external view returns (uint256)

Returns the amount of pending ETH

Returns

getCLValidatorCount

function getCLValidatorCount() external view returns (uint256)

Get CL validator count (the amount of validator reported by the oracles)

Returns

getCLValidatorTotalBalance

function getCLValidatorTotalBalance() external view returns (uint256)

Get CL validator total balance

Returns

getCollector

function getCollector() external view returns (address)

Retrieve the collector address

Returns

getCoverageFund

function getCoverageFund() external view returns (address)

Retrieve the coverage fund

Returns

getDepositedValidatorCount

function getDepositedValidatorCount() external view returns (uint256)

Get the deposited validator count (the count of deposits made by the contract)

Returns

getELFeeRecipient

function getELFeeRecipient() external view returns (address)

Retrieve the execution layer fee recipient

Returns

getGlobalFee

function getGlobalFee() external view returns (uint256)

Get the current global fee

Returns

getMetadataURI

function getMetadataURI() external view returns (string)

Retrieve the metadata uri string value

Returns

getOperatorsRegistry

function getOperatorsRegistry() external view returns (address)

Retrieve the operators registry

Returns

getOracle

function getOracle() external view returns (address)

Get oracle address

Returns

getPendingAdmin

function getPendingAdmin() external view returns (address)

Retrieve the current pending admin address

Returns

getWithdrawalCredentials

function getWithdrawalCredentials() external view returns (bytes32)

Retrieve the withdrawal credentials

Returns

increaseAllowance

function increaseAllowance(address _spender, uint256 _additionalValue) external nonpayable returns (bool)

Increase allowance to another account

Parameters

Returns

initRiverV1

function initRiverV1(address _depositContractAddress, address _elFeeRecipientAddress, bytes32 _withdrawalCredentials, address _oracleAddress, address _systemAdministratorAddress, address _allowlistAddress, address _operatorRegistryAddress, address _collectorAddress, uint256 _globalFee) external nonpayable

Initializes the River system

Parameters

name

function name() external pure returns (string)

Retrieve the token name

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

sendCoverageFunds

function sendCoverageFunds() external payable

Input for coverage funds

sendELFees

function sendELFees() external payable

Input for execution layer fee earnings

setAllowlist

function setAllowlist(address _newAllowlist) external nonpayable

Changes the allowlist address

Parameters

setCollector

function setCollector(address _newCollector) external nonpayable

Changes the collector address

Parameters

setConsensusLayerData

function setConsensusLayerData(uint256 _validatorCount, uint256 _validatorTotalBalance, bytes32 _roundId, uint256 _maxIncrease) external nonpayable

Sets the validator count and validator total balance sum reported by the oracle

Can only be called by the oracle addressThe round id is a blackbox value that should only be used to identify unique reportsWhen a report is performed, River computes the amount of fees that can be pulledfrom the execution layer fee recipient. This amount is capped by the max allowedincrease provided during the report.If the total asset balance increases (from the reported total balance and the pulled funds)we then compute the share that must be taken for the collector on the positive delta.The execution layer fees are taken into account here because they are the product ofnode operator's work, just like consensus layer fees, and both should be handled in thesame manner, as a single revenue stream for the users and the collector.

Parameters

setCoverageFund

function setCoverageFund(address _newCoverageFund) external nonpayable

Changes the coverage fund

Parameters

setELFeeRecipient

function setELFeeRecipient(address _newELFeeRecipient) external nonpayable

Changes the execution layer fee recipient

Parameters

setGlobalFee

function setGlobalFee(uint256 newFee) external nonpayable

Changes the global fee parameter

Parameters

setMetadataURI

function setMetadataURI(string _metadataURI) external nonpayable

Sets the metadata uri string value

Parameters

setOracle

function setOracle(address _oracleAddress) external nonpayable

Set the oracle address

Parameters

sharesFromUnderlyingBalance

function sharesFromUnderlyingBalance(uint256 _underlyingAssetAmount) external view returns (uint256)

Retrieve the shares count from an underlying asset amount

Parameters

Returns

symbol

function symbol() external pure returns (string)

Retrieve the token symbol

Returns

totalSupply

function totalSupply() external view returns (uint256)

Retrieve the total token supply

Returns

totalUnderlyingSupply

function totalUnderlyingSupply() external view returns (uint256)

Retrieve the total underlying asset supply

Returns

transfer

function transfer(address _to, uint256 _value) external nonpayable returns (bool)

Performs a transfer from the message sender to the provided account

Parameters

Returns

transferFrom

function transferFrom(address _from, address _to, uint256 _value) external nonpayable returns (bool)

Performs a transfer between two recipients

Parameters

Returns

underlyingBalanceFromShares

function underlyingBalanceFromShares(uint256 _shares) external view returns (uint256)

Retrieve the underlying asset balance from an amount of shares

Parameters

Returns

Events

Approval

event Approval(address indexed owner, address indexed spender, uint256 value)

Parameters

ConsensusLayerDataUpdate

event ConsensusLayerDataUpdate(uint256 validatorCount, uint256 validatorTotalBalance, bytes32 roundId)

The consensus layer data provided by the oracle has been updated

Parameters

FundedValidatorKey

event FundedValidatorKey(bytes publicKey)

A validator key got funded on the deposit contract

Parameters

Initialize

event Initialize(uint256 version, bytes cdata)

Emitted when the contract is properly initialized

Parameters

PulledCoverageFunds

event PulledCoverageFunds(uint256 amount)

Funds have been pulled from the Coverage Fund

Parameters

PulledELFees

event PulledELFees(uint256 amount)

Funds have been pulled from the Execution Layer Fee Recipient

Parameters

RewardsEarned

event RewardsEarned(address indexed _collector, uint256 _oldTotalUnderlyingBalance, uint256 _oldTotalSupply, uint256 _newTotalUnderlyingBalance, uint256 _newTotalSupply)

The system underlying supply increased. This is a snapshot of the balances for accounting purposes

Parameters

SetAdmin

event SetAdmin(address indexed admin)

The admin address changed

Parameters

SetAllowlist

event SetAllowlist(address indexed allowlist)

The stored Allowlist has been changed

Parameters

SetCollector

event SetCollector(address indexed collector)

The stored Collector has been changed

Parameters

SetCoverageFund

event SetCoverageFund(address indexed coverageFund)

The stored Coverage Fund has been changed

Parameters

SetDepositContractAddress

event SetDepositContractAddress(address indexed depositContract)

The stored deposit contract address changed

Parameters

SetELFeeRecipient

event SetELFeeRecipient(address indexed elFeeRecipient)

The stored Execution Layer Fee Recipient has been changed

Parameters

SetGlobalFee

event SetGlobalFee(uint256 fee)

The stored Global Fee has been changed

Parameters

SetMetadataURI

event SetMetadataURI(string metadataURI)

The stored Metadata URI string has been changed

Parameters

SetOperatorsRegistry

event SetOperatorsRegistry(address indexed operatorRegistry)

The stored Operators Registry has been changed

Parameters

SetOracle

event SetOracle(address indexed oracleAddress)

The stored oracle address changed

Parameters

SetPendingAdmin

event SetPendingAdmin(address indexed pendingAdmin)

The pending admin address changed

Parameters

SetWithdrawalCredentials

event SetWithdrawalCredentials(bytes32 withdrawalCredentials)

The stored withdrawal credentials changed

Parameters

Transfer

event Transfer(address indexed from, address indexed to, uint256 value)

Parameters

UserDeposit

event UserDeposit(address indexed depositor, address indexed recipient, uint256 amount)

User deposited ETH in the system

Parameters

Errors

AllowanceTooLow

error AllowanceTooLow(address _from, address _operator, uint256 _allowance, uint256 _value)

Allowance too low to perform operation

Parameters

BalanceTooLow

error BalanceTooLow()

Balance too low to perform operation

Denied

error Denied(address account)

The access was denied

Parameters

EmptyDeposit

error EmptyDeposit()

And empty deposit attempt was made

ErrorOnDeposit

error ErrorOnDeposit()

An error occured during the deposit

InconsistentPublicKeys

error InconsistentPublicKeys()

The length of the BLS Public key is invalid during deposit

InconsistentSignatures

error InconsistentSignatures()

The length of the BLS Signature is invalid during deposit

InvalidArgument

error InvalidArgument()

The argument was invalid

InvalidCall

error InvalidCall()

The call was invalid

InvalidEmptyString

error InvalidEmptyString()

The string is empty

InvalidFee

error InvalidFee()

The fee is invalid

InvalidInitialization

error InvalidInitialization(uint256 version, uint256 expectedVersion)

An error occured during the initialization

Parameters

InvalidPublicKeyCount

error InvalidPublicKeyCount()

The received count of public keys to deposit is invalid

InvalidSignatureCount

error InvalidSignatureCount()

The received count of signatures to deposit is invalid

InvalidValidatorCountReport

error InvalidValidatorCountReport(uint256 providedValidatorCount, uint256 depositedValidatorCount)

The reported validator count is invalid

Parameters

InvalidWithdrawalCredentials

error InvalidWithdrawalCredentials()

The withdrawal credentials value is null

InvalidZeroAddress

error InvalidZeroAddress()

The address is zero

NoAvailableValidatorKeys

error NoAvailableValidatorKeys()

The internal key retrieval returned no keys

NotEnoughFunds

error NotEnoughFunds()

Not enough funds to deposit one validator

NullTransfer

error NullTransfer()

Invalid empty transfer

SliceOutOfBounds

error SliceOutOfBounds()

The slice is outside of the initial bytes bounds

SliceOverflow

error SliceOverflow()

The length overflows an uint

Unauthorized

error Unauthorized(address caller)

The operator is unauthorized for the caller

Parameters

UnauthorizedTransfer

error UnauthorizedTransfer(address _from, address _to)

Invalid transfer recipients

Parameters

ZeroMintedShares

error ZeroMintedShares()

The computed amount of shares to mint is 0

Last updated