From 52c7912bc92a293f7fcea624d67e59238cca64ed Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Tue, 20 Aug 2024 16:35:33 -0600 Subject: [PATCH] test: fix before amount --- src/test/Auction.t.sol | 9 ++++++--- src/test/AuctionSwapper.t.sol | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/test/Auction.t.sol b/src/test/Auction.t.sol index dce5279..826426e 100644 --- a/src/test/Auction.t.sol +++ b/src/test/Auction.t.sol @@ -295,6 +295,7 @@ contract AuctionTest is Setup, ITaker { skip(auction.auctionLength() / 2); uint256 needed = auction.getAmountNeeded(id, _amount); + uint256 beforeAsset = ERC20(asset).balanceOf(address(this)); airdrop(ERC20(asset), address(this), needed); @@ -311,7 +312,7 @@ contract AuctionTest is Setup, ITaker { (, , , _available) = auction.auctionInfo(id); assertEq(_available, 0); - assertEq(ERC20(asset).balanceOf(address(this)), 0); + assertEq(ERC20(asset).balanceOf(address(this)), beforeAsset); assertEq(ERC20(from).balanceOf(address(this)), before + _amount); assertEq(ERC20(from).balanceOf(address(auction)), 0); assertEq(ERC20(asset).balanceOf(address(mockStrategy)), needed); @@ -351,6 +352,7 @@ contract AuctionTest is Setup, ITaker { uint256 toTake = (_amount * _percent) / MAX_BPS; uint256 left = _amount - toTake; uint256 needed = auction.getAmountNeeded(id, toTake); + uint256 beforeAsset = ERC20(asset).balanceOf(address(this)); airdrop(ERC20(asset), address(this), needed); @@ -366,7 +368,7 @@ contract AuctionTest is Setup, ITaker { (, , , _available) = auction.auctionInfo(id); assertEq(_available, left); - assertEq(ERC20(asset).balanceOf(address(this)), 0); + assertEq(ERC20(asset).balanceOf(address(this)), beforeAsset); assertEq(ERC20(from).balanceOf(address(this)), before + toTake); assertEq(ERC20(from).balanceOf(address(auction)), left); assertEq(ERC20(asset).balanceOf(address(mockStrategy)), needed); @@ -405,6 +407,7 @@ contract AuctionTest is Setup, ITaker { uint256 toTake = _amount / 2; uint256 left = _amount - toTake; uint256 needed = auction.getAmountNeeded(id, toTake); + uint256 beforeAsset = ERC20(asset).balanceOf(address(this)); airdrop(ERC20(asset), address(this), needed); @@ -424,7 +427,7 @@ contract AuctionTest is Setup, ITaker { (, , , _available) = auction.auctionInfo(id); assertEq(_available, left); - assertEq(ERC20(asset).balanceOf(address(this)), 0); + assertEq(ERC20(asset).balanceOf(address(this)), beforeAsset); assertEq(ERC20(from).balanceOf(address(this)), before + toTake); assertEq(ERC20(from).balanceOf(address(auction)), left); assertEq(ERC20(asset).balanceOf(address(mockStrategy)), needed); diff --git a/src/test/AuctionSwapper.t.sol b/src/test/AuctionSwapper.t.sol index d8fb5bd..cc6be41 100644 --- a/src/test/AuctionSwapper.t.sol +++ b/src/test/AuctionSwapper.t.sol @@ -309,6 +309,7 @@ contract AuctionSwapperTest is Setup { uint256 toTake = (_amount * _percent) / MAX_BPS; uint256 left = _amount - toTake; uint256 needed = auction.getAmountNeeded(id, toTake); + uint256 beforeAsset = ERC20(asset).balanceOf(address(this)); airdrop(ERC20(asset), address(this), needed); @@ -324,7 +325,7 @@ contract AuctionSwapperTest is Setup { (, , , _available) = auction.auctionInfo(id); assertEq(_available, left); - assertEq(ERC20(asset).balanceOf(address(this)), 0); + assertEq(ERC20(asset).balanceOf(address(this)), beforeAsset); assertEq(ERC20(from).balanceOf(address(this)), before + toTake); assertEq(ERC20(from).balanceOf(address(auction)), left); assertEq(ERC20(asset).balanceOf(address(swapper)), needed); @@ -470,6 +471,7 @@ contract AuctionSwapperTest is Setup { uint256 toTake = (kickable * _percent) / MAX_BPS; uint256 left = kickable - toTake; uint256 needed = auction.getAmountNeeded(id, toTake); + uint256 beforeAsset = ERC20(asset).balanceOf(address(this)); airdrop(ERC20(asset), address(this), needed); @@ -487,7 +489,7 @@ contract AuctionSwapperTest is Setup { (, , , _available) = auction.auctionInfo(id); assertEq(_available, left); - assertEq(ERC20(asset).balanceOf(address(this)), 0); + assertEq(ERC20(asset).balanceOf(address(this)), beforeAsset); assertEq(ERC20(from).balanceOf(address(this)), before + toTake); assertEq(ERC20(from).balanceOf(address(auction)), left); assertEq(ERC20(asset).balanceOf(address(swapper)), needed);