Events ​
LogRebalanceRate ​
event LogRebalanceRate(uint256 oldRate, uint256 newRate)
emitted when rebalancer successfully changes the contract rate
Constants ​
_WSTETH ​
contract IWstETH _WSTETH
WSTETH contract; on mainnet 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0
_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 stETH for 1 wstETH, in 1e27 decimals
_lastUpdateTime ​
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 ​
modifier validAddress(address value_)
Validates that an address is not the zero address
constructor ​
constructor(string infoName_, contract IWstETH wstETH_, 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 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 ​
function stEthPerToken() external view returns (uint256)
Get amount of stETH for 1 wstETH
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | Amount of stETH for 1 wstETH |
tokensPerStEth ​
function tokensPerStEth() external view returns (uint256)
Get amount of wstETH for 1 stETH
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | Amount of wstETH for 1 stETH |
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 wsteth_)
returns all config vars, last update timestamp, and wsteth address