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

# ERC20 Credit Debit

The ERC20 credit debit model combines ERC20 token transfers, allowing you to easily track the inflows and outflows of every ERC20 token belonging to all addresses.

**Credit Debit vs Transfers**

This table will include two rows for every event, with one row representing credit and one row representing debit.
**Example** Using an ERC20 token as an example, a **token transfer** will be represented as follows:

| from\_address | to\_address | amount | event                        |
| ------------- | ----------- | ------ | ---------------------------- |
| X             | Y           | 1250   | X transfers 1250 tokens to Y |

In credit debit, it will be represented **two rows**.

| address | counterparty\_address | amount | event                         |
| ------- | --------------------- | ------ | ----------------------------- |
| X       | Y                     | -1250  | X decrease 1250 tokens to Y   |
| Y       | X                     | 1250   | Y increase 1250 tokens from X |

### Table Columns

Unique Key: `unique_id`

| Column Name                     | Data Type         | Description                                                                                                                                                                       |
| ------------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| address                         | VARCHAR           | Address of the account that was credited or debited amount of ERC20 token                                                                                                         |
| counterparty\_address           | VARCHAR           | The address of counter party of this credit or debit transfer                                                                                                                     |
| token\_address                  | VARCHAR           | Token address of the ERC20 token                                                                                                                                                  |
| token\_name                     | VARCHAR           | Name of the ERC20 token                                                                                                                                                           |
| token\_symbol                   | VARCHAR           | Token symbol of this token                                                                                                                                                        |
| raw\_amount                     | FLOAT             | Amount of tokens moved (unnormalized)                                                                                                                                             |
| raw\_amount\_str                | VARCHAR           | Amount of tokens moved (unnormalized) in string                                                                                                                                   |
| amount                          | FLOAT             | Amount of tokens moved, normalized by the decimal points defined in the ERC20 token contract. For example, USDC has 6 decimals, so this value is the `raw_value` divided by 10^6. |
| amount\_str                     | VARCHAR           | Amount of tokens moved, normalized in string                                                                                                                                      |
| usd\_value                      | FLOAT             | The amount of tokens moved, in \$USD                                                                                                                                              |
| usd\_amount                     | FLOAT             | The amount of tokens moved, in USD.                                                                                                                                               |
| usd\_exchange\_rate             | FLOAT             | This is the price of a single token, in USD                                                                                                                                       |
| transaction\_from\_address      | VARCHAR           | The address of the sending party of this transaction.                                                                                                                             |
| transaction\_to\_address        | VARCHAR           | The address of the receiving party of this transaction.                                                                                                                           |
| transaction\_hash               | VARCHAR           | Transaction hash that this transfer belongs to                                                                                                                                    |
| transaction\_index              | BIGINT            | The position of this transaction in the block. The first transaction has index 0                                                                                                  |
| log\_index                      | BIGINT            | The position of this log within the block. The first log has index 0                                                                                                              |
| block\_timestamp                | TIMESTAMP\_NTZ(9) | The timestamp of the block that the corresponding transaction of this transfer belongs to. This is also the timestamp when this transfer occurred.                                |
| block\_number                   | BIGINT            | The block number that the corresponding transaction of this transfer belongs to                                                                                                   |
| block\_hash                     | VARCHAR           | The block hash that the corresponding transaction of this transfer belongs to                                                                                                     |
| unique\_id                      | VARCHAR           | Unique id generated to each transfer. Includes transaction hash, log index and credit and debit transaction type.                                                                 |
| \_created\_at                   | TIMESTAMP\_NTZ(9) | Timestamp of when the entry was created                                                                                                                                           |
| \_updated\_at                   | TIMESTAMP\_NTZ(9) | Timestamp of when the entry was last updated                                                                                                                                      |
| \_changed\_since\_full\_refresh | BOOLEAN           | Indicates if the record has changed since the last full refresh                                                                                                                   |
