Skip to content

Incorrect tip amount scaling (only native currency) in partial fill scenario when using fulfillOrders #564

@naveen-imtb

Description

@naveen-imtb

Component

API

Have you ensured that all of these are up to date?

  • seaport-js
  • Node (minimum v16)

What version of seaport-js are you on?

4.0.1

What function is the bug in?

fulfillOrders

Operating System

macOS (Apple Silicon)

Describe the bug

Tip amounts in native currency are incorrectly scaled when performing a partial fill resulting in a much lower fee amount being charged than intended.

The most recent SDK version(4.0.1) includes a fix intended to address the issue where tip amounts were not at all scaled to the proportion of the order being filled in a partial fill scenario when using fulfillOrders. Unfortunately that fix has introduced a new bug where tip amounts are being incorrectly scaled (scaled to a much lower value than required) because the tip amounts sent to the Seaport contract are the scaled down values when they should infact reflect the original full order view.

Scenario:

  • Create an order to sell 10 ERC1155 tokens at 1 ETH per token so total order value if 10 ETH.
  • Include a 2% fee on the order which will be 0.2 ETH for the entire order or 0.02 ETH per token.
  • Execute a partial fill for 2 units of the order by invoking sdk.fulfillOrders()
Expected Actual
Cost of tokens 2 ETH (2 * 1 ETH) 2 ETH (2 * 1 ETH)
Fees 0.04 ETH (2 * 0.02 ETH) 0.008 ETH (2 * 0.004 ETH)
Total 2.04 ETH 2.008 ETH

Note: This issue affects only partial fill scenarios using native currency which are executed by calling fulfillOrders and only seen in v4.0.1 of the SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions