Skip to content
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

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

Open
Yash094 opened this issue Jan 8, 2024 · 2 comments
Open

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

Yash094 opened this issue Jan 8, 2024 · 2 comments

Comments

@Yash094
Copy link

Yash094 commented Jan 8, 2024

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");
@Yash094
Copy link
Author

Yash094 commented Jan 8, 2024

cc: @warengonzaga

@Yash094 Yash094 changed the title Marketplace Can't List For Free Marketplace: Can't Buy NFT Listed For Free Jan 8, 2024
@kien-ngo
Copy link

kien-ngo commented Jan 9, 2024

Thanks @Yash094 this is very useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants