From 42c31248458fdbf9598caab4d60478f46ab139cf Mon Sep 17 00:00:00 2001 From: Jeff Wu Date: Wed, 7 Aug 2024 14:56:03 -0700 Subject: [PATCH] fix: updating valuations for tests --- tests/Staking/BaseStakingTest.t.sol | 11 ++++++++++- tests/Staking/PendlePT.t.sol.j2 | 2 ++ tests/Staking/PendlePTTests.yml | 4 ++++ tests/generated/arbitrum/PendlePT_USDe_USDC.t.sol | 2 ++ tests/generated/arbitrum/PendlePT_rsETH_ETH.t.sol | 2 ++ tests/generated/arbitrum/PendlePT_weETH_ETH.t.sol | 2 ++ tests/generated/mainnet/PendlePT_USDe_USDC.t.sol | 2 ++ tests/generated/mainnet/PendlePT_rsETH_ETH.t.sol | 6 +++++- tests/generated/mainnet/PendlePT_weETH_ETH.t.sol | 2 ++ tests/generated/mainnet/Staking_Ethena_xUSDT.t.sol | 2 ++ tests/generated/mainnet/Staking_EtherFi_xETH.t.sol | 1 + 11 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tests/Staking/BaseStakingTest.t.sol b/tests/Staking/BaseStakingTest.t.sol index 3c75a8a9..a7803d9a 100644 --- a/tests/Staking/BaseStakingTest.t.sol +++ b/tests/Staking/BaseStakingTest.t.sol @@ -16,6 +16,8 @@ abstract contract BaseStakingTest is BaseAcceptanceTest { int256 deleverageCollateralDecreaseRatio; int256 defaultLiquidationDiscount; int256 withdrawLiquidationDiscount; + int256 borrowTokenPriceIncrease; + int256 splitWithdrawPriceDecrease; function deployTestVault() internal override returns (IStrategyVault) { (address impl, /* */) = harness.deployVaultImplementation(); @@ -645,9 +647,16 @@ abstract contract BaseStakingTest is BaseAcceptanceTest { // Reduce the token price further to force liquidation of the liquidator, this // price change is relative to the initial price change. _changeTokenPrice( - 500, + splitWithdrawPriceDecrease, BaseStakingHarness(address(harness)).withdrawToken(address(v())) ); + if (borrowTokenPriceIncrease != 0) { + // NOTE: there is an area where as we get closer to insolvency this reverts with min borrow + _changeTokenPrice( + borrowTokenPriceIncrease, + v().BORROW_TOKEN() + ); + } _liquidateAccount(liquidator, liquidator2); // The liquidator's entire withdraw request should be transferred to the liquidator2 diff --git a/tests/Staking/PendlePT.t.sol.j2 b/tests/Staking/PendlePT.t.sol.j2 index e894314e..85be41e0 100644 --- a/tests/Staking/PendlePT.t.sol.j2 +++ b/tests/Staking/PendlePT.t.sol.j2 @@ -33,6 +33,8 @@ contract Test_PendlePT_{{ stakeSymbol }}_{{ primaryBorrowCurrency }} is BasePend deleverageCollateralDecreaseRatio = {{ setUp.deleverageCollateralDecreaseRatio }}; defaultLiquidationDiscount = {{ setUp.defaultLiquidationDiscount }}; withdrawLiquidationDiscount = {{ setUp.withdrawLiquidationDiscount }}; + borrowTokenPriceIncrease = {{ setUp.borrowTokenPriceIncrease }}; + splitWithdrawPriceDecrease = {{ setUp.splitWithdrawPriceDecrease }}; super.setUp(); } diff --git a/tests/Staking/PendlePTTests.yml b/tests/Staking/PendlePTTests.yml index 13ffb9d1..8d589571 100644 --- a/tests/Staking/PendlePTTests.yml +++ b/tests/Staking/PendlePTTests.yml @@ -9,6 +9,8 @@ defaults: deleverageCollateralDecreaseRatio: 925 defaultLiquidationDiscount: 955 withdrawLiquidationDiscount: 945 + splitWithdrawPriceDecrease: 500 + borrowTokenPriceIncrease: 0 settings: maxPoolShare: 2000 @@ -115,6 +117,8 @@ mainnet: minDeposit: 0.1e18 maxDeposit: 10e18 deleverageCollateralDecreaseRatio: 920 + splitWithdrawPriceDecrease: 450 + borrowTokenPriceIncrease: 1500 - stakeSymbol: USDe forkBlock: 20092864 expiry: 24JUL2024 diff --git a/tests/generated/arbitrum/PendlePT_USDe_USDC.t.sol b/tests/generated/arbitrum/PendlePT_USDe_USDC.t.sol index 66096783..f0805d5e 100644 --- a/tests/generated/arbitrum/PendlePT_USDe_USDC.t.sol +++ b/tests/generated/arbitrum/PendlePT_USDe_USDC.t.sol @@ -29,6 +29,8 @@ contract Test_PendlePT_USDe_USDC is BasePendleTest { deleverageCollateralDecreaseRatio = 925; defaultLiquidationDiscount = 955; withdrawLiquidationDiscount = 945; + borrowTokenPriceIncrease = 0; + splitWithdrawPriceDecrease = 500; super.setUp(); } diff --git a/tests/generated/arbitrum/PendlePT_rsETH_ETH.t.sol b/tests/generated/arbitrum/PendlePT_rsETH_ETH.t.sol index f9bcb394..64dba017 100644 --- a/tests/generated/arbitrum/PendlePT_rsETH_ETH.t.sol +++ b/tests/generated/arbitrum/PendlePT_rsETH_ETH.t.sol @@ -28,6 +28,8 @@ contract Test_PendlePT_rsETH_ETH is BasePendleTest { deleverageCollateralDecreaseRatio = 925; defaultLiquidationDiscount = 955; withdrawLiquidationDiscount = 945; + borrowTokenPriceIncrease = 0; + splitWithdrawPriceDecrease = 500; super.setUp(); } diff --git a/tests/generated/arbitrum/PendlePT_weETH_ETH.t.sol b/tests/generated/arbitrum/PendlePT_weETH_ETH.t.sol index ad22d515..198946f1 100644 --- a/tests/generated/arbitrum/PendlePT_weETH_ETH.t.sol +++ b/tests/generated/arbitrum/PendlePT_weETH_ETH.t.sol @@ -28,6 +28,8 @@ contract Test_PendlePT_weETH_ETH is BasePendleTest { deleverageCollateralDecreaseRatio = 925; defaultLiquidationDiscount = 950; withdrawLiquidationDiscount = 945; + borrowTokenPriceIncrease = 0; + splitWithdrawPriceDecrease = 500; super.setUp(); } diff --git a/tests/generated/mainnet/PendlePT_USDe_USDC.t.sol b/tests/generated/mainnet/PendlePT_USDe_USDC.t.sol index 30c2f748..943ee179 100644 --- a/tests/generated/mainnet/PendlePT_USDe_USDC.t.sol +++ b/tests/generated/mainnet/PendlePT_USDe_USDC.t.sol @@ -29,6 +29,8 @@ contract Test_PendlePT_USDe_USDC is BasePendleTest { deleverageCollateralDecreaseRatio = 925; defaultLiquidationDiscount = 955; withdrawLiquidationDiscount = 945; + borrowTokenPriceIncrease = 0; + splitWithdrawPriceDecrease = 500; super.setUp(); } diff --git a/tests/generated/mainnet/PendlePT_rsETH_ETH.t.sol b/tests/generated/mainnet/PendlePT_rsETH_ETH.t.sol index 565428b3..0f0e7985 100644 --- a/tests/generated/mainnet/PendlePT_rsETH_ETH.t.sol +++ b/tests/generated/mainnet/PendlePT_rsETH_ETH.t.sol @@ -227,6 +227,10 @@ contract Harness_PendlePT_rsETH_ETH is PendleStakingHarness { token[1] = 0x0000000000000000000000000000000000000000; oracle[1] = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; + // TODO: required in order to support withdraw requests + // rsETH + // token[2] = 0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7; + // oracle[2] = 0x150aab1C3D63a1eD0560B95F23d7905CE6544cCB; } function getTradingPermissions() public pure override returns ( @@ -264,7 +268,7 @@ contract Harness_PendlePT_rsETH_ETH is PendleStakingHarness { bytes memory exchangeData = abi.encode(u); uint8 primaryDexId = uint8(DexId.UNISWAP_V3); - setMetadata(StakingMetadata(1, primaryDexId, exchangeData, true)); + setMetadata(StakingMetadata(1, primaryDexId, exchangeData, false)); } } \ No newline at end of file diff --git a/tests/generated/mainnet/PendlePT_weETH_ETH.t.sol b/tests/generated/mainnet/PendlePT_weETH_ETH.t.sol index d1ce9037..6aa04a74 100644 --- a/tests/generated/mainnet/PendlePT_weETH_ETH.t.sol +++ b/tests/generated/mainnet/PendlePT_weETH_ETH.t.sol @@ -28,6 +28,8 @@ contract Test_PendlePT_weETH_ETH is BasePendleTest { deleverageCollateralDecreaseRatio = 920; defaultLiquidationDiscount = 955; withdrawLiquidationDiscount = 945; + borrowTokenPriceIncrease = 1500; + splitWithdrawPriceDecrease = 450; super.setUp(); } diff --git a/tests/generated/mainnet/Staking_Ethena_xUSDT.t.sol b/tests/generated/mainnet/Staking_Ethena_xUSDT.t.sol index c48392cf..9e62f93c 100644 --- a/tests/generated/mainnet/Staking_Ethena_xUSDT.t.sol +++ b/tests/generated/mainnet/Staking_Ethena_xUSDT.t.sol @@ -66,6 +66,8 @@ contract Test_Staking_Ethena_xUSDT is BaseStakingTest { deleverageCollateralDecreaseRatio = 925; defaultLiquidationDiscount = 952; withdrawLiquidationDiscount = 952; + borrowTokenPriceIncrease = 1550; + splitWithdrawPriceDecrease = 500; super.setUp(); } diff --git a/tests/generated/mainnet/Staking_EtherFi_xETH.t.sol b/tests/generated/mainnet/Staking_EtherFi_xETH.t.sol index 4e99a56f..83cd43a5 100644 --- a/tests/generated/mainnet/Staking_EtherFi_xETH.t.sol +++ b/tests/generated/mainnet/Staking_EtherFi_xETH.t.sol @@ -19,6 +19,7 @@ contract Test_Staking_EtherFi_xETH is BaseStakingTest { deleverageCollateralDecreaseRatio = 925; defaultLiquidationDiscount = 955; withdrawLiquidationDiscount = 955; + splitWithdrawPriceDecrease = 500; super.setUp(); }