Assessment reports>d3-doma>Threat Model>Function: secondarySale(SecondarySaleVoucher calldata voucher, bytes calldata signature)

Function: secondarySale(SecondarySaleVoucher calldata voucher, bytes calldata signature)

This function fulfills secondary sale orders by transferring NFTs from sellers to buyer, distributing payments to sellers with fee deduction, and transferring fees to the treasury. It supports batch transfers of multiple NFTs in a single transaction.

Inputs

  • voucher.buyer

    • Control: Full.

    • Constraints: Must match msg.sender (checked via _verifyBuyerMatchesSender()).

    • Impact: Ensures only the designated buyer can execute the secondary sale, preventing unauthorized purchase execution.

  • voucher.amount

    • Control: Full.

    • Constraints: Must match msg.value and the sum of all name prices.

    • Impact: Ensures total payment matches the voucher specification and prevents underpayment or overpayment attacks.

  • voucher.voucherExpiration

    • Control: Full.

    • Constraints: Must be greater than the current block timestamp (checked via _verifyNotExpiredVoucher()).

    • Impact: Prevents execution of expired vouchers, ensuring time-sensitive sale conditions.

  • voucher.paymentId

    • Control: Full.

    • Constraints: Must be unique and not previously used (checked via usedPaymentIdHashes mapping).

    • Impact: Prevents replay attacks by ensuring each sale voucher can only be used once.

  • voucher.orderId

    • Control: Full.

    • Constraints: Included in the signature hash but no direct validation.

    • Impact: Links sale to specific order for off-chain tracking and verification.

  • voucher.names

    • Control: Full.

    • Constraints: Total names.price sum must match voucher.amount.

    • Impact: Array of NFT transfer information including registry, tokenId, owner, and price for each NFT.

  • signature.

    • Control: Full.

    • Constraints: ECDSA signature verification via _verifySignature() to ensure voucher was signed by an authorized signer.

    • Impact: Ensures voucher authenticity and prevents unauthorized voucher creation.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Zellic © 2025Back to top ↑