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

# Fiat rules (beta)

> Limit what a single transaction can move in US dollars: which chains and signatures are covered, how the value is priced, and what happens when a price is missing.

> [!WARNING]
>
> Fiat rules are a **beta** feature and are **not open to everyone**. They are off for every environment by default and cannot be turned on from the dashboard or the API. To use them, [contact us](https://www.dynamic.xyz/talk-to-us) and we enable them for your environment. Your environment also needs [declarative rules](https://www.dynamic.xyz/docs/embedded-wallets/mpc/policies/declarative-rules.md) enabled. Until both are on, saving a fiat rule is refused. The scope and behavior on this page can change before general availability.

A fiat rule refuses a transaction whose total value, in US dollars, is more than an amount you set. In the beta, the only fiat currency is the US dollar. Unlike a [per-transaction limit](https://www.dynamic.xyz/docs/embedded-wallets/mpc/policies/rule-examples.md#limit-per-transaction) in token units, one rule covers every asset the transaction moves, so you do not need one rule per token.

> [!WARNING]
>
> **A transaction that cannot be priced is rejected.** If a fiat rule applies to a transaction and any asset it sends cannot be priced in US dollars, the whole transaction is refused with `usd_value_unpriced`, even when the other assets are priced. A missing price is never counted as \$0 and the limit is never skipped. See [When the value cannot be calculated](#when-the-value-cannot-be-calculated).

## What the beta covers

| Area | Covered | Not covered |
| - | - | - |
| Limit type | One transaction at a time | Limits over time (daily, weekly, or any spend window) |
| Chains | EVM, Solana, and Bitcoin **mainnets** that transaction simulation prices | Testnets, and every other chain (TRON, Stellar, SUI, TON, Aleo, Midnight, Tempo, and others) |
| What is signed | Transactions: EVM transactions, EVM user operations, EVM gasless intents, Solana transactions, Bitcoin transactions | Messages and typed data (see [Signatures a fiat rule does not check](#signatures-a-dollar-limit-does-not-check)) |
| Rule form | `totalUsdValue` with `gt`, and `then: "DENY"` | Other comparisons (`gte`, `lt`, `lte`) and other outcomes (`ALLOW`, `REQUIRE_APPROVAL`) |
| Editing | API and SDK | The dashboard has no fiat rule editor yet |

## Write a fiat rule

Deny any transaction on Ethereum mainnet worth more than $100. The comparison is `gt`, so a transaction worth exactly $100 still goes through.

```json theme={"system"}
{
  "ruleId": "00000000-0000-4000-8000-000000000101",
  "name": "Cap at $100",
  "phase": "transaction",
  "then": "DENY",
  "when": {
    "all": [
      { "field": "operation.chain", "op": "eq", "value": "EVM" },
      { "field": "chain.id", "op": "in", "value": [1] },
      { "field": "totalUsdValue", "op": "gt", "value": 100 }
    ]
  }
}
```

The same rule for Solana uses `"SVM"` and chain id `101`. For Bitcoin it uses `"BTC"` and chain id `1`.

Rules for the value:

* `value` is plain US dollars as a JSON number, such as `100` or `12.5`. It is not a string and not in cents.
* At most 2 decimal places, and never negative.
* `totalUsdValue` is read at the top of the rule's condition. Do not put it inside `outgoingAssets` or `spendWindows`.

Rules for the scope. A fiat rule is refused when it is saved unless it names both:

* its chain family, with `operation.chain` and `eq`, and
* its chain ids, with `chain.id` and `in` or `eq`, all of them mainnets that can be priced.

Both have to bind the whole rule. A family or chain id that appears only inside one branch of an `any`, or under `not`, does not count.

## How the value is calculated

When the transaction is signed, it is simulated, and every asset it sends out of the wallet is priced in US dollars by the simulation provider. The total is the sum of those prices, added exactly and then rounded **up** to the next cent, so a transaction just over your limit cannot round down below it.

* Every outgoing asset counts: the chain's coin and every token.
* Network fees are neither added nor removed. The total is what the simulation reports as leaving the wallet, the same amount the per-token limits read.
* The price is taken at signing time, not when the rule was saved.

## When the value cannot be calculated

A fiat rule never treats a missing price as zero. If a rule applies to a transaction and the value cannot be worked out, the transaction is rejected. One asset without a price is enough: the value of the whole transaction is then unknown, so it is rejected even if every other asset it sends is priced.

| Situation | Result |
| - | - |
| The transaction sends an asset with no price: an NFT, or a token the provider does not price | Refused with `usd_value_unpriced` |
| A price comes back malformed, or the simulation returns no outgoing assets | Refused with `usd_value_unpriced` |
| The simulation itself fails (an error or a timeout) | Refused. The signature is not produced |
| The rule does not apply to the transaction (another chain, or another network) | Not affected. The rule is skipped |

A refused transaction is never signed, so nothing reaches the chain. Retrying an unpriced transaction gives the same result until the asset is priced, so remove the asset from the transaction or change the rule.

## Signatures a fiat rule does not check

A fiat rule only runs on operations that can be simulated. These are not simulated, so a fiat rule does not check them and they are signed as usual if no other rule refuses them:

* EIP-712 typed data, except EVM gasless intents. This includes permits and off-chain orders, even when they authorize moving value.
* Plain text and EVM personal messages.
* Messages on Stellar, Aleo, Midnight, and TRON, and every Tempo and TON signature.

## Error codes

When a rule is saved:

| Code | Status | Meaning |
| - | - | - |
| `rule_syntax_disabled` | 403 | Declarative rules are not enabled for the environment |
| `usd_limits_disabled` | 403 | Fiat rules are not enabled for the environment |
| `usd_limit_in_spend_window` | 400 | The rule reads `totalUsdValue` inside `spendWindows`. Limits over time are not supported |
| `usd_limit_chain_unscoped` | 400 | The rule does not name its chain family and chain ids in a way that binds the whole rule |
| `usd_limit_chain_unsupported` | 400 | The rule names a chain id that cannot be priced: a testnet, or a chain outside EVM, Solana, and Bitcoin |

When a transaction is signed, the refusal's `reasonCode` (also sent in [policy violation webhooks](https://www.dynamic.xyz/docs/embedded-wallets/mpc/policies/violation-webhooks.md)) is one of:

| Code | Meaning |
| - | - |
| `value_limit_exceeded` | The transaction is worth more than the limit |
| `usd_value_unpriced` | The rule applies, but the transaction's value could not be calculated |
| `usd_limits_disabled` | The rule applies, but fiat rules are no longer enabled for the environment |

If fiat rules are turned off for an environment that already has fiat rules saved, every transaction those rules apply to is refused with `usd_limits_disabled` until the rules are removed. A fiat rule is never silently skipped.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.