From 3a58107e63e0448aff80db719780a3134d512ad4 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Thu, 6 Jun 2024 16:28:55 +0200 Subject: [PATCH] test: add testRedeemDollar_FuzzGovernanceAmountSlippage --- .../facets/UbiquityPoolFacet.fuzz.t.sol | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.fuzz.t.sol b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.fuzz.t.sol index 920e8aaae..027a799b4 100644 --- a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.fuzz.t.sol +++ b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.fuzz.t.sol @@ -375,7 +375,26 @@ contract UbiquityPoolFacetFuzzTest is DiamondTestSetup { ); } + /** + * @notice Fuzz Dollar redeeming scenario for governance token slippage. + * @param governanceOut Minimal governance token amount to redeem. + */ function testRedeemDollar_FuzzGovernanceAmountSlippage( - uint256 maxGovernanceIn - ) public {} + uint256 governanceOut + ) public { + vm.assume(governanceOut >= 1e18); + vm.startPrank(admin); + curveDollarPlainPool.updateMockParams(0.99e18); + collateralToken.mint(address(ubiquityPoolFacet), 100e18); + dollarToken.mint(address(user), 1e18); + vm.stopPrank(); + vm.prank(user); + vm.expectRevert("Governance slippage"); + ubiquityPoolFacet.redeemDollar( + 0, // collateral index + 1e18, // Dollar amount + governanceOut, // min Governance out + 0 // min collateral out + ); + } }