$npx -y skills add asterdex/aster-skills-hub --skill aster-deposit-fundDeposit funds to Aster from a wallet; private key from env. Use when the user wants to deposit to Aster or fund an Aster account.
| 1 | # Aster Deposit Fund |
| 2 | |
| 3 | ## Env |
| 4 | |
| 5 | | Var | Required | Description | |
| 6 | |-----|----------|-------------| |
| 7 | | `ASTER_DEPOSIT_PRIVATE_KEY` | Yes (deposit) | Wallet private key (0x + 64 hex). Used to sign on-chain deposit txs. Never log or echo. | |
| 8 | | `ASTER_WALLET_ADDRESS` | Yes (balance) | Public wallet address. Used by `balance.mjs` for read-only queries. | |
| 9 | | `ETH_RPC_URL` | Recommended | Private Ethereum RPC (Alchemy, Infura). Public fallback used if unset. | |
| 10 | | `BSC_RPC_URL` | Recommended | Private BSC RPC. | |
| 11 | | `ARBITRUM_RPC_URL` | Recommended | Private Arbitrum RPC. | |
| 12 | |
| 13 | ## Supported chains |
| 14 | |
| 15 | | Chain | chainId | |
| 16 | |-------|---------| |
| 17 | | ETH (Ethereum) | 1 | |
| 18 | | BSC | 56 | |
| 19 | | Arbitrum | 42161 | |
| 20 | |
| 21 | ## User confirmation |
| 22 | |
| 23 | **MANDATORY** — Before executing ANY deposit transaction, the agent MUST: |
| 24 | |
| 25 | 1. Display a clear summary to the user: |
| 26 | - Chain and chainId |
| 27 | - Asset symbol and contract address (for ERC20) |
| 28 | - Amount (human-readable AND raw wei/units) |
| 29 | - Deposit (treasury) address |
| 30 | - Broker ID (if non-default) |
| 31 | - Estimated gas cost |
| 32 | 2. Ask for **explicit textual confirmation** (e.g. "Type 'confirm' to proceed" or "yes/no"). |
| 33 | 3. **Do NOT** assume consent from a prior message, implicit agreement, or context. |
| 34 | 4. **Do NOT** batch multiple deposits without individual confirmation for each. |
| 35 | 5. If the user cancels or does not confirm, abort immediately with no on-chain action. |
| 36 | |
| 37 | Failure to confirm is a critical safety violation in an autonomous agent context. |
| 38 | |
| 39 | ## Flow |
| 40 | |
| 41 | 1. **Deposit address** — Hardcoded per chain in `scripts/common.mjs` (SEC-01). Same address for native and ERC20 on that chain. |
| 42 | 3. **Balance check** — Verify the wallet has sufficient balance for the deposit amount + gas BEFORE submitting any transaction (SEC-06). |
| 43 | 4. **User confirmation** — See above. Always confirm before executing. |
| 44 | 5. **On-chain send** — From wallet (key from env), sign with appropriate RPC for chain: |
| 45 | - **Native:** `treasury.depositNative(broker)` with `value = amount` (wei). |
| 46 | - **ERC20:** `token.approve(treasury, amount)` then `treasury.deposit(token, amount, broker)`. Token metadata (contract + decimals) is provided explicitly (no API lookup). |
| 47 | - All transactions use an explicit gas limit (SEC-09) and wait for multiple confirmations per chain (SEC-10). |
| 48 | |
| 49 | ## Security |
| 50 | |
| 51 | - Private key only from env; never log, echo, or pass via CLI args. |
| 52 | - Key is validated (0x + 64 hex chars) and removed from `process.env` after account derivation (SEC-02). |
| 53 | - Error output is sanitized to prevent accidental key leakage in logs (SEC-02). |
| 54 | - Deposit address is checked against a hardcoded whitelist to prevent oracle attacks (SEC-01). |
| 55 | - Public RPCs emit a warning; use private RPCs (Alchemy, Infura) in production (SEC-04). |
| 56 | - `balance.mjs` never loads the private key; it uses the public address only (SEC-07). |
| 57 | |
| 58 | ## Broker ID |
| 59 | |
| 60 | The `--broker` parameter (default: `1`) identifies the Aster broker account that the deposit is attributed to. Broker `1` is the primary/default Aster broker. Only change this if you know the target broker ID. An incorrect broker ID may result in funds being inaccessible from the expected account (SEC-11). |
| 61 | |
| 62 | ## Scripts (viem) |
| 63 | |
| 64 | Optional: `scripts/` — Bun + viem. Install: `cd skills/aster-deposit-fund/scripts && bun install`. |
| 65 | |
| 66 | | Script | Purpose | |
| 67 | |--------|---------| |
| 68 | | `deposit.mjs` | Deposit (no API lookups): `ASTER_DEPOSIT_PRIVATE_KEY=0x... bun run deposit.mjs --chain <eth\|bsc\|arbitrum> --native --amount <amount> [--broker <id>] [--dry-run]` or `... --token <0x...> --decimals <n> [--symbol <SYM>] --amount <amount> ...` | |
| 69 | | `balance.mjs` | Wallet balances (read-only, offline): `bun run balance.mjs --chain <eth\|bsc\|arbitrum> --address <0x...> [--no-native] [--token <SYM:0xADDR:DECIMALS>]...` | |
| 70 | |
| 71 | See `.env.example` in the repo root for all env vars. |
| 72 | |
| 73 | Payload shapes: [reference.md](reference.md). |