> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-console/contracts/mappings/automatic-mappings.md).

# Automatic mappings

The mappings BaaS sets up on its own for ERC-20, ERC-721, and ERC-1155 contracts.

BaaS recognizes three token standards, ERC-20, ERC-721, and ERC-1155, and sets up their mappings when you register a contract. Contracts built on them count too. In our example, `MyToken` is an ERC-20, so it arrives with its `balance` mapping already in place. A contract that implements none of them starts with no mappings, ready for a [template of your own](/baas-console/contracts/mappings/custom-mappings.md).

## How detection works

BaaS looks at the functions and events your ABI declares, so a contract that extends a standard is recognized as that standard: an ERC-4626 vault as an ERC-20, an ERC-721A collection as an ERC-721. A contract that implements two of them keeps both sets.

A value is added only when the ABI declares its getter and every event that can change it. One event is often enough, as `Transfer` is for `balance`, while `paused` takes both `Paused` and `Unpaused`.

## ERC-20

Every ERC-20 gets `balance`: it reads `balanceOf` and refreshes on `Transfer`, for both the sender and the recipient. A mint or a burn has the zero address on one side, which belongs to no one, so only the real wallet is refreshed.

| Data key      | Reads                | Refreshed by              |
| ------------- | -------------------- | ------------------------- |
| `name`        | `name()`             | Read once at registration |
| `symbol`      | `symbol()`           | Read once at registration |
| `cap`         | `cap()`              | Read once at registration |
| `totalSupply` | `totalSupply()`      | `Transfer`                |
| `owner`       | `owner()`            | `OwnershipTransferred`    |
| `paused`      | `paused()`           | `Paused` and `Unpaused`   |
| `votes`       | `getVotes(address)`  | `DelegateVotesChanged`    |
| `delegates`   | `delegates(address)` | `DelegateChanged`         |

`votes` and `delegates` are kept per user, so they show on the [Users](/baas-console/users.md) page.

Three values are not mapped: decimals, allowances, and permit nonces. Decimals are handled by [units](/baas-console/contracts/units/automatic-units.md). Allowances and permit nonces have no event that covers every change, so they are not stored. To keep them anyway, declare a [template of your own](/baas-console/contracts/mappings/custom-mappings.md).

## ERC-721

Every ERC-721 gets `nftBalance`: it reads `balanceOf` and refreshes on `Transfer`, and on `ConsecutiveTransfer` when the ABI declares that batch-mint event.

| Data key            | Reads                                | Refreshed by              |
| ------------------- | ------------------------------------ | ------------------------- |
| `name`              | `name()`                             | Read once at registration |
| `symbol`            | `symbol()`                           | Read once at registration |
| `contractURI`       | `contractURI()`                      | `ContractURIUpdated`      |
| `totalSupply`       | `totalSupply()`                      | `Transfer`                |
| `owner`             | `owner()`                            | `OwnershipTransferred`    |
| `paused`            | `paused()`                           | `Paused` and `Unpaused`   |
| `operatorApprovals` | `isApprovedForAll(address, address)` | `ApprovalForAll`          |
| `votes`             | `getVotes(address)`                  | `DelegateVotesChanged`    |
| `delegates`         | `delegates(address)`                 | `DelegateChanged`         |

`operatorApprovals` keeps one value per owner and per operator.

Per-token getters such as `ownerOf` and `tokenURI` are not mapped.

## ERC-1155

Every ERC-1155 gets `balances`, one value per user and per token id. It reads `balanceOf(address, uint256)` and refreshes on `TransferSingle`. `TransferBatch` refreshes it too, once per id in the list.

| Data key            | Reads                                | Refreshed by                         |
| ------------------- | ------------------------------------ | ------------------------------------ |
| `contractURI`       | `contractURI()`                      | `ContractURIUpdated`                 |
| `totalSupply`       | `totalSupply()`                      | `TransferSingle` and `TransferBatch` |
| `supplies`          | `totalSupply(uint256)`               | `TransferSingle` and `TransferBatch` |
| `owner`             | `owner()`                            | `OwnershipTransferred`               |
| `paused`            | `paused()`                           | `Paused` and `Unpaused`              |
| `operatorApprovals` | `isApprovedForAll(address, address)` | `ApprovalForAll`                     |

Both totals come with the ERC1155Supply extension.

Name, symbol, and per-id URIs are not mapped: this standard defines none of them, and no event reports a change. Declare a [template of your own](/baas-console/contracts/mappings/custom-mappings.md) to keep them.

## Replace the automatic set

Automatic mappings appear in the [Mappings viewer](/baas-console/contracts/mappings.md#the-mappings-viewer) like any other. To change them, write a [template of your own](/baas-console/contracts/mappings/custom-mappings.md) when you register the version.

{% hint style="warning" %}
**Your own template replaces them all.** Carry over whatever you want to keep.
{% endhint %}

## Next

* [Custom mappings](/baas-console/contracts/mappings/custom-mappings.md): the set you declare yourself.
* [Automatic units](/baas-console/contracts/units/automatic-units.md): the decimals BaaS reads on its own.
* [Mappings](/baas-console/contracts/mappings.md): where these values live, and what keeps them current.
