Description:
Decentralized Finance (DeFi) protocol contract providing Factory functionality.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/interfaces/lido/IwstETH.sol": {
"content": "// 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;
}
"
},
"contracts/rate-providers/KPKWSTETHV3RateProvider.sol": {
"content": "// 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));
}
}
"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 10000
},
"evmVersion": "cancun",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}
Submitted on: 2025-11-05 12:11:36
Comments
Log in to comment.
No comments yet.