@@ -1900,6 +1900,125 @@ contract MarketplaceEnglishAuctionsTest is BaseTest {
1900
1900
vm.expectRevert ("Marketplace: invalid auction. " );
1901
1901
EnglishAuctionsLogic (marketplace).isAuctionExpired (auctionId + 1 );
1902
1902
}
1903
+
1904
+ /*///////////////////////////////////////////////////////////////
1905
+ Audit POC
1906
+ //////////////////////////////////////////////////////////////*/
1907
+
1908
+ function test_revert_collectAuctionPayout_buyoutBid_poc () public {
1909
+ /*///////////////////////////////////////////////////////////////
1910
+ Initial State
1911
+ //////////////////////////////////////////////////////////////*/
1912
+
1913
+ // consider that market place already has 200 ETH worth of tokens from all bids made
1914
+ erc20.mint (marketplace, 200 ether);
1915
+
1916
+ /*///////////////////////////////////////////////////////////////
1917
+ Create Auction
1918
+ //////////////////////////////////////////////////////////////*/
1919
+
1920
+ // Buyout bid : 10 ETH
1921
+ uint256 auctionId = _setup_newAuction ();
1922
+ IEnglishAuctions.Auction memory existingAuction = EnglishAuctionsLogic (marketplace).getAuction (auctionId);
1923
+
1924
+ uint256 [] memory tokenIds = new uint256 [](1 );
1925
+ tokenIds[0 ] = existingAuction.tokenId;
1926
+
1927
+ // Verify existing auction at `auctionId`
1928
+ assertEq (existingAuction.assetContract, address (erc721));
1929
+
1930
+ vm.warp (existingAuction.startTimestamp);
1931
+
1932
+ /*///////////////////////////////////////////////////////////////
1933
+ BID
1934
+ //////////////////////////////////////////////////////////////*/
1935
+
1936
+ // place bid : 200 ETH
1937
+ erc20.mint (buyer, 200 ether);
1938
+ vm.startPrank (buyer);
1939
+ erc20.approve (marketplace, 200 ether);
1940
+
1941
+ vm.expectRevert ("Marketplace: Bidding above buyout price. " );
1942
+ EnglishAuctionsLogic (marketplace).bidInAuction (auctionId, 200 ether);
1943
+ vm.stopPrank ();
1944
+ }
1945
+
1946
+ function _setup_nativeTokenAuction () private returns (uint256 auctionId ) {
1947
+ // Sample auction parameters.
1948
+ address assetContract = address (erc721);
1949
+ uint256 tokenId = 0 ;
1950
+ uint256 quantity = 1 ;
1951
+ address currency = NATIVE_TOKEN;
1952
+ uint256 minimumBidAmount = 1 ether ;
1953
+ uint256 buyoutBidAmount = 10 ether ;
1954
+ uint64 timeBufferInSeconds = 10 seconds ;
1955
+ uint64 bidBufferBps = 1000 ;
1956
+ uint64 startTimestamp = 100 ;
1957
+ uint64 endTimestamp = 200 ;
1958
+
1959
+ // Mint the ERC721 tokens to seller. These tokens will be auctioned.
1960
+ _setupERC721BalanceForSeller (seller, 1 );
1961
+
1962
+ uint256 [] memory tokenIds = new uint256 [](1 );
1963
+ tokenIds[0 ] = tokenId;
1964
+ assertIsOwnerERC721 (address (erc721), seller, tokenIds);
1965
+
1966
+ // Approve Marketplace to transfer token.
1967
+ vm.prank (seller);
1968
+ erc721.setApprovalForAll (marketplace, true );
1969
+
1970
+ // Auction tokens.
1971
+ IEnglishAuctions.AuctionParameters memory auctionParams = IEnglishAuctions.AuctionParameters (
1972
+ assetContract,
1973
+ tokenId,
1974
+ quantity,
1975
+ currency,
1976
+ minimumBidAmount,
1977
+ buyoutBidAmount,
1978
+ timeBufferInSeconds,
1979
+ bidBufferBps,
1980
+ startTimestamp,
1981
+ endTimestamp
1982
+ );
1983
+
1984
+ vm.prank (seller);
1985
+ auctionId = EnglishAuctionsLogic (marketplace).createAuction (auctionParams);
1986
+ }
1987
+
1988
+ function test_revert_collectAuctionPayout_buyoutBid_nativeTokens_poc () public {
1989
+ /*///////////////////////////////////////////////////////////////
1990
+ Initial State
1991
+ //////////////////////////////////////////////////////////////*/
1992
+
1993
+ // consider that market place already has 200 ETH worth of tokens from all bids made
1994
+ vm.deal (address (marketplace), 200 ether);
1995
+
1996
+ /*///////////////////////////////////////////////////////////////
1997
+ Create Auction
1998
+ //////////////////////////////////////////////////////////////*/
1999
+
2000
+ // Buyout bid : 10 ETH
2001
+ uint256 auctionId = _setup_nativeTokenAuction ();
2002
+ IEnglishAuctions.Auction memory existingAuction = EnglishAuctionsLogic (marketplace).getAuction (auctionId);
2003
+
2004
+ uint256 [] memory tokenIds = new uint256 [](1 );
2005
+ tokenIds[0 ] = existingAuction.tokenId;
2006
+
2007
+ // Verify existing auction at `auctionId`
2008
+ assertEq (existingAuction.assetContract, address (erc721));
2009
+
2010
+ vm.warp (existingAuction.startTimestamp);
2011
+
2012
+ /*///////////////////////////////////////////////////////////////
2013
+ BID
2014
+ //////////////////////////////////////////////////////////////*/
2015
+
2016
+ // place bid : 200 ETH
2017
+ vm.deal (buyer, 200 ether);
2018
+ vm.prank (buyer);
2019
+ vm.expectRevert ("Marketplace: Bidding above buyout price. " );
2020
+ EnglishAuctionsLogic (marketplace).bidInAuction (auctionId, 200 ether);
2021
+ }
1903
2022
}
1904
2023
1905
2024
contract BreitwieserTheCreator is BaseTest , IERC721Receiver {
0 commit comments