diff --git a/test/KSXVault.t.sol b/test/KSXVault.t.sol index 3eb7414..73dc905 100644 --- a/test/KSXVault.t.sol +++ b/test/KSXVault.t.sol @@ -317,4 +317,91 @@ contract KSXVaultAuctionTest is KSXVaultTest { ksxVault.setEpochDuration(2 weeks); } + /*////////////////////////////////////////////////////////////// + FUZZ START TIME + //////////////////////////////////////////////////////////////*/ + + function testFuzzStartTime_createAuction(uint128 startTime) public { + fuzzStartTime(startTime); + test_createAuction(); + } + + function testFuzzStartTime_createAuction_AuctionNotReady(uint128 startTime) public { + fuzzStartTime(startTime); + test_createAuction_AuctionNotReady(); + } + + function testFuzzStartTime_isAuctionReady(uint128 startTime) public { + fuzzStartTime(startTime); + test_isAuctionReady(); + } + + function testFuzzStartTime_isAuctionReady_before_start(uint128 startTime) public { + fuzzStartTime(startTime); + test_isAuctionReady_before_start(); + } + + function testFuzzStartTime_isAuctionReady_before_start_fuzz(uint128 startTime) public { + fuzzStartTime(startTime); + test_isAuctionReady_before_start_fuzz(startTime); + } + + function testFuzzStartTime_isAuctionReady_next_week(uint128 startTime) public { + fuzzStartTime(startTime); + test_isAuctionReady_next_week(); + } + + function testFuzzStartTime_isAuctionReady_set_one_day(uint128 startTime) public { + fuzzStartTime(startTime); + test_isAuctionReady_set_one_day(); + } + + function testFuzzStartTime_isAuctionReady_set_one_day_then_4_weeks(uint128 startTime) public { + fuzzStartTime(startTime); + test_isAuctionReady_set_one_day_then_4_weeks(); + } + + function testFuzzStartTime_setEpochDuration(uint128 startTime) public { + fuzzStartTime(startTime); + test_setEpochDuration(); + } + + function testFuzzStartTime_setEpochDuration_Invalid(uint128 startTime) public { + fuzzStartTime(startTime); + test_setEpochDuration_Invalid(); + } + + function testFuzzStartTime_setEpochDuration_before_start(uint128 startTime) public { + fuzzStartTime(startTime); + test_setEpochDuration_before_start(); + } + + function testFuzzStartTime_setEpochDuration_fuzz(uint128 startTime, uint256 duration) public { + fuzzStartTime(startTime); + test_setEpochDuration_fuzz(duration); + } + + function testFuzzStartTime_setEpochDuration_onlyOwner(uint128 startTime) public { + fuzzStartTime(startTime); + test_setEpochDuration_onlyOwner(); + } + + /*////////////////////////////////////////////////////////////// + HELPERS + //////////////////////////////////////////////////////////////*/ + + function fuzzStartTime(uint128 startTime) public { + DEFAULT_START_TIME = DEFAULT_START_TIME + startTime; + initializeLocal( + address(depositToken), + address(mockUSDC), + address(stakingRewards), + address(auctionFactory), + DECIMAL_OFFSET, + DEFAULT_START_TIME, + DEFAULT_EPOCH_DURATION, + DEFAULT_START_TIME + ); + } + } diff --git a/test/utils/Bootstrap.sol b/test/utils/Bootstrap.sol index c2a9a20..6695e0b 100644 --- a/test/utils/Bootstrap.sol +++ b/test/utils/Bootstrap.sol @@ -21,6 +21,11 @@ contract Bootstrap is Test, Constants { // decimal offset uint256 public decimalsOffset; + /// @dev DEFAULT_START_TIME has to be > MAX_EPOCH_DURATION + /// to avoid issues with the tests (underflow) + /// @dev this is not a constant so the tests can change it + uint256 internal DEFAULT_START_TIME = 6 weeks; + // deployed contracts KSXVault internal ksxVault; diff --git a/test/utils/Constants.sol b/test/utils/Constants.sol index 3bda0fc..6c837b1 100644 --- a/test/utils/Constants.sol +++ b/test/utils/Constants.sol @@ -12,10 +12,6 @@ contract Constants { uint256 internal constant TEST_VALUE = 100 ether; - /// @dev DEFAULT_START_TIME has to be > MAX_EPOCH_DURATION - /// to avoid issues with the tests (underflow) - uint256 internal constant DEFAULT_START_TIME = 6 weeks; - uint256 internal constant DEFAULT_EPOCH_DURATION = 1 weeks; uint256 internal constant MIN_EPOCH_DURATION = 1 days;