Skip to content
D20DAO

Arc VRF Fees: Native USDC, ERC-20 Units and Safe Quotes

Pay D20DAO VRF fees on Arc with the correct USDC units. Keep native 18-decimal quotes separate from ERC-20 displays and budget transaction gas.

Start with the payment interface

A developer sees USDC in a wallet and a USDC fee beside a randomness request. Both labels are correct, but copying an integer between payment interfaces can change its value by a factor of a trillion.

On Arc, a consumer contract pays D20DAO's randomness fee through a payable call using native USDC. This guide explains how to retain the correct amount from quote to payment, display it clearly and leave room for transaction gas. It is an integration guide, not a current fee quotation.

One balance, two unit conventions

Arc exposes USDC as both the native currency and an ERC-20 interface to the same balance. Native calls use 18 decimal places; the ERC-20 view uses six. There is no extra wrapped balance to add to your funds.

For one USDC, the native integer is 1,000,000,000,000,000,000, while the ERC-20 integer is 1,000,000. Converting a whole ERC-20 base unit to native units multiplies it by 1,000,000,000,000. Converting a native balance to the ERC-20 view truncates the lower twelve digits, so that view cannot preserve every possible native amount.

Keep the integer that the quote returned

Consider a hypothetical quote of 12,345,000,000,000,001 native units. It represents 0.012345000000000001 USDC. A six-decimal display shows 0.012345 USDC. Reconstructing the payment from that display produces 12,345,000,000,000,000 native units: one unit less than the original quote.

Keep the original integer for the transaction and format a separate value for the screen. Use integer-safe types for calculations and decimal strings for storage or transport. A rounded display is useful to a person, but it must never become the source of the payable amount. This example illustrates precision loss; it is not a measured D20DAO fee.

Quote against the request you will send

D20DAO's contract fee depends on live pricing parameters, the block base fee and the requested callback gas allowance, subject to a minimum fee. Read pricing() rather than treating a previously displayed amount as a permanent price.

A consumer contract can call quoteFee(callbackGasLimit) inside the transaction that opens its request. An off-chain application should use quoteFeeAt with the latest block's base fee and an appropriate buffer, or the SDK's quoteRequestFee helper. A plain off-chain quoteFee call can underestimate the charge because its execution context can report a zero base fee.

Retain the network, coordinator, callback gas limit and quote context together. Recheck the quote if those inputs change, and remember that an off-chain estimate does not reserve the future inclusion price.

Separate the service value from transaction gas

The USDC value sent to the consumer for its randomness request and the gas paid to execute that transaction are different costs. Both draw on Arc's native USDC balance. A wallet holding exactly the quoted service amount may still lack funds to submit the transaction.

Estimate the actual consumer call, including its payable value, and reserve gas headroom separately. Keep a maximum gas estimate distinct from the eventual receipt cost. Do not count the native balance and ERC-20 balance as two pools, or count a future refund credit as already available spending money. Application charges, if any, need their own clearly labeled line.

Keep the agent API price in its own context

The HTTP agent API is a separate payment path. Its published price is currently 0.05 USDC per call through x402 and Circle Gateway; payment amounts use six decimals. That is 50,000 base units for that payment interface.

Do not reuse 50,000 as the native value of a contract request: at 18 decimals it represents only 0.00000000000005 USDC. The API price does not set the coordinator's dynamic contract quote. An API response or payment option must be interpreted with its own network and unit conventions. D20DAO's agent API opens randomness requests on Arc.

Reconcile the receipt and any credit

If the contract request pays less than the required fee, D20DAO rejects it with IncorrectFee. Excess payment becomes credit assigned to the request's refund address, withdrawable with withdrawRefundCredit. Keep that recipient intentional and record the request ID with the transaction.

A credit is not an automatic transfer back to the wallet. Read the resulting state before showing a reconciled balance. Gas costs remain separate from service-fee credits and the protocol's expiry refund rules.

Test the conversion and payment boundaries

Include these checks in your integration test plan before connecting a production payment flow:

  1. One USDC converts to the expected native and ERC-20 integers without adding the balances together.
  2. Formatting the hypothetical quote to six decimals never changes the stored transaction value.
  3. A changed callback gas limit invalidates the displayed quote context.
  4. The wallet has headroom for transaction gas as well as the payable service value.
  5. Underpayment, excess credit and its fixed recipient are handled explicitly.
  6. An Arc Testnet check exercises the real coordinator and native USDC behavior; a generic EVM mock alone cannot establish Arc's balance semantics.