Skip to content

Commit

Permalink
✨ fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
cmontecoding committed Oct 28, 2024
1 parent 3e7ca1a commit 8358721
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/KSXVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract KSXVault is ERC4626, Ownable, Initializable {
if (!isAuctionReady()) {
revert AuctionNotReady();
}

_updateLastAuctionStartTime();

Auction auction = auctionFactory.createAuction({
Expand Down
63 changes: 48 additions & 15 deletions test/KSXVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract KSXVaultAuctionTest is KSXVaultTest {

function test_isAuctionReady_next_week() public {
vm.warp(DEFAULT_START_TIME);
vm.warp(block.timestamp + DEFAULT_EPOCH_DURATION - 1);
vm.warp(block.timestamp + DEFAULT_EPOCH_DURATION - 1);
assertEq(ksxVault.isAuctionReady(), false);
vm.warp(block.timestamp + 1);
assertEq(ksxVault.isAuctionReady(), true);
Expand Down Expand Up @@ -172,8 +172,9 @@ contract KSXVaultAuctionTest is KSXVaultTest {
vm.prank(PDAOADDR);
ksxVault.setEpochDuration(MIN_EPOCH_DURATION);
/// @dev you have to wait until the end of the epoch duration
/// you just set (we were midway through the day because of (DEFAULT_EPOCH_DURATION / 2))
vm.warp(block.timestamp + .5 days - 1);
/// you just set (we were midway through the day because of
/// (DEFAULT_EPOCH_DURATION / 2))
vm.warp(block.timestamp + 0.5 days - 1);
assertEq(ksxVault.isAuctionReady(), false);
vm.warp(block.timestamp + 1);
assertEq(ksxVault.isAuctionReady(), true);
Expand All @@ -198,7 +199,7 @@ contract KSXVaultAuctionTest is KSXVaultTest {
vm.warp(DEFAULT_START_TIME + MAX_EPOCH_DURATION - 1);
assertEq(ksxVault.isAuctionReady(), false);
vm.warp(block.timestamp + DEFAULT_EPOCH_DURATION + 1);
assertEq(ksxVault.isAuctionReady(), true);
assertEq(ksxVault.isAuctionReady(), true);
}

/// @notice test isAuctionReady reverts until the startTime
Expand Down Expand Up @@ -313,7 +314,12 @@ contract KSXVaultAuctionTest is KSXVaultTest {
}

function test_setEpochDuration_onlyOwner() public {
vm.expectRevert(abi.encodeWithSelector(OwnableUnauthorizedAccount.selector, 0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496));
vm.expectRevert(
abi.encodeWithSelector(
OwnableUnauthorizedAccount.selector,
0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496
)
);
ksxVault.setEpochDuration(2 weeks);
}

Expand All @@ -326,7 +332,9 @@ contract KSXVaultAuctionTest is KSXVaultTest {
test_createAuction();
}

function testFuzzStartTime_createAuction_AuctionNotReady(uint128 startTime) public {
function testFuzzStartTime_createAuction_AuctionNotReady(uint128 startTime)
public
{
fuzzStartTime(startTime);
test_createAuction_AuctionNotReady();
}
Expand All @@ -336,27 +344,41 @@ contract KSXVaultAuctionTest is KSXVaultTest {
test_isAuctionReady();
}

function testFuzzStartTime_isAuctionReady_before_start(uint128 startTime) public {
function testFuzzStartTime_isAuctionReady_before_start(uint128 startTime)
public
{
fuzzStartTime(startTime);
test_isAuctionReady_before_start();
}

function testFuzzStartTime_isAuctionReady_before_start_fuzz(uint128 startTime) public {
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 {
function testFuzzStartTime_isAuctionReady_next_week(uint128 startTime)
public
{
fuzzStartTime(startTime);
test_isAuctionReady_next_week();
}

function testFuzzStartTime_isAuctionReady_set_one_day(uint128 startTime) public {
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 {
function testFuzzStartTime_isAuctionReady_set_one_day_then_4_weeks(
uint128 startTime
)
public
{
fuzzStartTime(startTime);
test_isAuctionReady_set_one_day_then_4_weeks();
}
Expand All @@ -366,22 +388,33 @@ contract KSXVaultAuctionTest is KSXVaultTest {
test_setEpochDuration();
}

function testFuzzStartTime_setEpochDuration_Invalid(uint128 startTime) public {
function testFuzzStartTime_setEpochDuration_Invalid(uint128 startTime)
public
{
fuzzStartTime(startTime);
test_setEpochDuration_Invalid();
}

function testFuzzStartTime_setEpochDuration_before_start(uint128 startTime) public {
function testFuzzStartTime_setEpochDuration_before_start(uint128 startTime)
public
{
fuzzStartTime(startTime);
test_setEpochDuration_before_start();
}

function testFuzzStartTime_setEpochDuration_fuzz(uint128 startTime, uint256 duration) public {
function testFuzzStartTime_setEpochDuration_fuzz(
uint128 startTime,
uint256 duration
)
public
{
fuzzStartTime(startTime);
test_setEpochDuration_fuzz(duration);
}

function testFuzzStartTime_setEpochDuration_onlyOwner(uint128 startTime) public {
function testFuzzStartTime_setEpochDuration_onlyOwner(uint128 startTime)
public
{
fuzzStartTime(startTime);
test_setEpochDuration_onlyOwner();
}
Expand Down

0 comments on commit 8358721

Please sign in to comment.