MockWstEthOracleMiddlewareWithPyth
Inherits: WstEthOracleMiddlewareWithPyth
This contract is used to get the price of wstETH by setting up a price or forwarding it to wstethMiddleware
This aims at simulating price action. Do not use in production
State Variables
_wstethMockedConfBps
Confidence interval percentage numerator
uint16 internal _wstethMockedConfBps = 20;
_wstethMockedPrice
wstETH mocked price
This price will be used if greater than zero
uint256 internal _wstethMockedPrice;
_verifySignature
If we need to verify the provided signature data or not
If _wstethMockedPrice == 0, this setting is ignored
bool internal _verifySignature = true;
Functions
constructor
constructor(
address pythContract,
bytes32 pythFeedId,
address chainlinkPriceFeed,
address wsteth,
uint256 chainlinkTimeElapsedLimit
) WstEthOracleMiddlewareWithPyth(pythContract, pythFeedId, chainlinkPriceFeed, wsteth, chainlinkTimeElapsedLimit);
parseAndValidatePrice
function parseAndValidatePrice(
bytes32 actionId,
uint128 targetTimestamp,
Types.ProtocolAction action,
bytes calldata data
) public payable override returns (PriceInfo memory price_);
setWstethMockedPrice
Set WstEth mocked price
If the new mocked WstEth is greater than zero this will validate this mocked price else this will validate the parent middleware price
function setWstethMockedPrice(uint256 newWstethMockedPrice) external;
Parameters
Name | Type | Description |
---|---|---|
newWstethMockedPrice | uint256 | The mock price to set |
setWstethMockedConfBps
Set Wsteth mocked confidence interval percentage
To calculate a percentage of the neutral price up or down in some protocol actions
function setWstethMockedConfBps(uint16 newWstethMockedConfPct) external;
Parameters
Name | Type | Description |
---|---|---|
newWstethMockedConfPct | uint16 | The mock confidence interval |
getWstethMockedPrice
Get current WstEth mocked price
function getWstethMockedPrice() external view returns (uint256);
getWstethMockedConfBps
Get current WstEth mocked confidence interval
function getWstethMockedConfBps() external view returns (uint64);
getVerifySignature
Get the signature verification flag
function getVerifySignature() external view returns (bool);
setVerifySignature
Set the signature verification flag
function setVerifySignature(bool verify) external;
validationCost
function validationCost(bytes calldata data, Types.ProtocolAction action)
public
view
override(IBaseOracleMiddleware, CommonOracleMiddleware)
returns (uint256 result_);