> For the complete documentation index, see [llms.txt](https://docs.fira.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fira.money/developers/token-contracts/fira-erc20.md).

# FiraERC20

{% hint style="info" %}
**Source:** `src/fira_bonding/erc20/FiraERC20.sol`, `FiraERC20Permit.sol`, `FiraERC20Upg.sol`, `FiraERC20PermitUpg.sol`
{% endhint %}

## Variants

| Contract             | Permit   | Upgradeable         | Used by             |
| -------------------- | -------- | ------------------- | ------------------- |
| `FiraERC20`          | No       | No                  | BT, FiraMarket (LP) |
| `FiraERC20Permit`    | EIP-2612 | No                  | —                   |
| `FiraERC20Upg`       | No       | Yes (Initializable) | —                   |
| `FiraERC20PermitUpg` | EIP-2612 | Yes (Initializable) | FW tokens           |

## Reentrancy guard

A `_reentrancyStatus` slot flips between `_NOT_ENTERED` (1) and `_ENTERED` (2). The `nonReentrant` modifier is available to all contracts that inherit `FiraERC20`. This means `FiraMarket` (which extends `FiraERC20` as its LP token) gets reentrancy protection without extra inheritance.

## Transfer hooks

* `_beforeTokenTransfer` — Virtual, overridden by CT (distributes interest) and FW (enforces pause)
* `_afterTokenTransfer` — Virtual, available for derived contracts

## Permit (EIP-2612)

`FiraERC20Permit` adds gasless approvals via `permit(owner, spender, value, deadline, v, r, s)`. Uses EIP-712 typed data for domain separation. The `DOMAIN_SEPARATOR` is computed at construction time and cached.

## Design decisions

* No `receive` or `fallback` — only contracts that need ETH (FWBase, Router) add `receive()`
* Storage layout matches between upgradeable and non-upgradeable variants


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.fira.money/developers/token-contracts/fira-erc20.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
