Description:
Smart contract deployed on Ethereum with Oracle features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{"IWeETH.sol":{"content":"// SPDX-License-Identifier: GPL-2.0-or-later\r
pragma solidity ^0.8.21;\r
\r
/// @title weETH ERC20-like interface for Exchange Rate\r
interface IWeETH {\r
function getRate() external view returns (uint256);\r
}\r
"},"MinimalAggregatorV3Interface.sol":{"content":"// SPDX-License-Identifier: GPL-2.0-or-later\r
pragma solidity ^0.8.21;\r
\r
interface MinimalAggregatorV3Interface {\r
function decimals() external view returns (uint8);\r
function description() external view returns (string memory);\r
function version() external view returns (uint256);\r
function latestRoundData()\r
external\r
view\r
returns (\r
uint80 roundId,\r
int256 answer,\r
uint256 startedAt,\r
uint256 updatedAt,\r
uint80 answeredInRound\r
);\r
}"},"WeethExchangeRateAdapter.sol":{"content":"// SPDX-License-Identifier: GPL-2.0-or-later\r
pragma solidity ^0.8.21;\r
\r
import {IWeETH} from "./IWeETH.sol";\r
import {MinimalAggregatorV3Interface} from "./MinimalAggregatorV3Interface.sol";\r
\r
/// @title weETH Exchange Rate Adapter\r
/// @notice weETH/ETH exchange rate Chainlink-compatible adapter\r
/// @dev Adapter for EtherFi weETH getRate() to Chainlink format\r
contract WeethExchangeRateAdapter is MinimalAggregatorV3Interface {\r
uint8 public constant override decimals = 18;\r
string public constant override description = "weETH/ETH exchange rate adapter";\r
uint256 public constant override version = 1;\r
\r
IWeETH public immutable weETH;\r
\r
constructor() {\r
weETH = IWeETH(0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee);\r
}\r
\r
function latestRoundData()\r
external\r
view\r
override\r
returns (\r
uint80 roundId,\r
int256 answer,\r
uint256 startedAt,\r
uint256 updatedAt,\r
uint80 answeredInRound\r
)\r
{\r
uint256 rate = weETH.getRate();\r
\r
require(rate \u003e 0, "Invalid exchange rate");\r
require(rate \u003c= type(uint192).max, "Exchange rate too large");\r
\r
return (\r
0, // roundId - not applicable for this oracle\r
int256(rate), // answer - weETH/ETH rate in 18 decimals\r
0, // startedAt - not applicable\r
block.timestamp, // updatedAt - current block time\r
0 // answeredInRound - not applicable\r
);\r
}\r
}\r
"}}
Submitted on: 2025-10-31 17:29:59
Comments
Log in to comment.
No comments yet.