harmonixfi / core-smart-contract

Core smart contracts of Harmonix Finance
https://harmonix.fi/
6 stars 1 forks source link

Check the withdrawal rate of ezETH/ETH from Renzo contract #139

Open baonguyen1904 opened 2 months ago

baonguyen1904 commented 2 months ago

Problem Statement: Renzo has activated the withdrawal feature within their contract. Our task is to determine how to retrieve the swap rate from ezETH to ETH on the withdrawal interface.

image

Research Goals:

  1. Swap Rate Calculation: Investigate methods to calculate the swap rate accurately between ezETH and ETH.
  2. Availability for Withdrawal: Determine if it's feasible to display the amount available for withdrawal based on the swap rate.

These steps will guide us in integrating the necessary functionality seamlessly.

dangeth commented 1 month ago

Sample of withdrawing 1 ezETH: 0x5a12796f7e7EBbbc8a402667d266d2e65A814042::calculateRedeemAmount(_ezETHBeingBurned = 1000000000000000000, _existingEzETHSupply = 718248708618119206789770, _currentValueInProtocol = 728391380969593839730476)

Where: • _ezETHBeingBurned is the withdrawal input • _existingEzETHSupply from 0xbf5495Efe5DB9ce00f80364C8B423567e58d2110::totalSupply()_currentValueInProtocol from 0x74a09653A083691711cF8215a6ab074BB4e99ef5::calculateTVLs()

_existingEzETHSupply and _currentValueInProtocol can be got by multicall at once.