-- Trace event execution flow
SELECT
event_index,
contract_address,
topic_0,
SUBSTRING(data, 1, 10) AS data_preview
FROM <blockchain_name>.core.fact_event_logs
WHERE tx_hash = '0xabc...'
ORDER BY event_index;
``` |
| FROM_ADDRESS | TEXT | The from address for the token transfer. This may or may not be the same as the origin_from_address.
Example: '0x1234567890123456789012345678901234567890' |
| TO_ADDRESS | TEXT | The to address for the token transfer. This may or may not be the same as the origin_to_address.
Example: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd' |
| CONTRACT_ADDRESS | TEXT | The contract address for the token transfer.
Example: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' |
| TOKEN_STANDARD | TEXT | The token standard for the transfer, in this case always erc20.
Example: 'erc20' |
| TOKEN_IS_VERIFIED | BOOLEAN | Boolean flag indicating if the token is verified by the Flipside team.
Example: true |
| NAME | TEXT | Human-readable contract name from the name() function.
Example: 'USD Coin' |
| SYMBOL | TEXT | Token/contract symbol from the symbol() function.
Example: 'USDC' |
| DECIMALS | NUMBER | Number of decimal places for token amounts, read directly from the contract code.
Example: 6 |
| RAW_AMOUNT_PRECISE | TEXT | String representation of raw amount for precision preservation.
Example: '1000500000' |
| RAW_AMOUNT | FLOAT | Original token amount without decimal adjustment.
Example: 1000500000 |
| AMOUNT_PRECISE | TEXT | String representation of decimal-adjusted amount preserving full precision.
Example: '1000.500000' |
| AMOUNT | FLOAT | Decimal-adjusted token amount for human-readable values.
Example: 1000.50 |
| AMOUNT_USD | FLOAT | USD value of the token transfer at transaction time.
Example: 1000.50 |
| ORIGIN_FUNCTION_SIGNATURE | TEXT | Function signature (first 4 bytes) of the called method.
**Format**: 0x + 8 hex characters
**Common Signatures**:
- 0xa9059cbb: transfer(address,uint256)
- 0x095ea7b3: approve(address,uint256)
- 0x23b872dd: transferFrom(address,address,uint256)
**Note**: NULL for simple transfers or invalid calls |
| ORIGIN_FROM_ADDRESS | TEXT | The externally-owned account (EOA) or contract address that initiated the transaction.
**Key Points**:
- Always 42 characters (0x + 40 hex chars)
- Lowercase normalized in all tables
- Cannot be NULL for valid transactions
- For contract creation: sender of creation transaction
**Common Patterns**:
- EOA → EOA: Simple transfer
- EOA → Contract: User interaction
- Contract → Contract: Internal calls (see fact_traces)
- Known addresses: Exchange hot wallets, protocol deployers
**Query Examples**:
```sql
-- User activity analysis
SELECT from_address, COUNT(*) as tx_count
FROM <blockchain_name>.core.fact_transactions
WHERE block_timestamp >= CURRENT_DATE - 30
GROUP BY 1
ORDER BY 2 DESC;
-- New user detection
SELECT DISTINCT from_address
FROM <blockchain_name>.core.fact_transactions t1
WHERE NOT EXISTS (
SELECT 1 FROM <blockchain_name>.core.fact_transactions t2
WHERE t2.from_address = t1.from_address
AND t2.block_number < t1.block_number
);
``` |
| ORIGIN_TO_ADDRESS | TEXT | The destination address for the transaction - either an EOA or contract address.
**Special Cases**:
- NULL: Contract creation transaction
- Contract address: Interacting with smart contract
- EOA address: Simple transfer or receiving funds
**Important Patterns**:
```sql
-- Contract deployments
WHERE to_address IS NULL
-- Popular contracts
SELECT to_address, COUNT(*) as interactions
FROM <blockchain_name>.core.fact_transactions
WHERE to_address IS NOT NULL
GROUP BY 1
ORDER BY 2 DESC;
-- Direct transfers only
WHERE to_address NOT IN (SELECT address FROM dim_contracts)