Harvey

Harvey

Human being.

Lido Oracle Analysis

LidoOracle is a contract where an oracle sends the balance of an address controlled by ETH 2.0 to the DAO. The oracle is specified by the DAO. The oracle pushes its report every frame (currently 225 epochs, equivalent to one day), and when the number of identical reports reaches the "quorum" value, the report is pushed to the Lido contract.

However, daily oracle reports are not guaranteed. If the Beacon Chain does not have finality, the oracle daemon may stop pushing its report for a long period of time. This ultimately results in no oracle reports and no stETH rebase for the entire period.

In addition, there are some notable mechanisms, such as storing collected reports as an array, adding a calculated holder reward APR, performing integrity checks on oracle reports using configurable values, and invoking receiver functions when reports are pushed.

The interaction between LidoOracle and the DAO is mainly reflected in the specification of the oracle. The oracle is specified by the DAO, which means the DAO is responsible for determining which oracles can send reports to LidoOracle. Additionally, LidoOracle also receives other instructions from the DAO, such as setting the quorum value, adding or removing oracle members, etc. These instructions help ensure the smooth operation of LidoOracle and ensure that the information it provides is accurate and reliable.

The interaction between LidoOracle and ETH 2.0 is mainly reflected in the oracle sending the balance of an address controlled by ETH 2.0 to LidoOracle. The oracle daemon pushes its report every frame (currently 225 epochs, equivalent to one day), and the report contains the balance information of the ETH 2.0 side. This information helps ensure that the information in the Lido contract is up-to-date and consistent with the actual situation on the ETH 2.0 side.

LidoOracle has taken some security measures to ensure its smooth operation and provide accurate and reliable information. For example, it performs integrity checks on oracle reports using configurable values to limit the impact of malicious oracles. It also stores collected reports as an array and invokes receiver functions when reports are pushed. Additionally, LidoOracle also receives other instructions from the DAO, such as setting the quorum value, adding or removing oracle members, etc. These measures help ensure the security of LidoOracle and prevent potential attacks or abuse.

To calculate the holder reward percentage, LidoOracle stores and provides the following data:

preTotalPooledEther: The total amount of staked Ether queried before the report is pushed to the Lido contract.
postTotalPooledEther: The same as above, but queried after the report is pushed.
lastCompletedEpochId: The epoch when the last report was pushed to Lido.
timeElapsed: The number of seconds between the current push epoch and lastCompletedEpochId. It should usually be the frame length: 32 * 12 * 225 = 86400, but it can be multiple if the previous frame did not reach the quorum.
lidoFee: The fee (in basis points) charged by Lido. It can be retrieved by calling getFee() in the Lido contract.
basisPoint: A constant that determines the precision of the fee, equal to 10000.
Please note that we collect post/pre pairs (instead of current/last) to avoid the impact of new stakes during the epoch.

To calculate the APR, use the following formula:

protocolAPR = (postTotalPooledEther - preTotalPooledEther) * secondsInYear / (preTotalPooledEther * timeElapsed)

lidoFeeAsFraction = lidoFee / basisPoint

userAPR = protocolAPR * (1 - lidoFeeAsFraction)

These parameters and formulas can be used to calculate the holder reward percentage and help users understand their investment return.

To calculate the holder reward percentage using these parameters, follow these steps:

Obtain the values of preTotalPooledEther and postTotalPooledEther. These values represent the total staked Ether queried before and after the report is pushed to the Lido contract.
Obtain the values of lastCompletedEpochId and timeElapsed. lastCompletedEpochId represents the epoch when the last report was pushed to Lido, while timeElapsed represents the number of seconds between the current push epoch and lastCompletedEpochId.
Obtain the values of lidoFee and basisPoint. lidoFee represents the fee (in basis points) charged by Lido and can be retrieved by calling getFee() in the Lido contract. basisPoint is a constant equal to 10000 that determines the precision of the fee.
Calculate protocolAPR, lidoFeeAsFraction, and userAPR using the values mentioned above. The calculations can be done using the following formulas:

protocolAPR = (postTotalPooledEther - preTotalPooledEther) * secondsInYear / (preTotalPooledEther * timeElapsed)

lidoFeeAsFraction = lidoFee / basisPoint

userAPR = protocolAPR * (1 - lidoFeeAsFraction)

The resulting userAPR value represents the holder reward percentage.

These parameters and formulas can be used to calculate the holder reward percentage and help users understand their investment return.

The values of these parameters are calculated and stored internally by the LidoOracle contract. You can obtain these values by interacting with the LidoOracle contract. For example, you can call the corresponding functions in the contract to query the values of preTotalPooledEther, postTotalPooledEther, lastCompletedEpochId, and timeElapsed. As for lidoFee and basisPoint, you can retrieve lidoFee by calling getFee() in the Lido contract, while basisPoint is a constant equal to 10000.

If you are not familiar with how to interact with smart contracts, it is recommended to seek professional help or further educate yourself on Ethereum smart contract-related knowledge.

These parameters are used to calculate the holder reward percentage and can help you understand your investment return. The values of preTotalPooledEther and postTotalPooledEther represent the total staked Ether queried before and after the report is pushed to the Lido contract. These values are used to calculate the change in total staked Ether over a given period of time. The values of lastCompletedEpochId and timeElapsed are used to determine the length of the given period of time, so that the change in total staked Ether can be converted into an annualized percentage. The values of lidoFee and basisPoint are used to calculate the fee charged by Lido, thereby determining the actual reward percentage received by the holders.

By calculating userAPR using these parameters, you can understand your investment return. userAPR represents the holder reward percentage and can help you understand how much your investment has grown over a given period of time.

In conclusion, LidoOracle is a contract that ensures its smooth operation and provides accurate and reliable information through its interaction with the DAO and ETH 2.0, as well as the implementation of security measures. It also provides parameters and formulas for calculating the holder reward percentage, helping users understand their investment return.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.