Events ​
LogRebalanceRate ​
event LogRebalanceRate(uint256 oldRate, uint256 newRate)
emitted when rebalancer successfully changes the contract rate
Constants ​
_WEETH ​
contract IWeETH _WEETH
WEETH contract; on mainnet 0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee
_MIN_UPDATE_DIFF_PERCENT ​
uint256 _MIN_UPDATE_DIFF_PERCENT
Minimum difference to trigger update in percent 1e4 decimals, 10000 = 1%
_MIN_HEART_BEAT ​
uint256 _MIN_HEART_BEAT
Minimum time after which an update can trigger, even if it does not reach _MIN_UPDATE_DIFF_PERCENT
Variables ​
_rate ​
uint216 _rate
amount of eETH for 1 wEETH, in 1e27 decimals
_lastUpdateTime ​
uint40 _lastUpdateTime
time when last update for rate happened
WEETHContractRate ​
This contract stores the rate of eETH for 1 wEETH in intervals to optimize gas cost. Properly implements all interfaces for use as IFluidCenterPrice and IFluidOracle.
validAddress ​
modifier validAddress(address value_)
Validates that an address is not the zero address
constructor ​
constructor(string infoName_, contract IWeETH wEETH_, uint256 minUpdateDiffPercent_, uint256 minHeartBeat_) public
infoName ​
function infoName() public view returns (string)
helper string to easily identify the oracle. E.g. token symbols
rebalance ​
function rebalance() external
Rebalance the contract rate by updating the stored rate with the current rate from the WEETH contract.
The rate is only updated if the difference between the current rate and the new rate is greater than or equal to the minimum update difference percentage.
getEETHByWeETH ​
function getEETHByWeETH(uint256 _weETHAmount) external view returns (uint256)
Get amount of eETH for {_weETHAmount} weETH
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | Amount of eETH for {_weETHAmount} weETH |
getWeETHByeETH ​
function getWeETHByeETH(uint256 _eETHAmount) external view returns (uint256)
Get amount of weETH for {_eETHAmount} eETH
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | Amount of weETH for {_eETHAmount} eETH |
centerPrice ​
function centerPrice() external returns (uint256 price_)
Retrieves the center price for the pool
This function is marked as non-constant (potentially state-changing) to allow flexibility in price fetching mechanisms. While typically used as a read-only operation, this design permits write operations if needed for certain token pairs (e.g., fetching up-to-date exchange rates that may require state changes).
Return Values ​
Name | Type | Description |
---|---|---|
price_ | uint256 | The current price ratio of token1 to token0, expressed with 27 decimal places |
getExchangeRate ​
function getExchangeRate() external view virtual returns (uint256 exchangeRate_)
Deprecated. Use getExchangeRateOperate()
and getExchangeRateLiquidate()
instead. Only implemented for backwards compatibility.
getExchangeRateOperate ​
function getExchangeRateOperate() external view virtual returns (uint256 exchangeRate_)
Get the exchangeRate_
between the underlying asset and the peg asset in 1e27 for operates
getExchangeRateLiquidate ​
function getExchangeRateLiquidate() external view virtual returns (uint256 exchangeRate_)
Get the exchangeRate_
between the underlying asset and the peg asset in 1e27 for liquidations
configPercentDiff ​
function configPercentDiff() public view virtual returns (uint256 configPercentDiff_)
returns how much the new rate would be different from current rate in percent (10000 = 1%, 1 = 0.0001%).
configData ​
function configData() external view returns (uint256 minUpdateDiffPercent_, uint256 minHeartBeat_, uint40 lastUpdateTime_, address weeth_)
returns all config vars, last update timestamp, and weeth address