From 64959a54bee310ba14bab0e8e437e7c5a8198d00 Mon Sep 17 00:00:00 2001 From: Joao Bruno Date: Tue, 2 May 2023 19:51:37 -0300 Subject: [PATCH 1/5] Create a RateProvider to wBETH --- contracts/BinanceBeaconEthRateProvider.sol | 37 ++++++++++++++++++++++ contracts/interfaces/IwBETH.sol | 26 +++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 contracts/BinanceBeaconEthRateProvider.sol create mode 100644 contracts/interfaces/IwBETH.sol diff --git a/contracts/BinanceBeaconEthRateProvider.sol b/contracts/BinanceBeaconEthRateProvider.sol new file mode 100644 index 0000000..2e01505 --- /dev/null +++ b/contracts/BinanceBeaconEthRateProvider.sol @@ -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 . + +pragma solidity ^0.8.0; + +import "./interfaces/IRateProvider.sol"; +import "./interfaces/IwBETH.sol"; + +/** + * @title Wrapped BETH Rate Provider + * @notice Returns the value of wBETH in terms of BETH + */ +contract BinanceBeaconEthRateProvider is IRateProvider { + IwBETH public immutable wBETH; + + constructor(IwBETH _wBETH) { + wBETH = _wBETH; + } + + /** + * @return the value of wBETH in terms of BETH + */ + function getRate() external view override returns (uint256) { + return wBETH.exchangeRate(); + } +} diff --git a/contracts/interfaces/IwBETH.sol b/contracts/interfaces/IwBETH.sol new file mode 100644 index 0000000..5ff56d6 --- /dev/null +++ b/contracts/interfaces/IwBETH.sol @@ -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 . + +pragma solidity ^0.8.0; + +/** + * @title wBETH token wrapper with static balances. + */ +interface IwBETH { + /** + * @notice Get amount of BETH for 1 wBETH + * @return Amount of BETH for 1 wBETH + */ + function exchangeRate() external view returns (uint256); +} From 649024862444fd4ed5fc9e34af6f7b392f1861f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bruno=20Abou=20Hatem=20de=20Liz?= Date: Wed, 3 May 2023 17:30:48 -0300 Subject: [PATCH 2/5] Update contracts/BinanceBeaconEthRateProvider.sol Co-authored-by: rabmarut --- contracts/BinanceBeaconEthRateProvider.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/BinanceBeaconEthRateProvider.sol b/contracts/BinanceBeaconEthRateProvider.sol index 2e01505..764f71c 100644 --- a/contracts/BinanceBeaconEthRateProvider.sol +++ b/contracts/BinanceBeaconEthRateProvider.sol @@ -18,8 +18,8 @@ import "./interfaces/IRateProvider.sol"; import "./interfaces/IwBETH.sol"; /** - * @title Wrapped BETH Rate Provider - * @notice Returns the value of wBETH in terms of BETH + * @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; From 84437287ca300e8e3edf67b18ba5dedb1718c5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bruno=20Abou=20Hatem=20de=20Liz?= Date: Wed, 3 May 2023 17:30:54 -0300 Subject: [PATCH 3/5] Update contracts/BinanceBeaconEthRateProvider.sol Co-authored-by: rabmarut --- contracts/BinanceBeaconEthRateProvider.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/BinanceBeaconEthRateProvider.sol b/contracts/BinanceBeaconEthRateProvider.sol index 764f71c..20f9ddc 100644 --- a/contracts/BinanceBeaconEthRateProvider.sol +++ b/contracts/BinanceBeaconEthRateProvider.sol @@ -29,7 +29,7 @@ contract BinanceBeaconEthRateProvider is IRateProvider { } /** - * @return the value of wBETH in terms of BETH + * @return the value of wBETH in terms of ETH */ function getRate() external view override returns (uint256) { return wBETH.exchangeRate(); From 46f859722ef36294ff313aa068ed8f8233c52fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bruno=20Abou=20Hatem=20de=20Liz?= Date: Wed, 3 May 2023 17:31:12 -0300 Subject: [PATCH 4/5] Update contracts/interfaces/IwBETH.sol Co-authored-by: rabmarut --- contracts/interfaces/IwBETH.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IwBETH.sol b/contracts/interfaces/IwBETH.sol index 5ff56d6..0a179c3 100644 --- a/contracts/interfaces/IwBETH.sol +++ b/contracts/interfaces/IwBETH.sol @@ -15,7 +15,7 @@ pragma solidity ^0.8.0; /** - * @title wBETH token wrapper with static balances. + * @title Token wrapper for Binance ETH staking deposits. */ interface IwBETH { /** From 4c68be37d272697995ecc14057c192a3449ad76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bruno=20Abou=20Hatem=20de=20Liz?= Date: Wed, 3 May 2023 17:31:19 -0300 Subject: [PATCH 5/5] Update contracts/interfaces/IwBETH.sol Co-authored-by: rabmarut --- contracts/interfaces/IwBETH.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/interfaces/IwBETH.sol b/contracts/interfaces/IwBETH.sol index 0a179c3..4e6dc86 100644 --- a/contracts/interfaces/IwBETH.sol +++ b/contracts/interfaces/IwBETH.sol @@ -19,8 +19,8 @@ pragma solidity ^0.8.0; */ interface IwBETH { /** - * @notice Get amount of BETH for 1 wBETH - * @return Amount of BETH for 1 wBETH + * @notice Get amount of ETH for 1 wBETH + * @return Amount of ETH for 1 wBETH */ function exchangeRate() external view returns (uint256); }