Skip to content

Commit

Permalink
add setting fee parameters validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelTroka committed Dec 4, 2023
1 parent 0384818 commit fa307a6
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions test/FeeCalculator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,100 @@ contract FeeCalculatorTest is Test {
vm.expectRevert("Total shares must equal 100");
feeCalculator.feeSetup(_recipients, _feeShares);
}

function testSetDepositFeeScaleReverts() public {
SD59x18 invalid = sd(1.1 * 1e18);
vm.expectRevert("Deposit fee scale must be between 0 and 1");
feeCalculator.setDepositFeeScale(invalid);
}

function testSetDepositFeeRatioScaleReverts() public {
SD59x18 invalid = sd(1.2 * 1e18);
vm.expectRevert("Deposit fee ratio scale must be between 0 and 1");
feeCalculator.setDepositFeeRatioScale(invalid);
}

function testSetSingleAssetDepositRelativeFeeReverts() public {
SD59x18 invalid = sd(1.3 * 1e18);
vm.expectRevert("Single asset deposit relative fee must be between 0 and 1");
feeCalculator.setSingleAssetDepositRelativeFee(invalid);
}

function testSetRedemptionFeeScaleReverts() public {
SD59x18 invalid = sd(1.4 * 1e18);
vm.expectRevert("Redemption fee scale must be between 0 and 1");
feeCalculator.setRedemptionFeeScale(invalid);
}

function testSetRedemptionFeeShiftReverts() public {
SD59x18 invalid = sd(1.5 * 1e18);
vm.expectRevert("Redemption fee shift must be between 0 and 1");
feeCalculator.setRedemptionFeeShift(invalid);
}

function testSetRedemptionFeeConstantReverts() public {
SD59x18 invalid = sd(1.6 * 1e18);
vm.expectRevert("Redemption fee constant must be between 0 and 1");
feeCalculator.setRedemptionFeeConstant(invalid);
}

function testSetSingleAssetRedemptionRelativeFeeReverts() public {
SD59x18 invalid = sd(1.7 * 1e18);
vm.expectRevert("Single asset redemption relative fee must be between 0 and 1");
feeCalculator.setSingleAssetRedemptionRelativeFee(invalid);
}

function testSetDustAssetRedemptionRelativeFeeReverts() public {
SD59x18 invalid = sd(1.8 * 1e18);
vm.expectRevert("Dust asset redemption relative fee must be between 0 and 1");
feeCalculator.setDustAssetRedemptionRelativeFee(invalid);
}

function testSetDepositFeeScaleNegativeReverts() public {
SD59x18 invalid = sd(-0.1 * 1e18);
vm.expectRevert("Deposit fee scale must be between 0 and 1");
feeCalculator.setDepositFeeScale(invalid);
}

function testSetDepositFeeRatioScaleNegativeReverts() public {
SD59x18 invalid = sd(-0.2 * 1e18);
vm.expectRevert("Deposit fee ratio scale must be between 0 and 1");
feeCalculator.setDepositFeeRatioScale(invalid);
}

function testSetSingleAssetDepositRelativeFeeNegativeReverts() public {
SD59x18 invalid = sd(-0.3 * 1e18);
vm.expectRevert("Single asset deposit relative fee must be between 0 and 1");
feeCalculator.setSingleAssetDepositRelativeFee(invalid);
}

function testSetRedemptionFeeScaleNegativeReverts() public {
SD59x18 invalid = sd(-0.4 * 1e18);
vm.expectRevert("Redemption fee scale must be between 0 and 1");
feeCalculator.setRedemptionFeeScale(invalid);
}

function testSetRedemptionFeeShiftNegativeReverts() public {
SD59x18 invalid = sd(-0.5 * 1e18);
vm.expectRevert("Redemption fee shift must be between 0 and 1");
feeCalculator.setRedemptionFeeShift(invalid);
}

function testSetRedemptionFeeConstantNegativeReverts() public {
SD59x18 invalid = sd(-0.6 * 1e18);
vm.expectRevert("Redemption fee constant must be between 0 and 1");
feeCalculator.setRedemptionFeeConstant(invalid);
}

function testSetSingleAssetRedemptionRelativeFeeNegativeReverts() public {
SD59x18 invalid = sd(-0.7 * 1e18);
vm.expectRevert("Single asset redemption relative fee must be between 0 and 1");
feeCalculator.setSingleAssetRedemptionRelativeFee(invalid);
}

function testSetDustAssetRedemptionRelativeFeeNegativeReverts() public {
SD59x18 invalid = sd(-0.8 * 1e18);
vm.expectRevert("Dust asset redemption relative fee must be between 0 and 1");
feeCalculator.setDustAssetRedemptionRelativeFee(invalid);
}
}

0 comments on commit fa307a6

Please sign in to comment.