> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opengdp.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Stablecoin Gas

On OpenGDP, users pay transaction fees directly in currency denominated stablecoins (USD, EUR, etc.). Unlike traditional general-purpose blockchains, there is no volatile native gas token that needs to be acquired.

## Fee Token Resolution

When a transaction is submitted, the protocol determines which stablecoin to charge using a deterministic resolution chain:

| Priority | Source                                       | Example                                    |
| -------- | -------------------------------------------- | ------------------------------------------ |
| 1        | Explicit `feeToken` field on the transaction | AA tx sets `feeToken`: `0x20C0...USDC`     |
| 2        | Inline `setUserToken` call to Fee Manager    | User updates preference in the same tx     |
| 3        | Stored user preference (on-chain)            | Previously set via Fee Manager             |
| 4        | Inferred from OGDP-20 call target            | `transfer()` on a token contract           |
| 5        | Inferred from orderbook swap input token     | `swapExactAmountIn(tokenIn: USDC, ...)`    |
| 6        | Default: `pathUSD`                           | Fallback to the protocol's base stablecoin |

## Two-Phase Settlement

Fee collection uses a pre-charge / refund model to protect both users and validators:

* **Pre-charge**: The maximum possible fee (`gas_limit * gas_price`, converted to token terms via `1e12` scaling) is deducted from the fee payer's OGDP-20 balance.
* **Execution**: The transaction runs normally.
* **Settlement**: The actual gas consumed is calculated. The difference between the pre-charge and the actual cost is refunded to the fee payer.

### Constraints

* Only OGDP-20 tokens with a set currency metadata (USD, EUR, etc.) are valid for fee payment.
* The token must not be paused.
* The fee payer must be transfer-authorized under the token's policy.

## Use Case: Onboarding a New User

A new user receives USDC (as an OGDP-20 token) from a friend. They can immediately start transacting: sending payments, swapping tokens, or interacting with applications without ever needing to acquire a separate gas token. Their USDC balance covers everything.
