From cc3ff6a6991505f8cde4c30dfe3c70e796bcf299 Mon Sep 17 00:00:00 2001 From: khaled kaddal Date: Tue, 16 Jun 2026 11:28:41 +0100 Subject: [PATCH 1/2] chore: agent skill to list-ondo-tokens --- .agent/skills/list-ondo-tokens/SKILL.md | 202 +++++++++++++++++++++++ .claude/skills/list-ondo-tokens/SKILL.md | 202 +++++++++++++++++++++++ AGENTS.md | 5 + CLAUDE.md | 6 + 4 files changed, 415 insertions(+) create mode 100644 .agent/skills/list-ondo-tokens/SKILL.md create mode 100644 .claude/skills/list-ondo-tokens/SKILL.md create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/.agent/skills/list-ondo-tokens/SKILL.md b/.agent/skills/list-ondo-tokens/SKILL.md new file mode 100644 index 00000000..53fe77f0 --- /dev/null +++ b/.agent/skills/list-ondo-tokens/SKILL.md @@ -0,0 +1,202 @@ +# Skill: List Ondo Tokens from Excel Sheet + +## Trigger + +Use this skill when the user wants to add Ondo tokenized assets from an Excel spreadsheet into the coin-definitions repository. + +--- + +## Step 0 — Ask for the Excel path + +If the user hasn't provided the path to the Excel file, ask: + +> "What is the full path to the Excel file?" + +--- + +## Step 1 — Read the Excel sheet + +Use Python with `openpyxl` (install via a venv if not available system-wide): + +```bash +python3 -m venv /tmp/xlvenv && /tmp/xlvenv/bin/pip install openpyxl -q +``` + +Read with `data_only=True` to resolve formula cells: + +```python +import openpyxl +wb = openpyxl.load_workbook('', data_only=True) +ws = wb.active +``` + +**Expected columns (0-indexed):** + +| Index | Field | +|-------|-------| +| 0 | Name | +| 1 | Symbol (mixed-case displaySymbol, e.g. `GLWon`) | +| 4 | Ethereum deployed address | +| 5 | BSC (Smartchain) deployed address | +| 6 | Solana deployed address | +| 16 | Logo PNG URL | +| 23 | Description | + +Skip rows where `row[0]` is empty. + +--- + +## Step 2 — Create token folders and info.json + +Base path: `extensions/blockchains/` + +For each token, create a folder per chain where an address exists. Skip chains with no address. + +### Folder naming + +- **Ethereum** and **Smartchain**: lowercase the address +- **Solana**: preserve original casing + +### info.json format + +**Ethereum** (`extensions/blockchains/ethereum/assets//info.json`): +```json +{ + "name": "", + "website": "https://ondo.finance/", + "type": "ERC20", + "symbol": "", + "decimals": 18, + "status": "active", + "id": "" +} +``` + +**Smartchain** (`extensions/blockchains/smartchain/assets//info.json`): +```json +{ + "id": "", + "name": "", + "symbol": "", + "type": "BEP20", + "decimals": 18, + "status": "active", + "website": "https://ondo.finance/", + "displaySymbol": "" +} +``` + +**Solana** (`extensions/blockchains/solana/assets//info.json`): +```json +{ + "displaySymbol": "", + "symbol": "", + "name": "", + "id": "", + "type": "SOLANA_TOKEN", + "decimals": 6, + "status": "active", + "website": "https://ondo.finance" +} +``` + +**Key rules:** +- `name`: strip `" (Ondo Tokenized)"` or any parenthetical suffix — use the clean name only +- `symbol`: always uppercase (`str(row[1]).upper()`) +- `displaySymbol`: taken directly from column 1 as-is (e.g. `GLWon`) + +### Logo + +Download `logo.png` from column 16 URL into each chain folder: + +```python +import urllib.request +urllib.request.urlretrieve(logo_url, os.path.join(folder, "logo.png")) +``` + +--- + +## Step 3 — Run the build script + +```bash +python3 scripts/build-lists.py --ci +``` + +Ensure dependencies are installed (`requests`, `bs4`, `web3`, `bech32`) — check `requirements.txt` and install with `pip3 install -r requirements.txt --break-system-packages -q` if needed. + +--- + +## Step 4 — Add descriptions to extensions/overrides.json + +Read `extensions/overrides.json`, then for each token add **three keys** to the `descriptions` object: + +| Key | Chain | +|-----|-------| +| `` | Ethereum | +| `.BNB` | Smartchain / Binance | +| `.SOL` | Solana | + +All three keys share the same description string (column 23 from Excel). + +Only add keys that don't already exist. Write back with `json.dump(overrides, f, indent=2)` followed by a trailing newline. + +--- + +## Step 5 — Run the descriptions fill script + +```bash +python3 scripts/build-lists.py --fill-descriptions-from-overrides +``` + +This updates `description/en.json` and `description/info.json`. + +--- + +## Step 6 — Git staging (critical — be selective) + +Stage **only** changes related to the tokens in the Excel sheet. The build scripts touch many chains; only stage what belongs to this work. + +### Stage new token asset files + +```bash +git status --short | grep "^A " | awk '{print $2}' | xargs git add +``` + +This picks up only newly added files (`A` status). Do **not** stage `M` (modified) files inside `extensions/blockchains/` — those belong to pre-existing tokens that were not part of this Excel sheet. + +### Stage relevant build outputs + +```bash +git add erc20-tokens.json chain/binance/tokens.json chain/solana/tokens.json +``` + +Do **not** stage unrelated chain outputs such as `chain/tron/tokens.json`, `chain/celo/tokens.json`, `chain/base/tokens.json`, etc. + +### Stage overrides and description files + +```bash +git add extensions/overrides.json description/en.json description/info.json +``` + +### Unstage any pre-existing modified tokens that crept in + +```bash +git status --short | grep "^M " | grep "extensions/blockchains" | awk '{print $2}' | xargs git restore --staged +``` + +### Final check + +Verify the staged set looks correct: +- `A` files: `extensions/blockchains/{ethereum,smartchain,solana}/assets/*/info.json` and `logo.png` — one pair per token per chain +- `M` files: `erc20-tokens.json`, `chain/binance/tokens.json`, `chain/solana/tokens.json`, `extensions/overrides.json`, `description/en.json`, `description/info.json` +- No `M` files under `extensions/blockchains/` (those are pre-existing tokens) + +--- + +## Notes + +- **Binance = smartchain** folder, `BEP20` type, `.BNB` description key +- **Solana = solana** folder, `SOLANA_TOKEN` type, `.SOL` description key +- **Ethereum = ethereum** folder, `ERC20` type, no chain suffix on description key +- If a token already has a folder, skip it (use `os.path.exists` before `os.makedirs`) +- The Excel `Symbol` column is the mixed-case `displaySymbol`; uppercase it for the `symbol` field diff --git a/.claude/skills/list-ondo-tokens/SKILL.md b/.claude/skills/list-ondo-tokens/SKILL.md new file mode 100644 index 00000000..53fe77f0 --- /dev/null +++ b/.claude/skills/list-ondo-tokens/SKILL.md @@ -0,0 +1,202 @@ +# Skill: List Ondo Tokens from Excel Sheet + +## Trigger + +Use this skill when the user wants to add Ondo tokenized assets from an Excel spreadsheet into the coin-definitions repository. + +--- + +## Step 0 — Ask for the Excel path + +If the user hasn't provided the path to the Excel file, ask: + +> "What is the full path to the Excel file?" + +--- + +## Step 1 — Read the Excel sheet + +Use Python with `openpyxl` (install via a venv if not available system-wide): + +```bash +python3 -m venv /tmp/xlvenv && /tmp/xlvenv/bin/pip install openpyxl -q +``` + +Read with `data_only=True` to resolve formula cells: + +```python +import openpyxl +wb = openpyxl.load_workbook('', data_only=True) +ws = wb.active +``` + +**Expected columns (0-indexed):** + +| Index | Field | +|-------|-------| +| 0 | Name | +| 1 | Symbol (mixed-case displaySymbol, e.g. `GLWon`) | +| 4 | Ethereum deployed address | +| 5 | BSC (Smartchain) deployed address | +| 6 | Solana deployed address | +| 16 | Logo PNG URL | +| 23 | Description | + +Skip rows where `row[0]` is empty. + +--- + +## Step 2 — Create token folders and info.json + +Base path: `extensions/blockchains/` + +For each token, create a folder per chain where an address exists. Skip chains with no address. + +### Folder naming + +- **Ethereum** and **Smartchain**: lowercase the address +- **Solana**: preserve original casing + +### info.json format + +**Ethereum** (`extensions/blockchains/ethereum/assets//info.json`): +```json +{ + "name": "", + "website": "https://ondo.finance/", + "type": "ERC20", + "symbol": "", + "decimals": 18, + "status": "active", + "id": "" +} +``` + +**Smartchain** (`extensions/blockchains/smartchain/assets//info.json`): +```json +{ + "id": "", + "name": "", + "symbol": "", + "type": "BEP20", + "decimals": 18, + "status": "active", + "website": "https://ondo.finance/", + "displaySymbol": "" +} +``` + +**Solana** (`extensions/blockchains/solana/assets//info.json`): +```json +{ + "displaySymbol": "", + "symbol": "", + "name": "", + "id": "", + "type": "SOLANA_TOKEN", + "decimals": 6, + "status": "active", + "website": "https://ondo.finance" +} +``` + +**Key rules:** +- `name`: strip `" (Ondo Tokenized)"` or any parenthetical suffix — use the clean name only +- `symbol`: always uppercase (`str(row[1]).upper()`) +- `displaySymbol`: taken directly from column 1 as-is (e.g. `GLWon`) + +### Logo + +Download `logo.png` from column 16 URL into each chain folder: + +```python +import urllib.request +urllib.request.urlretrieve(logo_url, os.path.join(folder, "logo.png")) +``` + +--- + +## Step 3 — Run the build script + +```bash +python3 scripts/build-lists.py --ci +``` + +Ensure dependencies are installed (`requests`, `bs4`, `web3`, `bech32`) — check `requirements.txt` and install with `pip3 install -r requirements.txt --break-system-packages -q` if needed. + +--- + +## Step 4 — Add descriptions to extensions/overrides.json + +Read `extensions/overrides.json`, then for each token add **three keys** to the `descriptions` object: + +| Key | Chain | +|-----|-------| +| `` | Ethereum | +| `.BNB` | Smartchain / Binance | +| `.SOL` | Solana | + +All three keys share the same description string (column 23 from Excel). + +Only add keys that don't already exist. Write back with `json.dump(overrides, f, indent=2)` followed by a trailing newline. + +--- + +## Step 5 — Run the descriptions fill script + +```bash +python3 scripts/build-lists.py --fill-descriptions-from-overrides +``` + +This updates `description/en.json` and `description/info.json`. + +--- + +## Step 6 — Git staging (critical — be selective) + +Stage **only** changes related to the tokens in the Excel sheet. The build scripts touch many chains; only stage what belongs to this work. + +### Stage new token asset files + +```bash +git status --short | grep "^A " | awk '{print $2}' | xargs git add +``` + +This picks up only newly added files (`A` status). Do **not** stage `M` (modified) files inside `extensions/blockchains/` — those belong to pre-existing tokens that were not part of this Excel sheet. + +### Stage relevant build outputs + +```bash +git add erc20-tokens.json chain/binance/tokens.json chain/solana/tokens.json +``` + +Do **not** stage unrelated chain outputs such as `chain/tron/tokens.json`, `chain/celo/tokens.json`, `chain/base/tokens.json`, etc. + +### Stage overrides and description files + +```bash +git add extensions/overrides.json description/en.json description/info.json +``` + +### Unstage any pre-existing modified tokens that crept in + +```bash +git status --short | grep "^M " | grep "extensions/blockchains" | awk '{print $2}' | xargs git restore --staged +``` + +### Final check + +Verify the staged set looks correct: +- `A` files: `extensions/blockchains/{ethereum,smartchain,solana}/assets/*/info.json` and `logo.png` — one pair per token per chain +- `M` files: `erc20-tokens.json`, `chain/binance/tokens.json`, `chain/solana/tokens.json`, `extensions/overrides.json`, `description/en.json`, `description/info.json` +- No `M` files under `extensions/blockchains/` (those are pre-existing tokens) + +--- + +## Notes + +- **Binance = smartchain** folder, `BEP20` type, `.BNB` description key +- **Solana = solana** folder, `SOLANA_TOKEN` type, `.SOL` description key +- **Ethereum = ethereum** folder, `ERC20` type, no chain suffix on description key +- If a token already has a folder, skip it (use `os.path.exists` before `os.makedirs`) +- The Excel `Symbol` column is the mixed-case `displaySymbol`; uppercase it for the `symbol` field diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..a9d336f4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,5 @@ +# AGENTS.md + +## Skills + +- **List Ondo tokens from Excel**: see `.agent/skills/list-ondo-tokens/SKILL.md` diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..27361dda --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,6 @@ +# CLAUDE.md + +## Skills + +- **List Ondo tokens from Excel**: `/list-ondo-tokens` — see `.claude/skills/list-ondo-tokens/SKILL.md` +- **Generate SQL category files for Ondo tokens**: `/generate-ondo-sql` — see `.claude/skills/generate-ondo-sql/SKILL.md` From 9cc5b54565c95535513fc88b2eaf547c49ff7073 Mon Sep 17 00:00:00 2001 From: khaled kaddal Date: Tue, 16 Jun 2026 12:35:32 +0100 Subject: [PATCH 2/2] chore: agent skill to generate ondo categories sql --- .agent/skills/generate-ondo-sql/SKILL.md | 181 ++++++++++++++++++++++ .claude/skills/generate-ondo-sql/SKILL.md | 181 ++++++++++++++++++++++ .gitignore | 3 +- AGENTS.md | 3 +- 4 files changed, 366 insertions(+), 2 deletions(-) create mode 100644 .agent/skills/generate-ondo-sql/SKILL.md create mode 100644 .claude/skills/generate-ondo-sql/SKILL.md diff --git a/.agent/skills/generate-ondo-sql/SKILL.md b/.agent/skills/generate-ondo-sql/SKILL.md new file mode 100644 index 00000000..fd2749d9 --- /dev/null +++ b/.agent/skills/generate-ondo-sql/SKILL.md @@ -0,0 +1,181 @@ +# Skill: Generate SQL Category Files for Ondo Tokens + +## Trigger + +Use this skill when the user wants to generate SQL insert files for Ondo token categories and sub-categories from an Excel spreadsheet. + +--- + +## Step 0 — Ask for inputs + +If not already provided, ask: +1. **Excel file path** — full path to the `.xlsx` file +--- + +## Step 1 — Read the Excel sheet + +Use Python with `openpyxl` via a venv if not available system-wide: + +```bash +python3 -m venv /tmp/xlvenv && /tmp/xlvenv/bin/pip install openpyxl -q +``` + +Read with `data_only=True` to resolve formula cells: + +```python +import openpyxl +wb = openpyxl.load_workbook('', data_only=True) +ws = wb.active +``` + +**Required columns (0-indexed):** + +| Index | Field | +|-------|-------| +| 1 | Symbol (mixed-case, e.g. `GLWon`) | +| 20 | Type (`Stock`, `ETF`, `CEF`) | +| 21 | Sector - Industry Group | + +Skip rows where `row[0]` is empty. + +--- + +## Step 2 — Map sub_category + +Available sub_categories from `assets.sub_category`: + +``` +TECH | FINANCE | HEALTH | CONSUMER | ENERGY | MEDIA | CRYPTO | ETF | COMMODITIES | CURRENCY | AEROSPACE +``` + +### Mapping rules (apply in order): + +**1. ETF/CEF type → always `ETF`** + +**2. Manual overrides by symbol** (companies whose sector label doesn't reflect their business): + +| Symbol | Sub-category | Reason | +|--------|-------------|--------| +| `BEON` | `ENERGY` | Bloom Energy — clean energy | +| `SMRON` | `ENERGY` | NuScale Power — nuclear energy | +| `NNEON` | `ENERGY` | NANO Nuclear Energy | +| `GNRCON` | `ENERGY` | Generac — power generation | +| `FPSON` | `ENERGY` | Forgent Power Solutions | +| `FLNCON` | `ENERGY` | Fluence Energy | +| `FCELON` | `ENERGY` | FuelCell Energy | +| `AAONON` | `CONSUMER` | AAON — commercial HVAC | + +**3. Sector-based mapping:** + +| Sector contains | Sub-category | +|----------------|-------------| +| `TECHNOLOGY`, `SOFTWARE`, `IT SERVICES`, `SEMICONDUCTORS` | `TECH` | +| `AEROSPACE`, `DEFENSE` | `AEROSPACE` | +| `ENERGY`, `OIL`, `GAS`, `RENEWABLE` | `ENERGY` | +| `TRANSPORTATION` | `ENERGY` (oil tankers) | +| `ENGINEERING`, `CONSTRUCTION` | `ENERGY` (energy infrastructure contractors) | +| `STEEL`, or `MATERIALS` + (`MINING`, `METAL`, `CHEMICAL`) | `COMMODITIES` | +| `FINANCIAL`, `FINANCE`, `ASSET MANAGEMENT`, `SPECIALTY FINANCE` | `FINANCE` | +| `CONSUMER`, `AUTOMOTIVE` | `CONSUMER` | +| `TELECOMMUNICATIONS`, `INTERNET MEDIA`, `COMMUNICATIONS` | `MEDIA` | +| `INDUSTRIALS` (all remaining) | `TECH` | + +**Fallback:** `TECH` + +--- + +## Step 3 — Generate SQL files + +Create three files in the `sql/` directory at the repo root. The `sql/` folder is gitignored — do not stage or commit it. + +**File naming:** `sql/-ondo-eth.sql`, `sql/-ondo-bnb.sql`, `sql/-ondo-sol.sql` + +Where `` is derived automatically from the current git branch: + +```bash +git rev-parse --abbrev-ref HEAD +``` + + +**Currency key format:** + +| File | Currency key | +|------|-------------| +| ETH | `SYMBOL` (no suffix) | +| BNB | `SYMBOL.BNB` | +| SOL | `SYMBOL.SOL` | + +**SQL structure for each file:** + +```sql +BEGIN; + INSERT INTO assets.currency_category(id, currency, category) + VALUES ('', '', 'STOCK'), + ('', '', 'STOCK'), + ...; + + INSERT INTO assets.currency_sub_category (id, currency, sub_category) + VALUES ('', '', ''), + ('', '', ''), + ...; +COMMIT; +``` + +**Key rules:** +- `category` is always `'STOCK'` for every token regardless of type (ETFs included) +- Every token gets both a category and a sub_category row +- Generate a fresh `uuid.uuid4()` for every row — each UUID is unique across all inserts +- `SYMBOL` is always uppercase (`str(row[1]).upper()`) + +**Python generation pattern:** + +```python +import uuid + +def build_sql(tokens, suffix): + cat_rows = [] + sub_rows = [] + for t in tokens: + currency = t['symbol'] + suffix + cat_rows.append(f" ('{uuid.uuid4()}', '{currency}', 'STOCK')") + sub_rows.append(f" ('{uuid.uuid4()}', '{currency}', '{t['sub_category']}')") + + lines = ['BEGIN;'] + lines.append(' INSERT INTO assets.currency_category(id, currency, category)') + lines.append(' VALUES ' + ',\n'.join(cat_rows) + ';') + lines.append('') + lines.append(' INSERT INTO assets.currency_sub_category (id, currency, sub_category)') + lines.append(' VALUES ' + ',\n'.join(sub_rows) + ';') + lines.append('COMMIT;') + return '\n'.join(lines) + '\n' +``` + +--- + +## Step 4 — Verify before handing off + +Print a summary of the sub_category distribution so the user can confirm the mappings are correct before running the SQL: + +``` +Sub-category distribution: + TECH: 78 + ETF: 43 + ENERGY: 22 + COMMODITIES: 12 + FINANCE: 8 + CONSUMER: 4 + AEROSPACE: 3 + MEDIA: 3 +``` + +Also list any tokens whose mapping might be non-obvious (manual overrides, Industrials assigned to non-TECH, etc.) so the user can review them. + +--- + +## Notes + +- The `sql/` directory is gitignored — these files are for local DB seeding only, never committed +- `category` is always `STOCK` even for ETF/CEF tokens — the `sub_category` table is what distinguishes them +- All four UUIDs per token (2 per file × 3 files for ETH+BNB+SOL) must be distinct +- If the user only needs a subset of chains, generate only the requested files +- Follow the exact format of existing reference files: `devx/add-third-ondo-eth.sql` and `devx/add-third-ondo-bnb.sql` diff --git a/.claude/skills/generate-ondo-sql/SKILL.md b/.claude/skills/generate-ondo-sql/SKILL.md new file mode 100644 index 00000000..fd2749d9 --- /dev/null +++ b/.claude/skills/generate-ondo-sql/SKILL.md @@ -0,0 +1,181 @@ +# Skill: Generate SQL Category Files for Ondo Tokens + +## Trigger + +Use this skill when the user wants to generate SQL insert files for Ondo token categories and sub-categories from an Excel spreadsheet. + +--- + +## Step 0 — Ask for inputs + +If not already provided, ask: +1. **Excel file path** — full path to the `.xlsx` file +--- + +## Step 1 — Read the Excel sheet + +Use Python with `openpyxl` via a venv if not available system-wide: + +```bash +python3 -m venv /tmp/xlvenv && /tmp/xlvenv/bin/pip install openpyxl -q +``` + +Read with `data_only=True` to resolve formula cells: + +```python +import openpyxl +wb = openpyxl.load_workbook('', data_only=True) +ws = wb.active +``` + +**Required columns (0-indexed):** + +| Index | Field | +|-------|-------| +| 1 | Symbol (mixed-case, e.g. `GLWon`) | +| 20 | Type (`Stock`, `ETF`, `CEF`) | +| 21 | Sector - Industry Group | + +Skip rows where `row[0]` is empty. + +--- + +## Step 2 — Map sub_category + +Available sub_categories from `assets.sub_category`: + +``` +TECH | FINANCE | HEALTH | CONSUMER | ENERGY | MEDIA | CRYPTO | ETF | COMMODITIES | CURRENCY | AEROSPACE +``` + +### Mapping rules (apply in order): + +**1. ETF/CEF type → always `ETF`** + +**2. Manual overrides by symbol** (companies whose sector label doesn't reflect their business): + +| Symbol | Sub-category | Reason | +|--------|-------------|--------| +| `BEON` | `ENERGY` | Bloom Energy — clean energy | +| `SMRON` | `ENERGY` | NuScale Power — nuclear energy | +| `NNEON` | `ENERGY` | NANO Nuclear Energy | +| `GNRCON` | `ENERGY` | Generac — power generation | +| `FPSON` | `ENERGY` | Forgent Power Solutions | +| `FLNCON` | `ENERGY` | Fluence Energy | +| `FCELON` | `ENERGY` | FuelCell Energy | +| `AAONON` | `CONSUMER` | AAON — commercial HVAC | + +**3. Sector-based mapping:** + +| Sector contains | Sub-category | +|----------------|-------------| +| `TECHNOLOGY`, `SOFTWARE`, `IT SERVICES`, `SEMICONDUCTORS` | `TECH` | +| `AEROSPACE`, `DEFENSE` | `AEROSPACE` | +| `ENERGY`, `OIL`, `GAS`, `RENEWABLE` | `ENERGY` | +| `TRANSPORTATION` | `ENERGY` (oil tankers) | +| `ENGINEERING`, `CONSTRUCTION` | `ENERGY` (energy infrastructure contractors) | +| `STEEL`, or `MATERIALS` + (`MINING`, `METAL`, `CHEMICAL`) | `COMMODITIES` | +| `FINANCIAL`, `FINANCE`, `ASSET MANAGEMENT`, `SPECIALTY FINANCE` | `FINANCE` | +| `CONSUMER`, `AUTOMOTIVE` | `CONSUMER` | +| `TELECOMMUNICATIONS`, `INTERNET MEDIA`, `COMMUNICATIONS` | `MEDIA` | +| `INDUSTRIALS` (all remaining) | `TECH` | + +**Fallback:** `TECH` + +--- + +## Step 3 — Generate SQL files + +Create three files in the `sql/` directory at the repo root. The `sql/` folder is gitignored — do not stage or commit it. + +**File naming:** `sql/-ondo-eth.sql`, `sql/-ondo-bnb.sql`, `sql/-ondo-sol.sql` + +Where `` is derived automatically from the current git branch: + +```bash +git rev-parse --abbrev-ref HEAD +``` + + +**Currency key format:** + +| File | Currency key | +|------|-------------| +| ETH | `SYMBOL` (no suffix) | +| BNB | `SYMBOL.BNB` | +| SOL | `SYMBOL.SOL` | + +**SQL structure for each file:** + +```sql +BEGIN; + INSERT INTO assets.currency_category(id, currency, category) + VALUES ('', '', 'STOCK'), + ('', '', 'STOCK'), + ...; + + INSERT INTO assets.currency_sub_category (id, currency, sub_category) + VALUES ('', '', ''), + ('', '', ''), + ...; +COMMIT; +``` + +**Key rules:** +- `category` is always `'STOCK'` for every token regardless of type (ETFs included) +- Every token gets both a category and a sub_category row +- Generate a fresh `uuid.uuid4()` for every row — each UUID is unique across all inserts +- `SYMBOL` is always uppercase (`str(row[1]).upper()`) + +**Python generation pattern:** + +```python +import uuid + +def build_sql(tokens, suffix): + cat_rows = [] + sub_rows = [] + for t in tokens: + currency = t['symbol'] + suffix + cat_rows.append(f" ('{uuid.uuid4()}', '{currency}', 'STOCK')") + sub_rows.append(f" ('{uuid.uuid4()}', '{currency}', '{t['sub_category']}')") + + lines = ['BEGIN;'] + lines.append(' INSERT INTO assets.currency_category(id, currency, category)') + lines.append(' VALUES ' + ',\n'.join(cat_rows) + ';') + lines.append('') + lines.append(' INSERT INTO assets.currency_sub_category (id, currency, sub_category)') + lines.append(' VALUES ' + ',\n'.join(sub_rows) + ';') + lines.append('COMMIT;') + return '\n'.join(lines) + '\n' +``` + +--- + +## Step 4 — Verify before handing off + +Print a summary of the sub_category distribution so the user can confirm the mappings are correct before running the SQL: + +``` +Sub-category distribution: + TECH: 78 + ETF: 43 + ENERGY: 22 + COMMODITIES: 12 + FINANCE: 8 + CONSUMER: 4 + AEROSPACE: 3 + MEDIA: 3 +``` + +Also list any tokens whose mapping might be non-obvious (manual overrides, Industrials assigned to non-TECH, etc.) so the user can review them. + +--- + +## Notes + +- The `sql/` directory is gitignored — these files are for local DB seeding only, never committed +- `category` is always `STOCK` even for ETF/CEF tokens — the `sub_category` table is what distinguishes them +- All four UUIDs per token (2 per file × 3 files for ETH+BNB+SOL) must be distinct +- If the user only needs a subset of chains, generate only the requested files +- Follow the exact format of existing reference files: `devx/add-third-ondo-eth.sql` and `devx/add-third-ondo-bnb.sql` diff --git a/.gitignore b/.gitignore index 26587620..c854fa0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea .DS_Store __pycache__/ -.venv \ No newline at end of file +.venv +sql/ \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index a9d336f4..a5cb1c6c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,4 +2,5 @@ ## Skills -- **List Ondo tokens from Excel**: see `.agent/skills/list-ondo-tokens/SKILL.md` +- **List Ondo tokens from Excel**: `/list-ondo-tokens` — see `.agent/skills/list-ondo-tokens/SKILL.md` +- **Generate SQL category files for Ondo tokens**: `/generate-ondo-sql` — see `.agent/skills/generate-ondo-sql/SKILL.md`