Skip to content

Marketplace: Can't Buy NFT Listed For Free #594

Open
@Yash094

Description

@Yash094

Marketplace: Can't Buy NFT Listed For Free

Issue:
Attempting to buy an NFT listed for free on a marketplace contract results in an error, specifically: Reason: Invalid royalty amount.

Reproduction Steps:

  1. Deploy a marketplace-v3 contract with a platform fee set to 0%.
  2. Deploy an NFT collection with a royalty fee set to 0%.
  3. List(Direct Listing) an NFT from the collection on the marketplace for free.
  4. Attempt to buy the listing from the marketplace

Error Details:
The error message received is Reason: Invalid royalty amount, even when the royalty amount is explicitly set to 0.

Root Cause:
The cause of this issue is a require statement in the contract that checks if the royalty amount is less than the value. However, when the royalty is set to 0, the condition fails because it expects the value to be greater than the amount, not equal.

require(amount < value, "Invalid royalty amount");

Expected Behavior:
The contract should allow buying an NFT listed for free, when the royalty amount for the NFT is set to 0%

Suggested Solutions:
Modifying the require statement to handle cases where the royalty amount is 0.

require(amount <= value, "Invalid royalty amount");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions