-
Notifications
You must be signed in to change notification settings - Fork 186
Incorrect tip amount scaling (only native currency) in partial fill scenario when using fulfillOrders #564
Description
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
10ERC1155 tokens at1ETH per token so total order value if10ETH. - Include a 2% fee on the order which will be
0.2ETH for the entire order or0.02ETH per token. - Execute a partial fill for
2units of the order by invokingsdk.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.