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

# Quote and settle

> The R6 order structure, detailed fee output, raw-unit bounds, and settlement checks.

The R6 quoter simulates native pool execution. The router executes the reviewed route and checks actual settlement against the order's bounds.

Use the R6 ABI with the [deployed mainnet router and quoter](/developers/contracts#core-contracts). The contract interfaces below are available on Arc mainnet independently of the website. Check [release status](/reference/release-status) for launch availability.

## Order structure

Both quoting and execution use the router's order shape:

```solidity theme={null}
struct Order {
    PoolKey[] path;
    address input;
    uint256 amount;
    bool exactInput;
    uint256 limit;
    uint256 deadline;
    address recipient;
}
```

| Field      | Interpretation                                                             |
| ---------- | -------------------------------------------------------------------------- |
| path       | Ordered pool keys, listed from input toward output in both amount modes    |
| input      | The first asset in the route                                               |
| amount     | Exact input amount when exactInput is true; exact output amount otherwise  |
| exactInput | Selects the meaning of amount and limit                                    |
| limit      | Minimum total output for exact input; maximum total input for exact output |
| deadline   | Latest permitted block timestamp, in seconds                               |
| recipient  | Destination for the settled output                                         |

The output asset is derived from the connected path. Each next pool must contain the preceding output asset.

The router accepts one to eight hops, a positive amount below the positive int128 limit, and a nonzero recipient. Asset amounts remain in raw units.

## Simulate the complete path

```solidity theme={null}
quote(Order order)
    returns (uint256 input, uint256 output)

quoteDetailed(Order order)
    returns (uint256 input, uint256 output, LegFee[] fees)
```

These signatures are abbreviated for reading; use the compiled ABI. The quoter methods are not Solidity view functions. Call them through eth\_call or a client simulation, rather than sending a state-changing transaction to obtain a price.

Internally, the quoter executes pool operations and uses a reverted result to roll back their mutations. Its wrapper decodes a successful quote into the return values.

For exact output, execution works backward through the pools to determine required inputs. Keep the supplied path in forward asset order.

The current wallet compares successful complete routes at one quoted block. A failed or partially filled route is excluded.

## Detailed leg fees

Each returned LegFee describes one path position:

| Fields                   | Units and meaning                                                   |
| ------------------------ | ------------------------------------------------------------------- |
| input, output            | Asset addresses for the leg                                         |
| token, quoteAsset        | FX token and its quote currency for a hooked token market           |
| grossQuote               | Gross quote-currency amount used for hook accounting                |
| normalFee                | Ordinary hook deduction, in raw quote units                         |
| surchargeBase, surcharge | Post-normal-fee base and opening deduction, in raw quote units      |
| surchargeBps             | Opening rate, with a 10,000 denominator                             |
| nativeLpPips             | Native LP rate, with a 1,000,000 denominator                        |
| nativeCorePips           | Directional native core protocol rate, with a 1,000,000 denominator |

An unhooked currency leg does not acquire FX token-market hook fees merely because it appears in the route. Its native pool costs still affect the returned input and output.

The normal hook amount is not a second description of the native LP fee. Preserve these categories when displaying costs. See [fee accounting](/economics/fees).

## Calculate settlement bounds exactly

The current wallet uses integer rounding in the protective direction:

```typescript theme={null}
// All amounts are raw units; bps is a bigint.
const minOut = quotedOut * (10_000n - bps) / 10_000n;
const maxIn = (quotedIn * (10_000n + bps) + 9_999n) / 10_000n;
```

The first expression floors the output limit. The second rounds the input cap up. Reject a zero protected output, and validate the tolerance against the signing application's policy.

Choose a fresh chain-time deadline. A quote succeeding does not imply the router will accept an expired deadline or an invalid recipient.

## Execute and confirm

The spending allowance belongs to the verified router. An exact-input order requires the fixed input; an exact-output order can require up to the reviewed input cap.

The router enforces a full fill at each leg, checks the final minimum or maximum, and requires intermediate route balances to settle without leftover dust. Violations revert the route.

After success, the Routed event records trader, input, output, amountIn, amountOut, recipient, and hop count. Use the receipt and actual settled amounts to report the result.

Keep uncertain submission, pending confirmation, reverted execution, and a delayed data refresh as distinct states. See [troubleshooting](/guides/troubleshooting) and [market snapshots](/developers/market-data).
