Skip to content

Commit

Permalink
Rename closeAuction
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatmittal committed Jan 29, 2025
1 parent 3e337b1 commit e677ac6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions contracts/Folio.sol
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,10 @@ contract Folio is
require(auction.buy.balanceOf(address(this)) <= maxBuyBal, Folio__ExcessiveBid());
}

/// Kill a auction
/// Close a auction
/// A auction can be killed anywhere in its lifecycle, and cannot be restarted
/// @dev Callable by AUCTION_APPROVER or AUCTION_LAUNCHER or ADMIN
function killAuction(uint256 auctionId) external nonReentrant {
function closeAuction(uint256 auctionId) external nonReentrant {
require(
hasRole(AUCTION_APPROVER, msg.sender) ||
hasRole(AUCTION_LAUNCHER, msg.sender) ||
Expand All @@ -600,7 +600,7 @@ contract Folio is
// do not revert, to prevent griefing
auctions[auctionId].end = 1;

emit AuctionKilled(auctionId);
emit AuctionClosed(auctionId);
}

// ==== Internal ====
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IFolio.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface IFolio {
event AuctionApproved(uint256 indexed auctionId, address indexed from, address indexed to, Auction auction);
event AuctionOpened(uint256 indexed auctionId, Auction auction);
event AuctionBid(uint256 indexed auctionId, uint256 sellAmount, uint256 buyAmount);
event AuctionKilled(uint256 indexed auctionId);
event AuctionClosed(uint256 indexed auctionId);

event FolioFeePaid(address indexed recipient, uint256 amount);
event ProtocolFeePaid(address indexed recipient, uint256 amount);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"coverage": "forge coverage --report lcov --no-match-coverage '(script|test)'",
"coverage:summary": "forge coverage --report summary --no-match-coverage '(script|test)'",
"deploy": "forge script script/Deploy.s.sol:DeployScript --broadcast --slow --skip-simulation",
"anvil": "anvil --fork-url https://eth.public-rpc.com --chain-id 31337 --prune-history"
"anvil": "anvil --fork-url https://ethereum-rpc.publicnode.com --chain-id 31337 --prune-history"
},
"packageManager": "yarn@4.6.0"
}
32 changes: 16 additions & 16 deletions test/Folio.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ contract FolioTest is BaseTest {
assertEq(folio.getBid(0, end, amt), 1, "wrong end bid amount");
}

function test_auctionKillAuctionByAuctionApprover() public {
function test_auctioncloseAuctionByAuctionApprover() public {
IFolio.Auction memory auctionStruct = IFolio.Auction({
id: 0,
sell: USDC,
Expand All @@ -1239,20 +1239,20 @@ contract FolioTest is BaseTest {
emit IFolio.AuctionOpened(0, auctionStruct);
folio.openAuction(0, 0, MAX_RATE, 10e27, 1e27); // 10x -> 1x

// killAuction should not be callable by just anyone
// closeAuction should not be callable by just anyone
vm.expectRevert(IFolio.Folio__Unauthorized.selector);
folio.killAuction(0);
folio.closeAuction(0);

(, , , , , , , , , uint256 end, ) = folio.auctions(0);
vm.startPrank(dao);
vm.expectEmit(true, false, false, true);
emit IFolio.AuctionKilled(0);
folio.killAuction(0);
emit IFolio.AuctionClosed(0);
folio.closeAuction(0);

// next auction index should revert

vm.expectRevert();
folio.killAuction(1); // index out of bounds
folio.closeAuction(1); // index out of bounds

vm.expectRevert(IFolio.Folio__AuctionNotOngoing.selector);
folio.bid(0, amt, amt, false, bytes(""));
Expand All @@ -1267,7 +1267,7 @@ contract FolioTest is BaseTest {
vm.stopPrank();
}

function test_auctionKillAuctionByAuctionLauncher() public {
function test_auctioncloseAuctionByAuctionLauncher() public {
IFolio.Auction memory auctionStruct = IFolio.Auction({
id: 0,
sell: USDC,
Expand All @@ -1292,19 +1292,19 @@ contract FolioTest is BaseTest {
emit IFolio.AuctionOpened(0, auctionStruct);
folio.openAuction(0, 0, MAX_RATE, 10e27, 1e27); // 10x -> 1x

// killAuction should not be callable by just anyone
// closeAuction should not be callable by just anyone
vm.expectRevert(IFolio.Folio__Unauthorized.selector);
folio.killAuction(0);
folio.closeAuction(0);

vm.startPrank(auctionLauncher);
vm.expectEmit(true, false, false, true);
emit IFolio.AuctionKilled(0);
folio.killAuction(0);
emit IFolio.AuctionClosed(0);
folio.closeAuction(0);

// next auction index should revert

vm.expectRevert();
folio.killAuction(1); // index out of bounds
folio.closeAuction(1); // index out of bounds

(, , , , , , , , , uint256 end, ) = folio.auctions(0);
vm.expectRevert(IFolio.Folio__AuctionNotOngoing.selector);
Expand All @@ -1320,7 +1320,7 @@ contract FolioTest is BaseTest {
vm.stopPrank();
}

function test_auctionKillAuctionByOwner() public {
function test_auctioncloseAuctionByOwner() public {
IFolio.Auction memory auctionStruct = IFolio.Auction({
id: 0,
sell: USDC,
Expand All @@ -1347,13 +1347,13 @@ contract FolioTest is BaseTest {

vm.startPrank(owner);
vm.expectEmit(true, false, false, true);
emit IFolio.AuctionKilled(0);
folio.killAuction(0);
emit IFolio.AuctionClosed(0);
folio.closeAuction(0);

// next auction index should revert

vm.expectRevert();
folio.killAuction(1); // index out of bounds
folio.closeAuction(1); // index out of bounds

(, , , , , , , , , uint256 end, ) = folio.auctions(0);
vm.expectRevert(IFolio.Folio__AuctionNotOngoing.selector);
Expand Down

0 comments on commit e677ac6

Please sign in to comment.