Skip to content

Commit

Permalink
Merge pull request #8 from joaobrunoah/rate-provider/binance-st-eth
Browse files Browse the repository at this point in the history
Create a RateProvider to wBETH
  • Loading branch information
rabmarut authored May 3, 2023
2 parents 701517f + 4c68be3 commit 02dbb4e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
37 changes: 37 additions & 0 deletions contracts/BinanceBeaconEthRateProvider.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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.0;

import "./interfaces/IRateProvider.sol";
import "./interfaces/IwBETH.sol";

/**
* @title Wrapped Binance Beacon ETH Rate Provider
* @notice Returns the value of wBETH in terms of ETH
*/
contract BinanceBeaconEthRateProvider is IRateProvider {
IwBETH public immutable wBETH;

constructor(IwBETH _wBETH) {
wBETH = _wBETH;
}

/**
* @return the value of wBETH in terms of ETH
*/
function getRate() external view override returns (uint256) {
return wBETH.exchangeRate();
}
}
26 changes: 26 additions & 0 deletions contracts/interfaces/IwBETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-3.0
// 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.0;

/**
* @title Token wrapper for Binance ETH staking deposits.
*/
interface IwBETH {
/**
* @notice Get amount of ETH for 1 wBETH
* @return Amount of ETH for 1 wBETH
*/
function exchangeRate() external view returns (uint256);
}

0 comments on commit 02dbb4e

Please sign in to comment.