generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: rsETH capo * test: rsETH capo tests * chore: adding rsETH report * feat: add rsETH command for deployment * Update src/contracts/lst-adapters/RsETHPriceCapAdapter.sol Co-authored-by: Ian Flexa <85500650+ianflexa@users.noreply.github.com> * Update scripts/DeployEthereum.s.sol * Update reports/RsETH_EthereumLido.md --------- Co-authored-by: Harsh Pandey <harshsatishpandey@gmail.com>
- Loading branch information
1 parent
6a56204
commit 47923fc
Showing
7 changed files
with
205 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Capo Report | ||
|
||
| Capped rsETH / ETH / USD | ETH / USD | Diff | Date | 14-day growth in yearly % | | ||
| --- | --- | --- | --- | --- | | ||
| 2711.57859276 | 2655.564 | 2.09% | 13 Aug 2024 | 3.98% | | ||
| 2786.10410793 | 2728.55 | 2.09% | 14 Aug 2024 | 3.55% | | ||
| 2669.33596318 | 2614.194 | 2.09% | 15 Aug 2024 | 3.55% | | ||
| 2673.2824415 | 2617.7059 | 2.10% | 16 Aug 2024 | 3.90% | | ||
| 2655.85775887 | 2600.64347 | 2.10% | 17 Aug 2024 | 3.61% | | ||
| 2674.37577813 | 2618.26 | 2.12% | 18 Aug 2024 | 4.12% | | ||
| 2637.57356625 | 2582.23 | 2.12% | 19 Aug 2024 | 3.26% | | ||
| 2715.70304836 | 2658.501217 | 2.13% | 20 Aug 2024 | 3.15% | | ||
| 2643.88216497 | 2588.19312274 | 2.13% | 21 Aug 2024 | 3.15% | | ||
| 2693.64840091 | 2636.91111453 | 2.13% | 22 Aug 2024 | 3.15% | | ||
| 2711.42292026 | 2654.14 | 2.14% | 23 Aug 2024 | 2.54% | | ||
| 2820.95270299 | 2761.3558 | 2.14% | 24 Aug 2024 | 2.54% | | ||
| 2813.24430466 | 2753.28 | 2.15% | 25 Aug 2024 | 2.39% | | ||
| 2785.81318635 | 2726.433576 | 2.15% | 26 Aug 2024 | 2.39% | | ||
| 2663.20208847 | 2605.96 | 2.17% | 27 Aug 2024 | 2.18% | | ||
| 2576.88685401 | 2521.5 | 2.17% | 28 Aug 2024 | 2.18% | | ||
| 2621.30148922 | 2564.96 | 2.17% | 29 Aug 2024 | 2.18% | | ||
| 2516.74814568 | 2462.16 | 2.19% | 30 Aug 2024 | 2.35% | | ||
| 2576.55401876 | 2520.66868658 | 2.19% | 31 Aug 2024 | 2.35% | | ||
| 2535.17608714 | 2479.95097885 | 2.20% | 01 Sept 2024 | 2.09% | | ||
| 2574.26663886 | 2518.19 | 2.20% | 02 Sept 2024 | 2.09% | | ||
| 2493.7908804 | 2439.08027 | 2.22% | 03 Sept 2024 | 2.28% | | ||
| 2520.05675028 | 2464.7699 | 2.22% | 04 Sept 2024 | 2.28% | | ||
| 2443.06683978 | 2388.95308708 | 2.24% | 05 Sept 2024 | 2.84% | | ||
| 2296.06356809 | 2245.14 | 2.24% | 06 Sept 2024 | 2.75% | | ||
| 2333.75961516 | 2282 | 2.24% | 07 Sept 2024 | 2.75% | | ||
| 2330.63979833 | 2278.2449 | 2.27% | 08 Sept 2024 | 3.05% | | ||
| 2401.86197912 | 2347.86594151 | 2.27% | 09 Sept 2024 | 3.05% | | ||
| 2433.63954048 | 2378.31 | 2.30% | 10 Sept 2024 | 3.25% | | ||
| 2398.34715733 | 2343.82 | 2.30% | 11 Sept 2024 | 3.25% | | ||
| 2407.76118821 | 2353.02 | 2.30% | 12 Sept 2024 | 3.25% | | ||
| 2508.33031981 | 2451.0698 | 2.31% | 13 Sept 2024 | 2.98% | | ||
| 2475.22917105 | 2417.43159987 | 2.36% | 14 Sept 2024 | 4.34% | | ||
| 2410.36874529 | 2352.9 | 2.41% | 15 Sept 2024 | 5.39% | | ||
| 2340.64764048 | 2284.841207 | 2.41% | 16 Sept 2024 | 5.39% | | ||
| 2397.61861733 | 2340.324747 | 2.42% | 17 Sept 2024 | 5.12% | | ||
| 2434.38452011 | 2376.212086 | 2.42% | 19 Sept 2024 | 5.12% | | ||
| 2525.60996564 | 2465.25759399 | 2.42% | 20 Sept 2024 | 4.57% | | ||
| 2632.95478247 | 2569.73765819 | 2.43% | 21 Sept 2024 | 4.79% | | ||
| 2683.58128176 | 2619.14861754 | 2.43% | 22 Sept 2024 | 4.79% | | ||
| 2672.9254068 | 2608.5055 | 2.44% | 23 Sept 2024 | 4.24% | | ||
| 2679.59402654 | 2615.0134 | 2.44% | 24 Sept 2024 | 4.24% | | ||
| 2722.18989788 | 2656.2002 | 2.45% | 25 Sept 2024 | 3.94% | | ||
| 2660.67857727 | 2596.18 | 2.45% | 26 Sept 2024 | 3.94% | | ||
| 2700.065218 | 2633.93159862 | 2.48% | 27 Sept 2024 | 4.60% | | ||
| 2762.0876431 | 2693.68876481 | 2.51% | 28 Sept 2024 | 5.07% | | ||
| 2738.08272451 | 2669.985335 | 2.52% | 29 Sept 2024 | 3.98% | | ||
| 2694.53847551 | 2627.5240517 | 2.52% | 30 Sept 2024 | 2.69% | | ||
| 2711.32019104 | 2643.71 | 2.53% | 01 Oct 2024 | 2.87% | | ||
| 2541.67303849 | 2478.29321332 | 2.53% | 02 Oct 2024 | 2.73% | | ||
| 2443.42474497 | 2382.494865 | 2.53% | 03 Oct 2024 | 2.73% | | ||
| 2445.11671254 | 2383.88 | 2.54% | 04 Oct 2024 | 3.01% | | ||
| 2488.45983553 | 2426.13761638 | 2.54% | 05 Oct 2024 | 2.71% | | ||
| 2480.72922553 | 2418.41 | 2.54% | 06 Oct 2024 | 2.91% | | ||
| 2546.62460533 | 2482.65 | 2.54% | 07 Oct 2024 | 2.68% | | ||
| 2489.96768267 | 2425.95873806 | 2.60% | 08 Oct 2024 | 4.22% | | ||
| 2497.08182602 | 2432.89 | 2.60% | 09 Oct 2024 | 3.85% | | ||
| 2446.02153248 | 2383.1423 | 2.60% | 10 Oct 2024 | 3.85% | | ||
| 2467.70684156 | 2403.98 | 2.62% | 11 Oct 2024 | 3.50% | | ||
| 2507.66595843 | 2442.9072 | 2.62% | 12 Oct 2024 | 2.78% | | ||
| 2534.09797073 | 2468.56 | 2.62% | 13 Oct 2024 | 2.60% | | ||
| 2600.48618088 | 2533.23124868 | 2.62% | 14 Oct 2024 | 2.60% | | ||
| 2669.08695225 | 2599.9904 | 2.62% | 15 Oct 2024 | 2.49% | | ||
| 2702.21927218 | 2632.265 | 2.62% | 16 Oct 2024 | 2.49% | | ||
| 2675.3812892 | 2604.637458 | 2.68% | 17 Oct 2024 | 3.95% | | ||
| 2691.05801893 | 2619.83 | 2.68% | 18 Oct 2024 | 3.74% | | ||
| 2708.0869564 | 2636.40820863 | 2.68% | 19 Oct 2024 | 3.74% | | ||
| 2719.59023969 | 2647.415078 | 2.69% | 20 Oct 2024 | 3.72% | | ||
| 2747.14185353 | 2674.2355 | 2.69% | 21 Oct 2024 | 3.72% | | ||
| 2707.33696217 | 2635.30237989 | 2.70% | 22 Oct 2024 | 2.36% | | ||
| 2615.47478136 | 2545.88439199 | 2.70% | 23 Oct 2024 | 2.36% | | ||
| 2597.97946409 | 2528.61982672 | 2.71% | 24 Oct 2024 | 2.60% | | ||
| 2602.41221147 | 2532.93 | 2.71% | 25 Oct 2024 | 2.29% | | ||
| 2525.23155298 | 2457.81 | 2.71% | 26 Oct 2024 | 2.29% | | ||
| 2564.28534585 | 2495.54 | 2.72% | 27 Oct 2024 | 2.48% | | ||
| 2567.16786757 | 2498.22484616 | 2.72% | 28 Oct 2024 | 2.61% | | ||
| 2733.49253159 | 2658.599911 | 2.78% | 29 Oct 2024 | 3.97% | | ||
|
||
|
||
* 14-day growth is calculated as an annualized percentage relative to the value of the rate 14 days prior. | ||
|
||
|
||
| Max Yearly % | Max Day-to-day yearly % | Max 14-day yearly % | | ||
| --- | --- | --- | | ||
| 9.83% | 21.56% | 5.39% | | ||
|
||
|
||
* Max day-to-day yearly % indicates the maximum growth between two emissions as an annualized percentage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.19; | ||
|
||
import {PriceCapAdapterBase, IPriceCapAdapter} from '../PriceCapAdapterBase.sol'; | ||
|
||
import {IRsETH} from '../../interfaces/IRsETH.sol'; | ||
|
||
/** | ||
* @title RsETHPriceCapAdapter | ||
* @author BGD Labs | ||
* @notice Price capped adapter to calculate price of (rsETH / USD) pair by using | ||
* @notice Chainlink data feed for (ETH / USD) and (rsETH / ETH) ratio. | ||
* @dev IMPORTANT: The `rsETHPrice()` function called in the `RATIO_PROVIDER` is a storage variable that updates the exchange rate for rsETH. | ||
* This variable is updated via the `updateRSETHPrice` function, which internally calculates using the formula: `staked assets value in ETH / rsETH.totalSupply()`. | ||
* To calculate the staked assets value in ETH, the `getTotalAssetDeposits()` function is called in the rsETH DepositPool contract(0x036676389e48133B63a802f8635AD39E752D375D). | ||
* It internally calls the `getAssetDistributionData(asset)` to obtain the balances via the `asset.balanceOf()` function, meaning that the exchange rate of rsETH can be | ||
* manipulated by inflating its price via the donation of these assets. But it's understood that, exclusively in this case, the donations cannot cause a 'completed' manipulation because | ||
* the token donated cannot be rescued after the donation and can be considered as an 'injection of rewards', which would benefit all rsETH shareholders. Also, | ||
* it is important to mention that the Aave Protocol does not allow the rsETH to be borrowed in its system (this restriction has been in place since the asset's listing, but it may/could change in the future if the governance decides otherwise.), which limits any benefit to the attacker from the 'possible' | ||
* manipulation of the exchange rate. Other systems using this oracle should consider and evaluate those risks described here. | ||
* More information can be found in the rsETH discussion in the forum: https://governance.aave.com/t/arfc-add-rseth-to-aave-v3-ethereum/17696/16 | ||
*/ | ||
contract RsETHPriceCapAdapter is PriceCapAdapterBase { | ||
/** | ||
* @param capAdapterParams parameters to create cap adapter | ||
*/ | ||
constructor( | ||
CapAdapterParams memory capAdapterParams | ||
) | ||
PriceCapAdapterBase( | ||
CapAdapterBaseParams({ | ||
aclManager: capAdapterParams.aclManager, | ||
baseAggregatorAddress: capAdapterParams.baseAggregatorAddress, | ||
ratioProviderAddress: capAdapterParams.ratioProviderAddress, | ||
pairDescription: capAdapterParams.pairDescription, | ||
ratioDecimals: 18, | ||
minimumSnapshotDelay: capAdapterParams.minimumSnapshotDelay, | ||
priceCapParams: capAdapterParams.priceCapParams | ||
}) | ||
) | ||
{} | ||
|
||
function getRatio() public view override returns (int256) { | ||
return int256(IRsETH(RATIO_PROVIDER).rsETHPrice()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
/// @notice A simple version of the Kelp DAO LRT Oracle allowing to get the rsETH exchange ratio with ETH | ||
interface IRsETH { | ||
/// @notice rsETH:ETH exchange rate | ||
function rsETHPrice() external view returns (uint256); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import '../BaseTest.sol'; | ||
|
||
import {RsETHPriceCapAdapter} from '../../src/contracts/lst-adapters/RsETHPriceCapAdapter.sol'; | ||
import {CapAdaptersCodeEthereum} from '../../scripts/DeployEthereum.s.sol'; | ||
|
||
contract RsETHPriceCapAdapterTest is BaseTest { | ||
constructor() | ||
BaseTest( | ||
CapAdaptersCodeEthereum.rsETHAdapterCode(), | ||
90, | ||
ForkParams({network: 'mainnet', blockNumber: 21072950}), | ||
'RsETH_EthereumLido' | ||
) | ||
{} | ||
|
||
function _createAdapter( | ||
IPriceCapAdapter.CapAdapterParams memory capAdapterParams | ||
) internal override returns (IPriceCapAdapter) { | ||
return new RsETHPriceCapAdapter(capAdapterParams); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters