Skip to content

Commit

Permalink
fix: updating valuations for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffywu committed Aug 12, 2024
1 parent 354b197 commit 42c3124
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 2 deletions.
11 changes: 10 additions & 1 deletion tests/Staking/BaseStakingTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/Staking/PendlePT.t.sol.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Staking/PendlePTTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ defaults:
deleverageCollateralDecreaseRatio: 925
defaultLiquidationDiscount: 955
withdrawLiquidationDiscount: 945
splitWithdrawPriceDecrease: 500
borrowTokenPriceIncrease: 0

settings:
maxPoolShare: 2000
Expand Down Expand Up @@ -115,6 +117,8 @@ mainnet:
minDeposit: 0.1e18
maxDeposit: 10e18
deleverageCollateralDecreaseRatio: 920
splitWithdrawPriceDecrease: 450
borrowTokenPriceIncrease: 1500
- stakeSymbol: USDe
forkBlock: 20092864
expiry: 24JUL2024
Expand Down
2 changes: 2 additions & 0 deletions tests/generated/arbitrum/PendlePT_USDe_USDC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ contract Test_PendlePT_USDe_USDC is BasePendleTest {
deleverageCollateralDecreaseRatio = 925;
defaultLiquidationDiscount = 955;
withdrawLiquidationDiscount = 945;
borrowTokenPriceIncrease = 0;
splitWithdrawPriceDecrease = 500;

super.setUp();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/generated/arbitrum/PendlePT_rsETH_ETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract Test_PendlePT_rsETH_ETH is BasePendleTest {
deleverageCollateralDecreaseRatio = 925;
defaultLiquidationDiscount = 955;
withdrawLiquidationDiscount = 945;
borrowTokenPriceIncrease = 0;
splitWithdrawPriceDecrease = 500;

super.setUp();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/generated/arbitrum/PendlePT_weETH_ETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract Test_PendlePT_weETH_ETH is BasePendleTest {
deleverageCollateralDecreaseRatio = 925;
defaultLiquidationDiscount = 950;
withdrawLiquidationDiscount = 945;
borrowTokenPriceIncrease = 0;
splitWithdrawPriceDecrease = 500;

super.setUp();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/generated/mainnet/PendlePT_USDe_USDC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ contract Test_PendlePT_USDe_USDC is BasePendleTest {
deleverageCollateralDecreaseRatio = 925;
defaultLiquidationDiscount = 955;
withdrawLiquidationDiscount = 945;
borrowTokenPriceIncrease = 0;
splitWithdrawPriceDecrease = 500;

super.setUp();
}
Expand Down
6 changes: 5 additions & 1 deletion tests/generated/mainnet/PendlePT_rsETH_ETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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));
}

}
2 changes: 2 additions & 0 deletions tests/generated/mainnet/PendlePT_weETH_ETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract Test_PendlePT_weETH_ETH is BasePendleTest {
deleverageCollateralDecreaseRatio = 920;
defaultLiquidationDiscount = 955;
withdrawLiquidationDiscount = 945;
borrowTokenPriceIncrease = 1500;
splitWithdrawPriceDecrease = 450;

super.setUp();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/generated/mainnet/Staking_Ethena_xUSDT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ contract Test_Staking_Ethena_xUSDT is BaseStakingTest {
deleverageCollateralDecreaseRatio = 925;
defaultLiquidationDiscount = 952;
withdrawLiquidationDiscount = 952;
borrowTokenPriceIncrease = 1550;
splitWithdrawPriceDecrease = 500;

super.setUp();
}
Expand Down
1 change: 1 addition & 0 deletions tests/generated/mainnet/Staking_EtherFi_xETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ contract Test_Staking_EtherFi_xETH is BaseStakingTest {
deleverageCollateralDecreaseRatio = 925;
defaultLiquidationDiscount = 955;
withdrawLiquidationDiscount = 955;
splitWithdrawPriceDecrease = 500;

super.setUp();
}
Expand Down

0 comments on commit 42c3124

Please sign in to comment.