Verified contractExactGPL-3.0-or-later
KPKWSTETHV3RateProvider
Address0xe1253a212062f542d3dc5bf2dac88a1f6410e3ef
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.24
- Same code
1 more contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 10,000 runs
- EVM version
- cancun
- License
- GPL-3.0-or-later
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 23,730,082
- Creation transaction
- 0xea2dca423e…a31b3a571f
2 files
contracts/rate-providers/KPKWSTETHV3RateProvider.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity =0.8.24;
import '../interfaces/lido/IwstETH.sol';
interface IERC4626 {
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
}
/**
* @title Gearbox KPKWSTETHV3 Exchange Rate Provider
* @notice Returns the value of KPKWSTETHV3 in terms of underlying ETH
*/
contract KPKWSTETHV3RateProvider {
IwstETH public immutable wstETH;
IERC4626 public immutable TOKEN;
constructor(IwstETH _wstETH, IERC4626 _erc4626) {
wstETH = _wstETH;
TOKEN = _erc4626;
}
/**
* @return the value of 1 KPKWSTETHV3 token in terms of ETH
*/
function getRate() external view returns (uint256) {
return wstETH.getStETHByWstETH(TOKEN.convertToAssets(1e18));
}
}
contracts/interfaces/lido/IwstETH.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;
/// @dev https://docs.lido.fi/contracts/wsteth
/// @dev https://etherscan.io/token/0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0
interface IwstETH {
/**
* Get amount of stETH for a given amount of wstETH
* @param _wstETHAmount amount of wstETH
* @return Amount of stETH for a given wstETH amount
*/
function getStETHByWstETH(uint256 _wstETHAmount) external view returns (uint256);
/**
* Get amount of wstETH for a given amount of stETH
* @param _stETHAmount amount of stETH
* @return Amount of wstETH for a given stETH amount
*/
function getWstETHByStETH(uint256 _stETHAmount) external view returns (uint256);
/**
* @return Returns the amount of stETH tokens corresponding to one wstETH
*/
function stEthPerToken() external view returns (uint256);
/**
* Exchanges stETH to wstETH
* @param _stETHAmount amount of stETH to wrap in exchange for wstETH
* @return Amount of wstETH user receives after wrap
*/
function wrap(uint256 _stETHAmount) external returns (uint256);
/**
* Exchanges wstETH to stETH
* @param _wstETHAmount amount of wstETH to unwrap in exchange for stETH
* @return Amount of stETH user receives after unwrapping
*/
function unwrap(uint256 _wstETHAmount) external returns (uint256);
/**
* Shortcut to stake ETH and auto-wrap returned stETH
*/
receive() external payable;
}
Compiler settingsShow
{
"optimizer": {
"runs": 10000,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.