Skip to content

Events ​

LogRebalanceRate ​

solidity
event LogRebalanceRate(uint256 oldRate, uint256 newRate)

emitted when rebalancer successfully changes the contract rate

Constants ​

_WEETH ​

solidity
contract IWeETH _WEETH

WEETH contract; on mainnet 0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee

_MIN_UPDATE_DIFF_PERCENT ​

solidity
uint256 _MIN_UPDATE_DIFF_PERCENT

Minimum difference to trigger update in percent 1e4 decimals, 10000 = 1%

_MIN_HEART_BEAT ​

solidity
uint256 _MIN_HEART_BEAT

Minimum time after which an update can trigger, even if it does not reach _MIN_UPDATE_DIFF_PERCENT

Variables ​

_rate ​

solidity
uint216 _rate

amount of eETH for 1 wEETH, in 1e27 decimals

_lastUpdateTime ​

solidity
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 ​

solidity
modifier validAddress(address value_)

Validates that an address is not the zero address

constructor ​

solidity
constructor(string infoName_, contract IWeETH wEETH_, uint256 minUpdateDiffPercent_, uint256 minHeartBeat_) public

infoName ​

solidity
function infoName() public view returns (string)

helper string to easily identify the oracle. E.g. token symbols

rebalance ​

solidity
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 ​

solidity
function getEETHByWeETH(uint256 _weETHAmount) external view returns (uint256)

Get amount of eETH for {_weETHAmount} weETH

Return Values ​

NameTypeDescription
[0]uint256Amount of eETH for {_weETHAmount} weETH

getWeETHByeETH ​

solidity
function getWeETHByeETH(uint256 _eETHAmount) external view returns (uint256)

Get amount of weETH for {_eETHAmount} eETH

Return Values ​

NameTypeDescription
[0]uint256Amount of weETH for {_eETHAmount} eETH

centerPrice ​

solidity
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 ​

NameTypeDescription
price_uint256The current price ratio of token1 to token0, expressed with 27 decimal places

getExchangeRate ​

solidity
function getExchangeRate() external view virtual returns (uint256 exchangeRate_)

Deprecated. Use getExchangeRateOperate() and getExchangeRateLiquidate() instead. Only implemented for backwards compatibility.

getExchangeRateOperate ​

solidity
function getExchangeRateOperate() external view virtual returns (uint256 exchangeRate_)

Get the exchangeRate_ between the underlying asset and the peg asset in 1e27 for operates

getExchangeRateLiquidate ​

solidity
function getExchangeRateLiquidate() external view virtual returns (uint256 exchangeRate_)

Get the exchangeRate_ between the underlying asset and the peg asset in 1e27 for liquidations

configPercentDiff ​

solidity
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 ​

solidity
function configData() external view returns (uint256 minUpdateDiffPercent_, uint256 minHeartBeat_, uint40 lastUpdateTime_, address weeth_)

returns all config vars, last update timestamp, and weeth address