Skip to content

docs: Gas and fees example sends 1e-12 USDC instead of 1 USDC (native value uses 6 decimals) #453

Description

@bilalayvaz

Where

https://docs.arc.io/arc/references/gas-and-fees
Section: "Submitting transactions" → "Set an adequate max fee", first code block.

Problem

The example uses:

value: ethers.parseUnits("1", 6), // 1 USDC via native send

value in a native send is denominated in 18-decimal native USDC units.
parseUnits("1", 6) returns 1,000,000, which is 0.000000000001 USDC,
not 1 USDC as the comment says.

The transaction succeeds without any error, so anyone copying this
snippet will silently send a negligible amount.

Verified on Arc Mainnet

Chain ID 5042, block 22000964. Reading the same account at the same block:

eth_getBalance (native)   : 455068172605872
USDC.balanceOf (ERC-20)   : 455
USDC.decimals()           : 6
floor(native / 1e12)      : 455  (matches balanceOf)
eth_gasPrice              : 20.78 gwei

Native value uses 18 decimals and the ERC-20 interface uses 6 on
mainnet as well, so the example is wrong on mainnet, not only on testnet.

Suggested fix

Either use 18 decimals for the native send:

value: ethers.parseUnits("1", 18), // 1 USDC via native send

or switch the example to an ERC-20 transfer on
0x3600000000000000000000000000000000000000 with 6 decimals, which is
consistent with the docs' own recommendation to use the ERC-20
interface for application-level transfers.

Also

The note at the bottom of the page still says the parameters
"reflect the current Arc Testnet configuration" and "may change before
mainnet launch". Now that mainnet is live, it would help to state
whether the listed values (20 Gwei floor, 20,000 Gwei ceiling,
30M gas/block) apply to mainnet.

Related

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions