Skip to content

Arc and Stable Chain offers are scaled with 18 decimals #2012

Description

@Osraka

Summary

In @opensea/sdk 12.9.0, Arc and Stable Chain default offer currencies are documented and configured as 6-decimal ERC-20 mirrors, but both SDK constructors seed their decimal cache with 18 for every default offer token.

That cache is consulted before token metadata, so an offer amount such as 1.5 is converted to 1500000000000000000 instead of 1500000. This affects both the ethers and viem entrypoints.

Minimal reproduction

const sdk = new OpenSeaSDK(provider, { chain: Chain.StableChain })

await (sdk as any)._getPriceParameters(
  OrderSide.OFFER,
  "0x779ded0c9e1022225f8e0630b35a9b54be713736",
  "1.5",
)
// current:  { basePrice: 1500000000000000000n }
// expected: { basePrice: 1500000n }

The same result occurs on Arc with 0x3600000000000000000000000000000000000000.

Root cause

src/sdk.ts and src/viem.ts initialize the default offer-token cache to 18 decimals unconditionally. The v12.9 chain helpers correctly select the 6-decimal mirrors, but the cached value prevents getPaymentToken from resolving their actual decimals.

Scope

A narrow fix is to use 6 decimals only for the Arc and Stable Chain default offer mirrors while preserving:

  • 18 decimals for existing wrapped-native defaults
  • 18-decimal native listing behavior
  • metadata lookup for non-default ERC-20 payment tokens
  • identical behavior across ethers and viem

I reproduced this offline on current main and have regression coverage for both chains and both entrypoints. I can open the focused patch if this is not already fixed in the private monorepo.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions