Skip to content

Cleanup, fix tests, config update #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/prebuilts/drop/DropERC721C.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract DropERC721C is
uint256 private constant MAX_BPS = 10_000;

address public constant DEFAULT_FEE_RECIPIENT = 0x1Af20C6B23373350aD464700B5965CE4B0D2aD94;
uint16 private constant DEFAULT_FEE_BPS = 100;
uint16 private constant DEFAULT_FEE_BPS = 50;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Default protocol fee reduced to 50 bps — verify downstream assumptions and update docs/tests

This halves the protocol take-rate (1% → 0.5%). Please confirm no tests, deployment configs, UI copy, or partner integrations assume 100 bps.

Run this to find assumptions tied to 100 bps / 1% and the default fee in the repo:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find spots referencing the default protocol fee or old 1% value.
rg -n -S 'DEFAULT_FEE_BPS|100 bps|100bps|1% default|protocol fee|platformFeesTw' \
  -g '!node_modules' -g '!dist' -g '!build' -g '!out'

# Cross-check usage around claim price collection and recipient.
rg -n -S '_collectPriceOnClaim|DEFAULT_FEE_RECIPIENT' \
  -g '!node_modules' -g '!dist' -g '!build' -g '!out'

Length of output: 17309


Default protocol fee halved to 50 bps — update tests assuming 100 bps

Several marketplace tests hardcode a 1% (100 bps) default fee and must be revised to reflect the new 50 bps default:

• src/test/marketplace/Offers.t.sol:364
• src/test/marketplace/DirectListings.t.sol:590
• src/test/marketplace/EnglishAuctions.t.sol:425
• src/test/marketplace/english-auctions/_payout/_payout.t.sol:267
• src/test/marketplace/direct-listings/_payout/_payout.t.sol:292

Action items:

  • Adjust platformFeeBps values: for “100% total fees” use 10 000 – 50 = 9950 instead of 9900; for “99.99% total” use 9999 – 50 = 9949 instead of 9899.
  • Update accompanying comments to reference 50 bps default.
  • Audit any remaining docs, UI copy, deployment configs, or partner integrations for references to a 1% default fee.
🤖 Prompt for AI Agents
In contracts/prebuilts/drop/DropERC721C.sol at line 74, the default protocol fee
has been changed from 100 bps to 50 bps. You need to update all related
marketplace test files listed in the comment to reflect this change by adjusting
platformFeeBps values accordingly: use 9950 instead of 9900 for 100% total fees
and 9949 instead of 9899 for 99.99% total fees. Also, update any comments in
those tests to mention the new 50 bps default fee and audit other documentation,
UI text, deployment configs, or partner integrations for references to the old
1% fee and update them as needed.


/// @dev Constant value representing the ERC721 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC721 = 721;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ contract DropERC1155Test_collectPrice is BaseTest {
uint256 balanceSaleRecipientAfter = address(saleRecipient).balance;
uint256 defaultFeeRecipientAfter = address(defaultFeeRecipient).balance;
uint256 platformFeeRecipientAfter = address(platformFeeRecipient).balance;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_msgValue - expectedPlatformFee - expectedDefaultPlatformFee;

Expand All @@ -177,7 +177,7 @@ contract DropERC1155Test_collectPrice is BaseTest {
uint256 balanceSaleRecipientAfter = erc20.balanceOf(saleRecipient);
uint256 defaultFeeRecipientAfter = erc20.balanceOf(defaultFeeRecipient);
uint256 platformFeeRecipientAfter = erc20.balanceOf(platformFeeRecipient);
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_pricePerToken -
expectedPlatformFee -
Expand Down Expand Up @@ -211,7 +211,7 @@ contract DropERC1155Test_collectPrice is BaseTest {
uint256 defaultFeeRecipientAfter = address(defaultFeeRecipient).balance;
uint256 platformFeeRecipientAfter = address(platformFeeRecipient).balance;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_msgValue - expectedPlatformFee - expectedDefaultPlatformFee;

assertEq(balanceSaleRecipientAfter - balanceSaleRecipientBefore, expectedSaleRecipientProceed);
Expand All @@ -236,7 +236,7 @@ contract DropERC1155Test_collectPrice is BaseTest {
uint256 defaultFeeRecipientAfter = erc20.balanceOf(defaultFeeRecipient);
uint256 platformFeeRecipientAfter = erc20.balanceOf(platformFeeRecipient);
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_pricePerToken -
expectedPlatformFee -
expectedDefaultPlatformFee;
Expand Down Expand Up @@ -266,7 +266,7 @@ contract DropERC1155Test_collectPrice is BaseTest {
uint256 balanceSaleRecipientAfter = address(saleRecipient).balance;
uint256 balanceDefaultFeeRecipientAfter = address(defaultFeeRecipient).balance;
uint256 platformFeeRecipientAfter = address(platformFeeRecipient).balance;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_msgValue - expectedPlatformFee - expectedDefaultPlatformFee;

Expand All @@ -291,7 +291,7 @@ contract DropERC1155Test_collectPrice is BaseTest {
uint256 balanceSaleRecipientAfter = erc20.balanceOf(saleRecipient);
uint256 defaultFeeRecipientAfter = erc20.balanceOf(defaultFeeRecipient);
uint256 platformFeeRecipientAfter = erc20.balanceOf(platformFeeRecipient);
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 expectedDefaultPlatformFee = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_pricePerToken -
expectedPlatformFee -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ contract DropERC20Test_collectPrice is BaseTest {
uint256 afterBalancePlatformFeeRecipient = address(platformFeeRecipient).balance;
uint256 defaultFeeRecipientAfter = address(defaultFeeRecipient).balance;

uint256 defaultPlatformFeeVal = (pricePerToken * 100) / MAX_BPS;
uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
uint256 platformFeeVal = (msgValue * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = msgValue - platformFeeVal - defaultPlatformFeeVal;

Expand Down Expand Up @@ -157,7 +157,7 @@ contract DropERC20Test_collectPrice is BaseTest {
uint256 defaultFeeRecipientAfter = erc20.balanceOf(defaultFeeRecipient);
uint256 afterBalancePlatformFeeRecipient = erc20.balanceOf(platformFeeRecipient);

uint256 defaultPlatformFeeVal = (pricePerToken * 100) / MAX_BPS;
uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
uint256 platformFeeVal = (pricePerToken * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = 1 ether - platformFeeVal - defaultPlatformFeeVal;

Comment on lines +160 to 163
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use a named bps constant and avoid hardcoded 1 ether in proceeds calc

  • Drop magic number 50 bps.
  • Use pricePerToken (or total price) instead of 1 ether to avoid fragile coupling to current test data.
-        uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
+        uint256 defaultPlatformFeeVal = (pricePerToken * DEFAULT_FEE_BPS) / MAX_BPS;
         uint256 platformFeeVal = (pricePerToken * platformFeeBps) / MAX_BPS;
-        uint256 primarySaleRecipientVal = 1 ether - platformFeeVal - defaultPlatformFeeVal;
+        uint256 primarySaleRecipientVal = pricePerToken - platformFeeVal - defaultPlatformFeeVal;

If you prefer a single source of truth, compute once:

// outside changed lines
uint256 totalPrice = pricePerToken; // ERC20 branch
uint256 defaultPlatformFeeVal = (totalPrice * DEFAULT_FEE_BPS) / MAX_BPS;
uint256 platformFeeVal = (totalPrice * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = totalPrice - platformFeeVal - defaultPlatformFeeVal;
🤖 Prompt for AI Agents
In src/test/drop/drop-erc20/_collectPriceOnClaim/_collectPriceOnClaim.t.sol
around lines 160 to 163, replace the hardcoded 50 bps with a named constant like
DEFAULT_FEE_BPS and avoid using the hardcoded 1 ether in the proceeds
calculation. Instead, define a single totalPrice variable set to pricePerToken
and use it to calculate defaultPlatformFeeVal, platformFeeVal, and
primarySaleRecipientVal to ensure consistency and reduce fragile coupling to
test data.

Expand Down Expand Up @@ -187,7 +187,7 @@ contract DropERC20Test_collectPrice is BaseTest {
uint256 defaultFeeRecipientAfter = erc20.balanceOf(defaultFeeRecipient);
uint256 afterBalancePlatformFeeRecipient = erc20.balanceOf(platformFeeRecipient);

uint256 defaultPlatformFeeVal = (pricePerToken * 100) / MAX_BPS;
uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
uint256 platformFeeVal = (pricePerToken * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = 1 ether - platformFeeVal - defaultPlatformFeeVal;

Comment on lines +190 to 193
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same improvement: constant bps and remove 1 ether literal

Mirror the ERC20 proceeds calc fix to avoid hidden assumptions.

-        uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
+        uint256 defaultPlatformFeeVal = (pricePerToken * DEFAULT_FEE_BPS) / MAX_BPS;
         uint256 platformFeeVal = (pricePerToken * platformFeeBps) / MAX_BPS;
-        uint256 primarySaleRecipientVal = 1 ether - platformFeeVal - defaultPlatformFeeVal;
+        uint256 primarySaleRecipientVal = pricePerToken - platformFeeVal - defaultPlatformFeeVal;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
uint256 platformFeeVal = (pricePerToken * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = 1 ether - platformFeeVal - defaultPlatformFeeVal;
uint256 defaultPlatformFeeVal = (pricePerToken * DEFAULT_FEE_BPS) / MAX_BPS;
uint256 platformFeeVal = (pricePerToken * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = pricePerToken - platformFeeVal - defaultPlatformFeeVal;
🤖 Prompt for AI Agents
In src/test/drop/drop-erc20/_collectPriceOnClaim/_collectPriceOnClaim.t.sol
around lines 190 to 193, replace the literal 1 ether with a named constant
representing the total amount to avoid hidden assumptions. Also, define a
constant for MAX_BPS if not already defined, and use these constants
consistently in the calculation of defaultPlatformFeeVal, platformFeeVal, and
primarySaleRecipientVal to improve clarity and maintainability.

Expand Down Expand Up @@ -216,7 +216,7 @@ contract DropERC20Test_collectPrice is BaseTest {
uint256 afterBalancePlatformFeeRecipient = address(platformFeeRecipient).balance;
uint256 defaultFeeRecipientAfter = address(defaultFeeRecipient).balance;

uint256 defaultPlatformFeeVal = (pricePerToken * 100) / MAX_BPS;
uint256 defaultPlatformFeeVal = (pricePerToken * 50) / MAX_BPS;
uint256 platformFeeVal = (msgValue * platformFeeBps) / MAX_BPS;
uint256 primarySaleRecipientVal = msgValue - platformFeeVal - defaultPlatformFeeVal;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ contract DropERC721Test_collectPrice is BaseTest {
uint256 balanceSaleRecipientAfter = address(saleRecipient).balance;
uint256 platformFeeRecipientAfter = address(platformFeeRecipient).balance;
uint256 defaultFeeRecipientAfter = address(defaultFeeRecipient).balance;
uint256 defaultPlatformFeeVal = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 defaultPlatformFeeVal = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_msgValue - expectedPlatformFee - defaultPlatformFeeVal;

Expand All @@ -141,7 +141,7 @@ contract DropERC721Test_collectPrice is BaseTest {
uint256 balanceSaleRecipientAfter = erc20.balanceOf(saleRecipient);
uint256 platformFeeRecipientAfter = erc20.balanceOf(platformFeeRecipient);
uint256 defaultFeeRecipientAfter = erc20.balanceOf(defaultFeeRecipient);
uint256 defaultPlatformFeeVal = (collectPrice_pricePerToken * 100) / MAX_BPS;
uint256 defaultPlatformFeeVal = (collectPrice_pricePerToken * 50) / MAX_BPS;
uint256 expectedPlatformFee = (collectPrice_pricePerToken * platformFeeBps) / MAX_BPS;
uint256 expectedSaleRecipientProceed = collectPrice_pricePerToken - expectedPlatformFee - defaultPlatformFeeVal;

Expand Down
14 changes: 7 additions & 7 deletions src/test/marketplace/DirectListings.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {
// 3. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), customRoyaltyRecipients[0], customRoyaltyAmounts[0]);
Expand Down Expand Up @@ -483,7 +483,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {
// 3. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

uint256 royaltyAmount = (royaltyBps * totalPrice) / 10_000;
// Royalty recipient receives correct amounts
Expand Down Expand Up @@ -512,7 +512,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {
// 2. ========= Buy from listing =========

uint256 totalPrice = _buyFromListingForRoyaltyTests(listingId);
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// 3. ======== Check balances after royalty payments ========

Expand Down Expand Up @@ -557,7 +557,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {
// 3. ======== Check balances after fee payments (platform fee + royalty) ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), customRoyaltyRecipients[0], customRoyaltyAmounts[0]);
Expand Down Expand Up @@ -587,7 +587,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {

// Set platform fee on marketplace
address platformFeeRecipient = marketplaceDeployer;
uint128 platformFeeBps = 9900; // along with default fee of 100 bps => equal to max bps 10_000 or 100%
uint128 platformFeeBps = 9950; // along with default fee of 50 bps => equal to max bps 10_000 or 100%
vm.prank(marketplaceDeployer);
IPlatformFee(marketplace).setPlatformFeeInfo(platformFeeRecipient, platformFeeBps);

Expand Down Expand Up @@ -1519,7 +1519,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {
assertIsOwnerERC721(address(erc721), buyer, tokenIds);
assertIsNotOwnerERC721(address(erc721), seller, tokenIds);

uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Verify seller is paid total price.
assertBalERC20Eq(address(erc20), buyer, 0);
Expand Down Expand Up @@ -1575,7 +1575,7 @@ contract MarketplaceDirectListingsTest is BaseTest, IExtension {
assertIsOwnerERC721(address(erc721), buyer, tokenIds);
assertIsNotOwnerERC721(address(erc721), seller, tokenIds);

uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Verify seller is paid total price.
assertEq(buyer.balance, buyerBalBefore - totalPrice);
Expand Down
18 changes: 9 additions & 9 deletions src/test/marketplace/EnglishAuctions.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
// 4. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (buyoutAmount * 100) / 10_000;
uint256 defaultFee = (buyoutAmount * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), customRoyaltyRecipients[0], customRoyaltyAmounts[0]);
Expand Down Expand Up @@ -307,7 +307,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
// 4. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (buyoutAmount * 100) / 10_000;
uint256 defaultFee = (buyoutAmount * 50) / 10_000;

uint256 royaltyAmount = (royaltyBps * buyoutAmount) / 10_000;
// Royalty recipient receives correct amounts
Expand Down Expand Up @@ -345,7 +345,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
// 4. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (buyoutAmount * 100) / 10_000;
uint256 defaultFee = (buyoutAmount * 50) / 10_000;
uint256 royaltyAmount = (royaltyBps * buyoutAmount) / 10_000;
// Royalty recipient receives correct amounts
assertBalERC20Eq(address(erc20), royaltyRecipient, royaltyAmount);
Expand Down Expand Up @@ -392,7 +392,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
// 4. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (buyoutAmount * 100) / 10_000;
uint256 defaultFee = (buyoutAmount * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), customRoyaltyRecipients[0], customRoyaltyAmounts[0]);
Expand Down Expand Up @@ -422,7 +422,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {

// Set platform fee on marketplace
address platformFeeRecipient = marketplaceDeployer;
uint128 platformFeeBps = 9900; // equal to max bps 10_000 or 100% with 100 bps default
uint128 platformFeeBps = 9950; // equal to max bps 10_000 or 100% with 50 bps default
vm.prank(marketplaceDeployer);
IPlatformFee(marketplace).setPlatformFeeInfo(platformFeeRecipient, platformFeeBps);

Expand Down Expand Up @@ -1514,7 +1514,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
assertEq(currency, address(erc20));
assertEq(bidAmount, 10 ether);

uint256 defaultFee = (10 ether * 100) / 10_000;
uint256 defaultFee = (10 ether * 50) / 10_000;

// collect auction payout
vm.prank(seller);
Expand Down Expand Up @@ -1563,7 +1563,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
vm.prank(seller);
EnglishAuctionsLogic(marketplace).collectAuctionPayout(auctionId);

uint256 defaultFee = (5 ether * 100) / 10_000;
uint256 defaultFee = (5 ether * 50) / 10_000;

assertIsOwnerERC721(address(erc721), marketplace, tokenIds);
assertEq(erc20.balanceOf(marketplace), 0);
Expand Down Expand Up @@ -1951,7 +1951,7 @@ contract MarketplaceEnglishAuctionsTest is BaseTest, IExtension {
assertEq(currency, NATIVE_TOKEN);
assertEq(bidAmount, 10 ether);

uint256 defaultFee = (10 ether * 100) / 10_000;
uint256 defaultFee = (10 ether * 50) / 10_000;

vm.prank(seller);
// calls WETH.withdraw (which calls receive function of Marketplace) and sends native tokens to seller
Expand Down Expand Up @@ -2298,7 +2298,7 @@ contract BreitwieserTheCreator is BaseTest, IERC721Receiver, IExtension {
EnglishAuctionsLogic(marketplace).bidInAuction(auctionId, buyoutBidAmount);

// 2. Collect their own bid.
uint256 defaultFee = (buyoutBidAmount * 100) / 10_000;
uint256 defaultFee = (buyoutBidAmount * 50) / 10_000;
EnglishAuctionsLogic(marketplace).collectAuctionPayout(auctionId);
assertEq(erc20.balanceOf(seller), buyoutBidAmount - defaultFee);
assertEq(erc20.balanceOf(defaultFeeRecipient), defaultFee);
Expand Down
12 changes: 6 additions & 6 deletions src/test/marketplace/Offers.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ contract MarketplaceOffersTest is BaseTest, IExtension {
// 3. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), customRoyaltyRecipients[0], customRoyaltyAmounts[0]);
Expand Down Expand Up @@ -252,7 +252,7 @@ contract MarketplaceOffersTest is BaseTest, IExtension {
// 3. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;
uint256 royaltyAmount = (royaltyBps * totalPrice) / 10_000;
// Royalty recipient receives correct amounts
assertBalERC20Eq(address(erc20), royaltyRecipient, royaltyAmount);
Expand Down Expand Up @@ -285,7 +285,7 @@ contract MarketplaceOffersTest is BaseTest, IExtension {
// 3. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

uint256 royaltyAmount = (royaltyBps * totalPrice) / 10_000;
// Royalty recipient receives correct amounts
Expand Down Expand Up @@ -329,7 +329,7 @@ contract MarketplaceOffersTest is BaseTest, IExtension {
// 3. ======== Check balances after royalty payments ========

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), customRoyaltyRecipients[0], customRoyaltyAmounts[0]);
Expand Down Expand Up @@ -361,7 +361,7 @@ contract MarketplaceOffersTest is BaseTest, IExtension {

// Set platform fee on marketplace
address platformFeeRecipient = marketplaceDeployer;
uint128 platformFeeBps = 9900; // equal to max bps 10_000 or 100% with 100 bps default
uint128 platformFeeBps = 9950; // equal to max bps 10_000 or 100% with 50 bps default
vm.prank(marketplaceDeployer);
IPlatformFee(marketplace).setPlatformFeeInfo(platformFeeRecipient, platformFeeBps);

Expand Down Expand Up @@ -803,7 +803,7 @@ contract MarketplaceOffersTest is BaseTest, IExtension {
IOffers.Offer memory completedOffer = OffersLogic(marketplace).getOffer(offerId);
assertTrue(completedOffer.status == IOffers.Status.COMPLETED);

uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;
// check states after accepting offer
assertEq(erc721.ownerOf(tokenId), buyer);
assertEq(erc20.balanceOf(seller), totalPrice - defaultFee);
Expand Down
4 changes: 2 additions & 2 deletions src/test/marketplace/direct-listings/_payout/_payout.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ contract PayoutTest is BaseTest, IExtension {
uint256 platformFees = (totalPrice * platformFeeBps) / 10_000;

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;
// Platform fee recipient receives correct amount
assertBalERC20Eq(address(erc20), platformFeeRecipient, platformFees);

Expand Down Expand Up @@ -335,7 +335,7 @@ contract PayoutTest is BaseTest, IExtension {
uint256 platformFees = (totalPrice * platformFeeBps) / 10_000;

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;
// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), mockRecipients[0], mockAmounts[0]);
assertBalERC20Eq(address(erc20), mockRecipients[1], mockAmounts[1]);
Expand Down
4 changes: 2 additions & 2 deletions src/test/marketplace/english-auctions/_payout/_payout.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ contract EnglishAuctionsPayoutTest is BaseTest, IExtension {
uint256 platformFees = (totalPrice * platformFeeBps) / 10_000;

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Avoid magic numbers for default fee bps

Use a named constant instead of hardcoding 50 to reduce brittleness and ease future updates.

Apply within this test:

-            uint256 defaultFee = (totalPrice * 50) / 10_000;
+            uint256 defaultFee = (totalPrice * DEFAULT_FEE_BPS) / 10_000;

Add near the top of the contract:

uint256 private constant DEFAULT_FEE_BPS = 50;

Optional: scan for any leftover 100 bps references still tied to default fee:


🏁 Script executed:

#!/bin/bash
# Find potentially stale default-fee computations still using 100 bps in tests
rg -n --no-heading -e '\(\s*[^)]*\s*\*\s*100\s*\)\s*/\s*(MAX_BPS|10_000)' -e 'DEFAULT_FEE_BPS\s*=\s*100' src/test

Length of output: 115


Define and use DEFAULT_FEE_BPS instead of the raw 50

To eliminate the magic number and make future fee-bps updates easier, introduce a constant and reference it in your test:

• At the top of src/test/marketplace/english-auctions/_payout/_payout.t.sol, add:

uint256 private constant DEFAULT_FEE_BPS = 50;

• Replace both occurrences of the hardcoded 50 in fee calculations:

- uint256 defaultFee = (totalPrice * 50) / 10_000;
+ uint256 defaultFee = (totalPrice * DEFAULT_FEE_BPS) / 10_000;

I ran a grep across src/test for any other raw “100” or “50” fee-bps patterns and found no remaining stale references. Applying this change will keep the test DRY and resilient to future fee-bps adjustments.

🤖 Prompt for AI Agents
In src/test/marketplace/english-auctions/_payout/_payout.t.sol at line 243,
replace the hardcoded fee basis points value 50 with a constant named
DEFAULT_FEE_BPS. Define this constant as a private uint256 at the top of the
file with the value 50. Then update all fee calculations in the file to use
DEFAULT_FEE_BPS instead of the raw number 50 to avoid magic numbers and improve
maintainability.


// Platform fee recipient receives correct amount
assertBalERC20Eq(address(erc20), platformFeeRecipient, platformFees);
Expand Down Expand Up @@ -290,7 +290,7 @@ contract EnglishAuctionsPayoutTest is BaseTest, IExtension {
uint256 platformFees = (totalPrice * platformFeeBps) / 10_000;

{
uint256 defaultFee = (totalPrice * 100) / 10_000;
uint256 defaultFee = (totalPrice * 50) / 10_000;

// Royalty recipients receive correct amounts
assertBalERC20Eq(address(erc20), mockRecipients[0], mockAmounts[0]);
Expand Down
Loading