EtherFiLibrary
A helper library for EtherFi-related conversions.
Functions
getEthAmountInForLstAmountOut
Returns the amount of ETH required to obtain a given amount of weETH.
Performing the calculations seems to potentially yield a rounding error of 1-2 wei. In order to ensure that the correct value is returned, both versions are tested and the correct one is returned. Should a correct version ever not be found, any contracts using the library should halt execution.
Parameters
Name | Type | Description |
---|---|---|
|
| contract. |
|
| Desired amount of weETH. [WAD] |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of ETH required to obtain the given amount of weETH. [WAD] |
getLstAmountOutForEthAmountIn
Returns the amount of weETH that will be obtained from a given amount of ETH.
Parameters
Name | Type | Description |
---|---|---|
|
| contract. |
|
| Amount of ETH to deposit. [WAD] |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of weETH that will be obtained. [WAD] |
_getLstAmountOutForEthAmountIn
An internal helper function to calculate the amount of weETH that will be obtained from a given amount of ETH.
This is useful if the function arguments are already known so that additional external calls can be avoided.
Parameters
Name | Type | Description |
---|---|---|
|
| Total pooled ether in the Ether Fi pool. [WAD] |
|
| Total amount of minted shares. [WAD] |
|
| Amount of ETH to deposit. [WAD] |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of weETH that will be obtained. [WAD] |
depositForLrt
Deposits a given amount of ETH into the Ether Fi pool and then uses the received eETH to mint weETH.
Parameters
Name | Type | Description |
---|---|---|
|
| contract. |
|
| Amount of ETH to deposit. [WAD] |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of weETH that was obtained. [WAD] |
_sharesForAmount
An internal helper function to calculate the amount of shares from amount.
Useful for avoiding external calls when the function arguments are already known.
Parameters
Name | Type | Description |
---|---|---|
|
| Total pooled ether in the Ether Fi pool. [WAD] |
|
| Total amount of minted shares. [WAD] |
|
| Amount of ETH. [WAD] |
_amountForShares
An internal helper function to calculate the amount from given amount of shares.
Useful for avoiding external calls when the function arguments are already known.
Parameters
Name | Type | Description |
---|---|---|
|
| Total pooled ether in the Ether Fi pool. [WAD] |
|
| Total amount of minted shares. [WAD] |
|
| Amount of shares. [WAD] |