11// SPDX-License-Identifier: UNLICENSED
22pragma solidity ^ 0.8.30 ;
33
4- import {Test} from "forge-std/Test.sol " ;
5- import {Auction} from "../../src/Auction.sol " ;
64import {IAuction} from "../../src/interfaces/IAuction.sol " ;
75import {ICollectibleCasts} from "../../src/interfaces/ICollectibleCasts.sol " ;
86import {CollectibleCasts} from "../../src/CollectibleCasts.sol " ;
97import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol " ;
10- import {MockUSDC} from "../mocks/MockUSDC.sol " ;
11- import {AuctionTestHelper} from "./AuctionTestHelper.sol " ;
12- import {TestSuiteSetup} from "../TestSuiteSetup.sol " ;
8+ import {AuctionTestBase} from "./AuctionTestBase.sol " ;
9+ import {Auction} from "../../src/Auction.sol " ;
1310
14- contract AuctionTest is Test , AuctionTestHelper {
11+ contract AuctionTest is AuctionTestBase {
1512 event AuthorizerAllowed (address indexed authorizer );
1613 event AuthorizerDenied (address indexed authorizer );
1714 event TreasurySet (address indexed oldTreasury , address indexed newTreasury );
1815
19- Auction public auction;
20- CollectibleCasts public collectibleCast;
21-
22- // Use real Base USDC address from TestSuiteSetup
23- address public constant USDC = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 ;
24- address public treasury = makeAddr ("treasury " );
25- address public owner = makeAddr ("owner " );
26-
2716 bytes32 public constant DOMAIN_TYPEHASH =
2817 keccak256 ("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract) " );
2918
3019 bytes32 public constant BID_AUTHORIZATION_TYPEHASH = keccak256 (
3120 "BidAuthorization(bytes32 castHash,address bidder,uint96 bidderFid,uint256 amount,bytes32 nonce,uint256 deadline) "
3221 );
3322
34- function setUp () public {
35- // Deploy contracts
36- collectibleCast = new CollectibleCasts (address (this ), "https://example.com/ " );
37- auction = new Auction (address (collectibleCast), USDC, treasury, owner);
38-
39- collectibleCast.allowMinter (address (auction));
40- }
41-
4223 function test_Constructor_SetsConfiguration () public view {
4324 assertEq (address (auction.collectible ()), address (collectibleCast));
44- assertEq (address (auction.usdc ()), USDC );
25+ assertEq (address (auction.usdc ()), address (usdc) );
4526 assertEq (auction.treasury (), treasury);
4627
4728 (uint32 minBidAmount , uint32 minAuctionDuration , uint32 maxAuctionDuration , uint32 maxExtension ) =
@@ -58,7 +39,7 @@ contract AuctionTest is Test, AuctionTestHelper {
5839
5940 function test_Constructor_RevertsIfCollectibleCastsIsZero () public {
6041 vm.expectRevert (IAuction.InvalidAddress.selector );
61- new Auction (address (0 ), USDC , treasury, owner);
42+ new Auction (address (0 ), address (usdc) , treasury, owner);
6243 }
6344
6445 function test_Constructor_RevertsIfUSDCIsZero () public {
@@ -68,7 +49,7 @@ contract AuctionTest is Test, AuctionTestHelper {
6849
6950 function test_Constructor_RevertsIfTreasuryIsZero () public {
7051 vm.expectRevert (IAuction.InvalidAddress.selector );
71- new Auction (address (collectibleCast), USDC , address (0 ), owner);
52+ new Auction (address (collectibleCast), address (usdc) , address (0 ), owner);
7253 }
7354
7455 function testFuzz_AllowAuthorizer_OnlyOwner (address authorizer , address notOwner ) public {
@@ -183,20 +164,21 @@ contract AuctionTest is Test, AuctionTestHelper {
183164 assertEq (auction.treasury (), newTreasury);
184165 }
185166
186- function testFuzz_DenyAuthorizer_NotPreviouslyAllowed (address authorizer ) public {
187- vm.assume (authorizer != address (0 ));
167+ function testFuzz_DenyAuthorizer_NotPreviouslyAllowed (address authorizerToDeny ) public {
168+ vm.assume (authorizerToDeny != address (0 ));
169+ vm.assume (authorizerToDeny != authorizer); // Not the already-allowed authorizer from base setup
188170
189- assertFalse (auction.authorizers (authorizer ));
171+ assertFalse (auction.authorizers (authorizerToDeny ));
190172
191173 // Deny without allowing first
192174 vm.expectEmit (true , false , false , false );
193- emit AuthorizerDenied (authorizer );
175+ emit AuthorizerDenied (authorizerToDeny );
194176
195177 vm.prank (auction.owner ());
196- auction.denyAuthorizer (authorizer );
178+ auction.denyAuthorizer (authorizerToDeny );
197179
198180 // Still false
199- assertFalse (auction.authorizers (authorizer ));
181+ assertFalse (auction.authorizers (authorizerToDeny ));
200182 }
201183
202184 function testFuzz_SetAuctionConfig_OnlyOwner (address notOwner ) public {
0 commit comments