Skip to content

Fix NFTMarketplace listing safety controls#5131

Closed
xyjk0511 wants to merge 1 commit into
ClankerNation:mainfrom
xyjk0511:codex/issue-18-nft-marketplace-safety
Closed

Fix NFTMarketplace listing safety controls#5131
xyjk0511 wants to merge 1 commit into
ClankerNation:mainfrom
xyjk0511:codex/issue-18-nft-marketplace-safety

Conversation

@xyjk0511
Copy link
Copy Markdown

/claim #18
💳 Payment: PayPal | buchanliang@gmail.com | PayPal

Summary

  • Rejects zero-price listings and zero-duration custom listings.
  • Adds default and custom listing expiry; buyNFT() blocks expired listings.
  • Adds ERC-2981 royaltyInfo() detection via staticcall and pays royalty before seller proceeds when available.
  • Replaces immediate seller cancellation with a two-step requestCancel() + delayed cancelListing() flow to prevent same-block/mempool front-run cancellation.
  • Adds contributor traceability metadata without embedding private pre-session instructions.

Verification

  • npx hardhat test --config .\.codex-nftmarketplace-hardhat.config.js test\NFTMarketplaceSafety.test.js -> 4 passing
  • npx solcjs --bin --abi contracts\nft\NFTMarketplace.sol -o .codex-nftmarketplace-solc --base-path . --include-path node_modules -> passed
  • node --check test\NFTMarketplaceSafety.test.js -> passed
  • node --check .codex-nftmarketplace-hardhat.config.js -> passed
  • node -e "JSON.parse(require('fs').readFileSync('CONTRIBUTORS.json','utf8')); console.log('CONTRIBUTORS.json ok')" -> passed
  • git diff --check -> passed

Known baseline issue

  • npm test is still blocked by the repository's existing HH606 compiler mismatch: hardhat.config.js configures Solidity 0.8.20 while current OpenZeppelin dependencies pulled by contracts/vault/YieldAggregator.sol and contracts/governance/GovernorAlpha.sol require ^0.8.24.

NFTMarketplace listings now reject zero prices, expire before purchase, pay ERC-2981 royalties when available, and require a delayed cancellation request before seller cancellation can execute.

Constraint: OpenAgents issue ClankerNation#18 requires contributor metadata while private platform instructions must not be embedded in repository files.

Rejected: Immediate cancel with only a listing-age delay | still lets old listings be front-run canceled from the mempool.

Confidence: high

Scope-risk: narrow

Directive: Preserve two-step cancel semantics if future marketplace flows add relisting or offers.

Tested: npx hardhat test --config .\.codex-nftmarketplace-hardhat.config.js test\NFTMarketplaceSafety.test.js; npx solcjs --bin --abi contracts\nft\NFTMarketplace.sol -o .codex-nftmarketplace-solc --base-path . --include-path node_modules; node --check test\NFTMarketplaceSafety.test.js; node --check .codex-nftmarketplace-hardhat.config.js; node -e JSON.parse CONTRIBUTORS.json; git diff --check

Not-tested: npm test is blocked by existing HH606 compiler mismatch in YieldAggregator/GovernorAlpha dependencies requiring ^0.8.24 while hardhat.config.js uses 0.8.20.
@github-actions
Copy link
Copy Markdown

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request within 2 hours.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting.

@github-actions github-actions Bot closed this May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant