# ActionSimple

{% hint style="info" %}
**Source:** `src/fira_bonding/router/ActionSimple.sol`
{% endhint %}

## Overview

A parallel set of swap and liquidity functions that use `MarketApproxLibOnchain` instead of the off-chain binary search approximation. These are called internally by the main action facets when `guessOffchain == 0` and no limit orders are present.

## When it's used

The main facets (ActionSwapBTV3, ActionSwapCTV3, etc.) check `canUseOnchainApproximation()` in `ActionDelegateBase`. If true, they delegate to `ActionSimple` via `address(this).delegatecall(...)`, which runs ActionSimple's code in the router's storage context.

## Functions

* `swapExactFwForBtSimple` — FW → BT using on-chain closed-form approximation
* `swapExactTokenForBtSimple` — Token → FW → BT
* `swapExactTokenForCtSimple` / `swapExactCtForTokenSimple` — CT swaps
* `addLiquiditySingleBtSimple` / `addLiquiditySingleFwSimple` — Single-sided LP
* `addLiquiditySingleTokenSimple` / `addLiquiditySingleTokenKeepCtSimple` — Token-based LP

## Trade-offs

On-chain approximation provides a simpler code path with lower gas cost for straightforward operations, at the expense of slightly less precise swap amounts compared to the off-chain binary search method.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fira.money/developers/protocol-contracts/router/action-simple.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
