Skip to content

Events ​

LogRebalanceRate ​

solidity
event LogRebalanceRate(uint256 oldRate, uint256 newRate)

emitted when rebalancer successfully changes the contract rate

Constants ​

_WSTETH ​

solidity
contract IWstETH _WSTETH

WSTETH contract; on mainnet 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0

_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 stETH for 1 wstETH, in 1e27 decimals

_lastUpdateTime ​

solidity
uint40 _lastUpdateTime

time when last update for rate happened

WstETHContractRate ​

This contract stores the rate of stETH for 1 wstETH 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 IWstETH wstETH_, 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 WSTETH 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.

stEthPerToken ​

solidity
function stEthPerToken() external view returns (uint256)

Get amount of stETH for 1 wstETH

Return Values ​

NameTypeDescription
[0]uint256Amount of stETH for 1 wstETH

tokensPerStEth ​

solidity
function tokensPerStEth() external view returns (uint256)

Get amount of wstETH for 1 stETH

Return Values ​

NameTypeDescription
[0]uint256Amount of wstETH for 1 stETH

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 wsteth_)

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