feat(integrations): Hummingbot Gateway Terra Classic chain, CL8Y router/AMM connector and bridge-backed cross-chain arbitrage #1582

Open
opened 2026-10-29 00:31:40 +00:00 by PlasticDigits · 0 comments
Owner

Summary

Add Terra Classic chain support to Hummingbot Gateway plus a CL8Y DEX connector (router + AMM), so Hummingbot's DEX strategies — amm_arbitrage between a centralized venue and CL8Y, liquidity-provision routines, and cross-chain inventory arbitrage — can trade this venue through Gateway's standardized REST contract instead of a bespoke Python signer.

Cross-chain arbitrage is in scope and it uses CL8Y Bridge (https://bridge.cl8y.com, source code/cl8y-bridge-monorepo), not a new bridge built here. The bridge is a lock/attest/delay/execute rail (operator ApproveWithdraw, default 300 s withdrawal delay with canceler oversight, then permissionless ExecuteWithdraw), so cross-chain arbitrage is inventory-based: pre-position value on both chains, price bridge fee + delay/volatility + cancel risk, and use the bridge for rebalancing only. It is never an atomic leg inside trade or quote.

Gateway today ships exactly two chains (ethereum, solana) and DEX connectors for those chains only. There is no code path from Hummingbot to a Cosmos/CosmWasm venue, and no bot-facing bridge path. This issue bundles the whole enablement: chain implementation, DEX connector, bridge-aware inventory arbitrage, safety limits, tests against LocalTerra plus the bridge monorepo's local development stack, and an upstream contribution path.

Related, but separate: the spot/CLOB connector (#1581) covers resting limit orders and hybrid takers inside the Hummingbot client. This issue covers the Gateway-mediated swap/LP and cross-chain paths. Neither depends on the other to be useful, but both consume the DEX read plane (#1580: cached book snapshot, /markets discovery).

Community request (anonymized)

A community request asked whether Hummingbot could be brought to CL8Y DEX as a distribution channel for bot/strategy flow without marketing spend, and whether bridging between chains could eventually be part of that flow.

Do not retain or reproduce handles, timestamps, quotations or any user-identifying information from that request in this issue, code, docs, tests, fixtures, commit messages or logs.

Current codebase

Gateway (upstream)

  • TypeScript REST server; src/chains/{ethereum,solana} only; src/connectors/{uniswap,pancakeswap,raydium,orca,meteora,jupiter,dflow,titan,okx,0x}.
  • Connector sub-types: Router (quote, trade, estimateGas), AMM (poolPrice, addLiquidity, removeLiquidity), CLMM (positions).
  • Wallet management with encrypted storage and hardware-wallet support; pnpm + Node 18+; per-connector config schemas; interactive Swagger in dev.
  • Contribution path: fork, implement chain + connector, tests, docs, PR; chain/connector inclusion is governed (HGP) and carries a maintenance commitment.

CL8Y DEX (this repository)

  • Terra Classic columbus-5, cosmwasm 1.x on a 0.47-era chain; bech32 prefix cosmos; gas floor 28.325 uluna/gas.
  • Router ExecuteSwapOperations with per-hop hybrid params; pair HybridSimulation/HybridReverseSimulation; provide_liquidity/withdraw_liquidity; LP CW20s (18 decimals); factory pair discovery; SwapOperation::TerraSwap.
  • Zero-LCD route solver: GET/POST /api/v1/route/solve → hops, router_operations, estimated_amount_out_net, optimality_scope, snapshot_age_ms, quote_kind (docs/route-solver.md, docs/integrators.md).
  • Gas-by-message-shape rules (skills/AGENTS_TERRACLASSIC_GAS.md, skills/AGENTS_HYBRID_LIMIT_GAS.md).
  • Fee discounts and treasury routing (docs/reference/fee-discount-tiers.md).

CL8Y Bridge (external system, consumed here — source of truth)

  • Public UI https://bridge.cl8y.com; source code/cl8y-bridge-monorepo (Solidity contracts, CosmWasm bridge, Solana program, operator and canceler services, frontend, multichain-rs shared crate).
  • Supported chains and bridge chain keys (bytes4): BSC 56 / 0x00000038, opBNB 204 / 0x000000cc, MegaETH 4326 / 0x000010e6, Terra Classic columbus-5 / 0x00000001, Solana mainnet-beta / 0x00000005.
  • Deployed bridge contracts: EVM proxy 0xb2a22c74da8e3642e0effc107d3ac362ce885369 on BSC and opBNB (identical CREATE3 addresses; ChainRegistry 0x2e5d36…, TokenRegistry 0x3d8820…, LockUnlock 0xd7b3bf…, MintBurn 0x0a1a4b…, plus the router); Terra Classic bridge terra18m02l2f43c2dagqnz3kfccpgz9pzzz5hk9l5mh5wvr6dcvv47zfqdfs7la; Solana bridge program 4XX8ndYXupw4Sb4SsRgAPTmBJJjfZbg8rWjj87iKEhVt with BridgeConfig PDA HarAAW2pPcgBwMhcwRsUxRqiDeihCJVjZCmdCWpJbmsD.
  • Transfer lifecycle (watchtower): source deposit (EVM deposit/depositNative, Terra native Lock, Terra CW20 Send { Lock }) → operator observes and calls ApproveWithdraw → withdrawal delay (default 300 s, admin-settable 60–86 400 s) → anyone calls ExecuteWithdraw/withdraw; authorized cancelers may CancelWithdrawApproval during the delay, and admin ReenableWithdrawApproval resets the timer. Reorged deposits are cancelled and re-enabled the same way.
  • Fees and limits: Terra Config.fee_bps / fee_config.standard_fee_bps and EVM getFeeConfig().standardFeeBps; min_bridge_amount / max_bridge_amount; per-token RateLimit / PeriodUsage. ERC20 path pays the fee in msg.value at destination; native path deducts it from the bridged amount.
  • Transfer identity: V2 7-field hash keccak256(srcChain, destChain, srcAccount, destAccount, destToken, netAmount, nonce); queries ComputeWithdrawHash, DepositHash, DepositByNonce, PendingWithdraw (all states, single hash), ActiveWithdrawals (non-terminal index, next_start_after), WithdrawApproval, WithdrawDelay, RateLimit, PeriodUsage, Token, Chain; Terra SimulateBridge { token, amount, dest_chain_id } previews the fee.
  • No bot-facing quote/deposit REST API: bridging is chain transactions plus contract queries. The operator exposes monitoring endpoints only (/health, /status, /pending, /metrics; /pending is auth-gated by OPERATOR_API_TOKEN).
  • Trust model: watchtower. On-chain hooks (hash, roles, delay) do not provide economic security without honest, monitored operator and canceler processes.
  • Bridged assets are mint/burn or lock/unlock representations registered per chain in the TokenRegistry; the bridge moves value, it does not create destination liquidity.

Gaps

  • No Terra Classic chain in Gateway, no CosmWasm signing path, no CL8Y connector, no AMM/LP support for this venue from any Hummingbot strategy, no local Gateway test harness for this chain.
  • No bot-facing bridge client: no maintained way to price a transfer, submit a deposit/withdraw, follow approval → delay → execute, or reconcile a cancelled/re-enabled transfer. Cross-chain arbitrage cannot be built safely without that.

Why

  • Cross-venue arbitrage is the highest-value bot flow. amm_arbitrage needs a Gateway connector. Without one, CL8Y can only be reached from the client-side spot connector, which does not implement Gateway's AMM/CLMM contract and does not expose LP operations.
  • Cross-chain arbitrage is only possible with the bridge. CL8Y settles on Terra Classic; the venues that hold the other side of a cross-chain arb live on BSC/opBNB/MegaETH/Solana. CL8Y Bridge is already deployed on those chains, so the missing piece is a safe, bounded client that prices the bridge, tracks the delayed withdrawal, and keeps inventory rather than pretending a cross-chain leg is atomic.
  • LP automation. Gateway's AMM methods (poolPrice, addLiquidity, removeLiquidity) let strategy authors rebalance liquidity without writing CosmWasm messages. That directly improves book/pool depth.
  • Standardization and safety. Gateway centralizes wallet custody, gas estimation, and request validation, so every strategy reuses one audited signing path instead of a per-bot script.
  • Ecosystem leverage. A supported chain plus a bridge client benefits every strategy that wants Terra Classic liquidity, not just CL8Y.

Constraints and guardrails

  1. Wallet custody stays in Gateway. Keys are created/imported through Gateway's existing encrypted wallet store; no mnemonic in cleartext config, logs, URLs, or CLI args. cl8y routes must work on loopback only by default and never expose key material.
  2. Chain identity is pinned. chainId must be columbus-5; verify against the node on startup and per request when the node reports a different chain; refuse to sign otherwise. Config must not accept an arbitrary chainId override in production mode.
  3. Contract allowlist. Signable targets are limited to configured factory/router/pair/fee-discount/treasury addresses discovered from the factory or the venue manifest, plus the pinned CL8Y Bridge contracts when bridge routes are enabled. No generic "execute arbitrary contract" endpoint, no user-supplied to.
  4. Quote/trade agreement. trade must execute the exact route returned by quote, with a positive min_return/belief_price derived from estimated_amount_out_net and the caller's slippage bound. Reject stale quotes (snapshot_age_ms), degraded quote kinds, and missing execution metadata. Never accept min_return = 0.
  5. Simulation before send. Re-verify the candidate trade with an on-chain HybridSimulation/router simulation (bounded) and refuse if simulated output differs from the quote beyond a documented tolerance.
  6. Gas is bounded and derived. Use message-shape gas envelopes; cap gas/fees per route; never accept caller-supplied gas that exceeds policy; reject when gas price deviates from the configured floor by more than a bound.
  7. Pause/blacklist/freeze. Preflight market flags and typed contract errors; no retries on deterministic reverts; surface them as structured errors.
  8. Token semantics. Only allowlisted tokens with known decimals; community-tax or unknown CW20s refuse by default; token_info decimals must match the catalog.
  9. Idempotency and sequence. Single-flight signing per wallet, cached account state, bounded code 32 refresh, and request idempotency keys for trade so a retried HTTP call cannot double-spend.
  10. Bounded request surface. Schema-validated payloads (amounts as strings), hard size caps, per-request timeouts, per-route rate limits, and no unbounded batch operations.
  11. Do not fork the upstream wallet or auth model. Reuse Gateway's wallet/auth/rate-limit facilities; add only what the chain requires.
  12. The bridge is non-atomic — never model it as a swap. A transfer has ≥withdraw_delay (default 300 s) plus operator attestation latency plus destination finality. quote/trade must never include a bridge leg; cross-chain arbitrage must be an inventory/rebalance strategy with explicit exposure limits.
  13. Bridge contract identity is pinned and verified. Pinned address per chain, pinned bytes4 chain key, Status/Config paused check, token enabled check, Token/Chain registry lookup, min_bridge_amount/max_bridge_amount, and RateLimit/PeriodUsage. Never bridge to an unregistered destination token or an unverified address.
  14. Transfer hash parity is computed, never guessed. Follow the V2 7-field encoding (destination token, net post-fee amount, nonce). Verify ComputeWithdrawHash against the local computation before submitting; reconcile from PendingWithdraw (all states) and ActiveWithdrawals.
  15. The delay window is a risk window. Treat ApproveWithdraw as pending, not settled: watch for CancelWithdrawApproval/ReenableWithdrawApproval (which resets the timer), never execute before the delay, and never count a bridged amount as balance until ExecuteWithdraw commits and the destination balance is confirmed.
  16. Inventory-first. Pre-position on both chains; bridge only to rebalance when imbalance exceeds a configured threshold and expected edge exceeds bridge fee + both-chain gas + delay/volatility buffer + destination slippage + cancel/operator risk. Hard per-chain and total in-flight caps, plus a max in-flight transfer count.
  17. Do not move user funds. The bridge client only moves funds from the configured trading wallet(s) under the operator's explicit config and caps. No per-user bridging, no custodial transfers, no automatic bridging triggered by strategy profit alone.
  18. Bridge-side changes belong to the bridge repository. This issue consumes the deployed bridge. New chains, fee changes, token registration, rate-limit policy, operator/canceler changes and bridge UI work go to code/cl8y-bridge-monorepo with its own invariants and reviews.
  19. Docs and anonymity. No chat text, handles, or operator identities in code/docs/fixtures/logs. Unavailable live checks are explicit SKIP; executed failures remain FAIL.

Relevant files

Area Files
New chain gateway/src/chains/terraclassic/ — terraclassic.ts, terraclassic.config.ts, terraclassic.constants.ts, terraclassic.routes.ts, wallet/sequence helpers
New connector gateway/src/connectors/cl8y/ — cl8y.ts, cl8y.config.ts, cl8y.constants.ts, cl8y.utils.ts, router-routes/, amm-routes/
Bridge client (new) integrations/cl8y_bridge_client/ — config/address pinning, fee + limit reads, hash computation, deposit/approve/execute state machine, status reconciliation, operator-API adapter
Cross-chain arb harness packages/crosschain-arb/ — cost model, inventory ledger, exposure caps, orchestration, tests
Chain route registry gateway/src/chains/chain.routes.ts, gateway/src/schemas/
Config + docs gateway/src/templates/ (config schema pattern), gateway/docs/
Venue truth docs/route-solver.md, docs/integrators.md, docs/limit-orders.md, smartcontracts/packages/dex-common/src/pair.rs, smartcontracts/contracts/router/
Bridge truth (external repo) code/cl8y-bridge-monorepo: docs/architecture.md, docs/crosschain-flows.md, docs/security-model.md, docs/operator.md, docs/contracts-terraclassic.md, docs/contracts-evm.md, docs/TERRACLASSIC_BRIDGE_INVARIANTS.md, packages/contracts-terraclassic/bridge/src/query.rs, packages/contracts-evm/, packages/operator/src/api.rs, packages/multichain-rs/
Gas/fees skills/AGENTS_TERRACLASSIC_GAS.md, docs/reference/fee-discount-tiers.md
Local chain + bridge dev scripts/setup-cloud-agent-localterra.sh, docs/localterra-sdk53.md; bridge repo docs/local-development.md (anvil + LocalTerra local bridge)
Policy docs/security-model.md, docs/supply-chain-security.md

Recommended direction

Phase 1 — chain implementation

  • src/chains/terraclassic using @cosmjs/stargate + @cosmjs/cosmwasm-stargate (or the current upstream-supported equivalent), with: node info/chain-id assertion, bank balances, CW20 balances via smart query, account number/sequence cache + single-flight, fee estimation from message shape, broadcast + tx result parsing (including wasm events for fills/refunds), and request timeouts.
  • Config schema: chainId (pinned), nodeUrl/lcdUrl allowlist, gasPrice (default 28.325uluna, bounded override), gasAdjustment cap, expectedBech32Prefix (cosmos), factory/router/fee-discount addresses, token allowlist, per-trade notional cap, maxOpenOrders/maxRoutes bounds.
  • Chain routes: status, balances, tokens, allowances, estimateGas, poll, following the existing chain-route shape so the Python client needs no special case.

Phase 2 — CL8Y connector

  • Router: quote from GET/POST /api/v1/route/solve (amount in, pool-only and hybrid modes, max hops), returning output, price impact context, route legs, expiry and a route fingerprint; trade executes the returned router_operations (single-hop pair Swap when the route is one hybrid hop, otherwise router ExecuteSwapOperations) with caller slippage → min_return; estimateGas from the documented envelopes.
  • AMM: poolPrice from pair HybridSimulation (pool-only params) or mirrored reserves; addLiquidity/removeLiquidity via pair messages with CW20 allowance handling and LP token accounting (18-decimal LP, MINIMUM_LIQUIDITY rules documented in skills/AGENTS_REBALANCE_MINT_UST1_LP.md and the pair contract).
  • CLMM: not applicable; document explicitly (no concentrated positions) so the Python client does not advertise it.
  • Route-level validation: path/route id echoed back from quote, so trade cannot silently substitute a different route.

Phase 3 — CL8Y Bridge client (read + bounded write)

  • Bridge config module: pinned per-chain bridge address, bytes4 chain key, destination token registry, decimals, min/max amount, fee source, rate-limit source, delay source. Every value read from chain (Terra Config/FeeConfig/WithdrawDelay/Token/Chain/RateLimit/PeriodUsage; EVM getFeeConfig/getCancelWindow/TokenRegistry), never hardcoded.
  • Cost model: bridge_fee = ceil(amount * fee_bps / 10_000) per the deployed contract, plus both-chain gas, plus a configurable delay/volatility buffer (expected price move over delay + attestation latency), plus destination venue slippage/depth, plus a cancel/operator-risk margin. Refuse when edge ≤ cost.
  • Write paths (allowlisted): Terra native Lock, Terra CW20 Send { Lock }, EVM deposit/depositNative, destination ExecuteWithdraw (Terra) / withdraw (EVM). Reject an unregistered destination token, a chain that is disabled/paused, an amount outside min/max, and a rate-limit-exceeding amount before signing.
  • Transfer state machine persisted per transfer: quoted → source_deposit_sent → deposit_confirmed → approval_observed → delay_elapsed → withdraw_executed → settled, with terminal cancelled, reapproved (delay reset), stuck, failed. Reconcile from PendingWithdraw, ActiveWithdrawals, DepositHash, EVM events and destination balances; never infer settlement from an approval alone.
  • Operator monitoring adapter: optional /status + /pending reads (when OPERATOR_API_TOKEN is configured) to detect attestation lag; on lag or cancel events, halt new bridging and alert. Never treat the operator API as authority over chain state.
  • Safety: per-chain and total inventory caps, max in-flight transfers, max transfer size, per-token allowlist, pause-on-cancel, pause-on-operator-lag, and a manual bridge kill switch.

Phase 4 — cross-chain inventory arbitrage

  • Separate crosschain_inventory_arb component (not shoehorned into amm_arbitrage): read CL8Y price (route solver), destination venue price (Gateway connector or CEX), bridge cost/limits, and inventory ledger. Decide between "trade on-chain", "rebalance via bridge", or "do nothing".
  • Inventory-first policy: trade the local leg only while destination-side and Terra-side inventory stay within configured bands; bridge only the amount needed to restore the band, never the full position.
  • Exposure accounting: value both legs in a common unit, include bridged-but-not-settled amounts as in-flight exposure (not spendable), and refuse new transfers while in-flight exposure exceeds the cap.
  • Explicitly document that the bridge cannot close an arb atomically: a 5-minute-plus delay means the strategy must tolerate adverse moves and must not size positions on the assumption that a transfer completes at the quoted price.

Phase 5 — tests, docs, contribution

  • Unit + route-level tests with fixtures; LocalTerra integration suite; bridge E2E using the bridge monorepo's local development stack (anvil + LocalTerra, local bridge contracts) when available, otherwise explicit SKIP with a chain-truth fixture.
  • Docs PR to the gateway/hummingbot-site repos; PR to upstream with a maintenance commitment; vendor path (pinned image/commit) for users not waiting on governance.
  • Bridge documentation stays in the bridge repo; this repo documents the consumed contract, the cost model, the state machine, and the trust assumptions.

Given / When / Then

Given a Gateway instance with the terraclassic chain and the cl8y connector configured, a funded wallet and a running indexer,

When a strategy calls quote for LUNC → USTC and then trade with 1% slippage,

Then trade signs exactly the quoted route with a positive min_return, uses the documented gas envelope, returns a tx hash, and reports the confirmed output from committed wasm events.

Given a quote whose reserve snapshot is older than the freshness bound or whose route includes an unknown market flag,

When trade is called,

Then Gateway refuses with a structured error and does not sign — even if the caller supplies their own min_return.

Given the node reports a chain id other than columbus-5 (testnet, fork, or a malicious proxy),

When any signing route is called,

Then the request fails closed before keys are used, and the failure is visible in the status route.

Given a CL8Y premium on Terra and a discount on a BSC venue for the bridged asset, both inventories funded, and the bridge not paused,

When the cross-chain arb component evaluates the opportunity,

Then it nets the bridge fee, both-chain gas, delay/volatility buffer, destination slippage and cancel risk; if the edge is positive and caps allow, it bridges only the rebalance amount, tracks deposit → approval → delay → execute → settled, and refuses to count the amount as spendable until settlement.

Given the bridge approval is cancelled during the delay window, or the operator stops attesting, or the token/chain is paused or rate-limited,

When the component would otherwise complete a transfer,

Then it halts new bridging, marks the transfer cancelled/stuck, keeps the amount in in-flight exposure (never spendable), and surfaces an operator-visible alert.

Acceptance criteria

  1. Gateway starts with the terraclassic chain and cl8y connector from config alone (documented schema, defaults, validation errors); status reports chain id, height, node health and wallet readiness.
  2. Chain routes implement balances (bank + CW20), tokens/decimals, allowances, estimateGas, and poll with the standard response shape.
  3. cl8y.router.quote returns route legs, expected output, price impact/degradation metadata, route fingerprint, freshness, and expiry; it supports pool-only, hybrid and multi-hop.
  4. cl8y.router.trade executes only the fingerprinted quote with positive min_return; stale/degraded/unknown-market quotes are refused; simulated-vs-quoted deviation beyond tolerance is refused.
  5. estimateGas matches the documented per-message envelopes within a stated tolerance for swap routes (1-hop pool, 1-hop hybrid, ≥2-hop router), and refuses when the envelope cannot be established.
  6. cl8y.amm.poolPrice, addLiquidity, removeLiquidity work end-to-end with correct decimals, LP accounting, allowance handling, and MINIMUM_LIQUIDITY behaviour.
  7. Contract allowlist is enforced: no route can sign an arbitrary contract, arbitrary message type, or unlisted token; attempts return a structured refusal.
  8. Wallet safety: encrypted custody only, no key material in logs/errors/URLs, loopback-only by default, and sequence/idempotency guarantees prevent double-spend on retried trade calls.
  9. chainId/node pinning, pause/blacklist/F6-freeze preflight, gas-price bounds, notional caps, and request size/rate limits are enforced and tested.
  10. Bridge identity and limits come from chain truth: pinned per-chain bridge address + bytes4 chain key; Status/Config pause, token/chain enabled, min/max amount, fee bps, withdraw_delay, and RateLimit/PeriodUsage are read and enforced; the client refuses an unregistered destination token or an unverified address.
  11. Bridge cost model is complete: fee (contract bps) + both-chain gas + configurable delay/volatility buffer + destination depth/slippage + cancel/operator-risk margin; the component refuses when net edge ≤ 0, and the model is unit-tested with a documented worked example.
  12. Bridge lifecycle is reconciled, not assumed: V2 7-field hash computed locally and checked against ComputeWithdrawHash; state machine covers deposit → approval → delay → execute → settled, plus cancelled, reapproved, stuck, failed; nothing is spendable before settlement.
  13. Inventory and exposure controls: per-chain/total caps, max transfer size, max in-flight transfers, per-token allowlist, in-flight exposure counted as non-spendable, and a bridge kill switch; a cancelled or stuck transfer cannot be double-counted or re-spent.
  14. No atomic bridge: quote/trade never include a bridge leg; cross-chain arb runs only through the separate inventory component; config cannot enable bridge legs inside trade.
  15. amm_arbitrage CEX↔CL8Y completes a LocalTerra end-to-end cycle in test mode (CEX leg simulated or paper), including a no-trade case below the profit threshold; the cross-chain component completes a local bridge cycle against the bridge monorepo's local stack, or records an explicit SKIP with the reason and a chain-truth fixture receipt.
  16. Unit + route tests, coverage gate, and LocalTerra/bridge integration tests pass; pnpm lint/pnpm test are clean under the upstream toolchain.
  17. Docs: chain/connector pages, bridge client page (cost model, state machine, limits, trust assumptions), config reference, examples, limitations (no order book/expiry/claims, no atomic bridge), and a troubleshooting section; upstream PR + governance/maintenance plan and vendor path documented.
  18. make verify-issue-<n> (repo-local harness) and docs/qa/issue-<n>/README.md exist; skills/AGENTS_HUMMINGBOT_GATEWAY.md (HG1–HG12) and skills/AGENTS_CL8Y_BRIDGE_CLIENT.md (BC1–BC10) present.
  19. No user handles, chat text or operator identities anywhere in the deliverable.

Test plan — all paths

# Path Case Expected
T1 Unit Chain config validation: missing node, bad chain id, bad gas price, bad bech32 prefix Actionable refusal at startup
T2 Unit Node reports columbus-5 / other chain / unreachable Signing allowed / fail-closed / fail-closed with retry
T3 Unit Balances: bank only, CW20 only, multiple CW20, zero, huge, decimals 6/18 Exact string amounts, no float loss
T4 Unit estimateGas for 1-hop pool, 1-hop hybrid, ≥2 hops, unknown route Documented envelope / refused
T5 Unit quote route fingerprint stability and route substitution attempt in trade Mismatch refused
T6 Unit min_return=0, negative, absurdly high, non-integer 400; no signing
T7 Unit Stale quote by 1 ms under/over bound; degraded quote_kind; unknown market flag Accept at boundary / refuse
T8 Unit Token allowlist: listed, unlisted, unknown decimals, community-tax token Listed works; others refused with reason
T9 Unit Contract allowlist: factory/router/pair vs arbitrary address, bridge address when bridge disabled Only allowlisted signs; bridge routes gated
T10 Unit Sequence mismatch code 32, concurrent trade, retried idempotency key Single-flight, bounded refresh, exactly one tx
T11 Unit Tx result parsing: success, revert with typed reason, out-of-gas, wasm event fills/hybrid fields Structured result; no false success
T12 Unit Fee/gas price bounds: at floor, above cap, manipulated low Accept at floor / refuse
T13 Unit Request schema: huge body, string overflow, extra fields, arrays over cap 400 with no partial work
T14 Integration LocalTerra swap 1-hop pool and 1-hop hybrid Chain output matches quote within tolerance
T15 Integration LocalTerra multi-hop router swap Route legs honoured; output within slippage
T16 Integration Add/remove liquidity, LP balance accounting, minimum liquidity edge Correct LP amounts; edge refused or handled
T17 Integration Paused pair, blacklisted wallet/token/pair, F6 freeze Typed refusal; no retry storm
T18 Integration Insufficient gas/CW20/allowance, expired route, node 5xx, timeout Clear errors; no double spend
T19 Integration amm_arbitrage CEX (paper) ↔ CL8Y: profitable, break-even, unprofitable Trade only when profitable after fees+gas; skip otherwise
T20 Bridge unit Fee/limit config reads: Terra Config/FeeConfig/WithdrawDelay, EVM getFeeConfig; boundary amounts at min, min−1, max, max+1 Values match chain truth; out-of-range refused pre-sign
T21 Bridge unit Paused bridge, disabled chain, disabled token, unregistered destination token, wrong decimals Refused with typed reason; no signing
T22 Bridge unit Hash: V2 7-field encoding vs ComputeWithdrawHash fixtures (Terra→EVM, EVM→Terra, native + CW20 + ERC20), wrong token/side/nonce Exact match; any mismatch refused
T23 Bridge unit Cost model: fee-only, gas-only, delay buffer dominates, negative edge, rounding up, zero amount Correct arithmetic with ceiling; refuse non-positive edge
T24 Bridge unit Rate limit/period usage at boundary; amount exceeding remaining period budget Refused before signing
T25 Bridge integration Local bridge (bridge repo local dev): Terra→EVM lock/deposit → approval → delay → execute; balances and fee collector delta Settled once; fee matches config; no double withdraw
T26 Bridge integration EVM→Terra deposit → ApproveWithdraw → delay → ExecuteWithdraw; CW20 and native paths Settled once; correct recipient and amount
T27 Bridge integration Cancel during delay, then re-enable (delay resets); execute attempt after re-enable before delay Refused until new delay elapses; state reapproved
T28 Bridge integration Delay boundary: execute at delay−1 s and delay+1 s Revert WithdrawDelayNotElapsed then success
T29 Bridge integration Duplicate hash / reused nonce / duplicate execute NonceAlreadyUsed/replay refused; no double spend
T30 Bridge integration Operator not attesting (lag), operator API unavailable, pending auth failure Halt new bridging; existing transfer stays stuck; alert; no retry storm
T31 Cross-chain Inventory band: local trade only, rebalance only, no-op; caps hit; in-flight exposure counted Correct decision per worked example; no overspend
T32 Cross-chain Price moves adversely during delay beyond buffer Loss bounded by configured caps and buffer; alert; inventory band respected
T33 Regression Existing ethereum/solana chains and connectors Unaffected
T34 Ops Loopback-only default, remote bind refusal, docs for tunnel Refuses insecure remote exposure
T35 Deploy Vendor image/pinned commit install; upstream PR build Reproducible build; no network at runtime

Adversarial test plan — attack, hack, abuse

# Vector Attack Required behaviour
A1 Fund drainer Abuse trade with attacker-supplied contract address or message type Allowlist + typed message builders only; no generic execute
A2 Quote substitution Caller reuses a fingerprint with different route/amounts to get a better signed trade Fingerprint binds route, amounts, tokens, expiry, slippage; mismatch refused
A3 Stale/malicious data source Compromised indexer inflates output to induce a bad trade On-chain simulation cross-check, freshness bound, deviation tolerance, pinned endpoints
A4 Chain-id confusion Testnet/fork/malicious proxy replays mainnet expectations Pinned columbus-5, node verification per request, fail closed
A5 Sandwich / MEV Pending arb/manage tx is front-run on a public mempool Slippage floors, bounded size, timing jitter, notional caps, documented exposure
A6 Double spend Retried HTTP request or duplicate idempotency key creates two trades Request idempotency key + sequence single-flight + tx-hash dedupe
A7 Key theft Local file/process/log/endpoint exposure of the Gateway wallet Encrypted store, loopback-only, redaction tests, no key endpoints, auth on non-loopback
A8 Malicious token CW20 with hidden fee/blacklist/rebase or fake token_info Allowlist + on-chain token_info check + refuse unknown semantics
A9 Gas griefing Caller requests huge gas to burn funds, or node under-reports gas Policy cap, message-shape envelope, min gas floor, refuse anomalies
A10 Reorg / false confirmation Treat a reorged tx as final and trade again Confirmation policy with height finality; recheck balances before next trade
A11 Rate-limit / resource exhaustion Flood quote to exhaust the indexer budget or Gateway CPU Per-route limits, timeouts, bounded solver params, backpressure
A12 Governance bypass Retry through pause/blacklist/freeze with a different route shape Preflight flags on every route; no bypass path
A13 Supply chain Malicious npm dependency in the chain/connector Pinned lockfile + audit in CI, reviewed deps, no postinstall scripts
A14 Log/telemetry leakage Wallet address ↔ person mapping or amounts leaked Minimal structured logs, no user identifiers, documented retention
A15 Fake bridge approval / forged deposit Malicious or compromised operator attests a deposit that never happened; bot credits inventory early Bot never treats approval as settlement; verifies the V2 hash against the source chain deposit and destination balance after execute; only tracks transfers it initiated
A16 Recipient substitution Approval or deposit redirects funds to an attacker address Hash binds source account, destination account, destination token and net amount; any deviation refused and alerted
A17 Bridge address spoofing Config or an injected payload swaps in a lookalike bridge contract or chain key Pinned address + bytes4 chain key, verified Config/Status, no config override at runtime
A18 Bridged-token spoofing A fake bridged token or wrong token mapping is used as the destination leg TokenRegistry/Token lookup, decimals + contract pinning, allowlist; refuse unregistered mints
A19 Cancel-window griefing A canceler (or a malicious role) cancels approvals to delay funds, or a false positive blocks execution Cancel detected, state cancelled, in-flight exposure retained, alert, no blind retry; re-enable path requires fresh delay and operator review
A20 Bridge pause / emergency Admin pauses the bridge, or a chain is disabled mid-transfer Halt new bridging; label in-flight transfers stuck; never assume eventual settlement; documented recovery path
A21 Destination withdraw front-run Third party executes the permissionless ExecuteWithdraw/withdraw first Execution still pays the recorded recipient and amount; bot confirms by hash/balance; no harm, no duplicate accounting
A22 Rate-limit exhaustion A competing operator/bot consumes the per-token period budget Read RateLimit/PeriodUsage before signing; back off; alert; never queue unbounded transfers
A23 Reorg double-spend Source deposit is reorged out after approval Watch for cancel/re-enable, recheck source deposit by hash before executing, and reconcile balances; never re-deposit automatically
A24 Wash / fake volume Bridging back and forth to inflate volume or discounts Not supported; inventory policy forbids circular rebalancing without a real edge; alert on ping-pong patterns
A25 Bridge admin compromise Malicious fee collector, delay change, or token registration Read config every cycle, refuse anomalous fee/delay/token changes beyond bounds, halt and alert

Verification criteria

  • make verify-issue-<n>: unit/route tests, chain fixture tests, bridge client unit tests, pnpm lint, coverage gate, docs link check, and LocalTerra + local-bridge integration suites (explicit SKIP without chain; never a silent pass).
  • docs/qa/issue-<n>/README.md records each AC as PASS/FAIL/SKIP with commands, tx hashes, heights and UTC timestamps. Executed failures remain FAIL; unavailable live checks are explicit SKIP and do not close acceptance.
  • LocalTerra receipts: quote + trade + event-parsed output for 1-hop pool, 1-hop hybrid, multi-hop; LP add/remove; gas_used < gas_wanted; refusal receipts for stale quote, bad chain id, unlisted token, min_return=0.
  • Bridge receipts (local stack preferred, read-only live otherwise): source deposit tx/hash, ComputeWithdrawHash match, approval tx, delay elapsed, execute tx, destination balance delta, fee-collector delta, plus one cancelled/re-enabled transfer showing the delay reset, and one refusal for paused/unregistered/rate-limited.
  • Cross-chain receipts: one rebalance cycle with the cost model printed (fee, both-chain gas, buffer, slippage, margin) and one refused cycle where edge ≤ cost; in-flight exposure and caps shown before/after.
  • amm_arbitrage dry-run receipt: one profitable cycle and one skipped cycle with the cost breakdown.
  • Vendor install receipt from a clean environment (pinned commit/image), plus the upstream PR link and governance/maintenance plan.
  • Existing chains/connectors regression suite unchanged.
  • Source-only verification is not proof of deployment acceptance.

Out of scope

  • Changing CL8Y Bridge itself. Bridge contracts, operator/canceler services, fee/rate-limit policy, token registration, new chain support and the bridge UI stay in code/cl8y-bridge-monorepo with their own issues, invariants and reviews. This issue only consumes the deployed bridge and reports defects there.
  • Atomic cross-chain trading. No design may imply a bridge leg settles within a strategy tick, and no trade/quote route may include bridging.
  • Limit book orders, expiry, parks, claims (the spot connector issue owns those).
  • Custody of third-party/user funds, or bridging on behalf of anyone but the configured trading wallet.
  • New bridge chains or tokens; those are bridge-repo + governance decisions.
  • Perpetuals, options, or lending.
  • Upstream governance outcome (HGP); the vendor path must work regardless.
  • Changes to the DEX contracts or indexer (sibling issue owns the read plane).

Deliverables

  • gateway/src/chains/terraclassic/* and gateway/src/connectors/cl8y/* with route handlers, config schemas, constants and utils.
  • integrations/cl8y_bridge_client/ (bridge config pinning, cost model, hash parity, deposit/approve/execute state machine, reconciliation, operator-API adapter) and packages/crosschain-arb/ (inventory ledger, exposure caps, orchestration).
  • Test suites (unit + route + LocalTerra + local-bridge E2E) and CI wiring; example configs and quote-only dry-run mode.
  • gateway/docs/terraclassic.md, gateway/docs/cl8y.md, docs/runbooks/hummingbot-gateway.md, docs/runbooks/cl8y-bridge-client.md in this repo, skills/AGENTS_HUMMINGBOT_GATEWAY.md (HG1–HG12), skills/AGENTS_CL8Y_BRIDGE_CLIENT.md (BC1–BC10), docs/qa/issue-<n>/README.md, make verify-issue-<n>.
  • Upstream PR + docs PR + governance/maintenance plan; vendor install path.
  • Cross-links to the market-data (#1580) and spot-connector (#1581) issues, and a comment on the bridge repo only if a bridge-side gap is discovered (with a reproduction, not a workaround).

First-pass model recommendation

Recommendation: a high-capability coding model with TypeScript + CosmJS + Solidity/ABI experience and access to both LocalTerra and the bridge monorepo's local development stack. The high-risk areas are signed-route fidelity, chain-id/bridge-address pinning, transfer-hash parity, and the non-atomic inventory accounting; a mistake in any of those moves funds or double-counts exposure.

# Summary Add **Terra Classic chain support to Hummingbot Gateway** plus a **CL8Y DEX connector** (router + AMM), so Hummingbot's DEX strategies — `amm_arbitrage` between a centralized venue and CL8Y, liquidity-provision routines, and cross-chain inventory arbitrage — can trade this venue through Gateway's standardized REST contract instead of a bespoke Python signer. Cross-chain arbitrage is in scope and it uses **CL8Y Bridge** (`https://bridge.cl8y.com`, source `code/cl8y-bridge-monorepo`), not a new bridge built here. The bridge is a lock/attest/delay/execute rail (operator `ApproveWithdraw`, default **300 s** withdrawal delay with canceler oversight, then permissionless `ExecuteWithdraw`), so cross-chain arbitrage is **inventory-based**: pre-position value on both chains, price bridge fee + delay/volatility + cancel risk, and use the bridge for rebalancing only. It is never an atomic leg inside `trade` or `quote`. Gateway today ships exactly two chains (`ethereum`, `solana`) and DEX connectors for those chains only. There is no code path from Hummingbot to a Cosmos/CosmWasm venue, and no bot-facing bridge path. This issue bundles the whole enablement: chain implementation, DEX connector, bridge-aware inventory arbitrage, safety limits, tests against LocalTerra plus the bridge monorepo's local development stack, and an upstream contribution path. Related, but separate: the spot/CLOB connector ([#1581](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1581)) covers resting limit orders and hybrid takers inside the Hummingbot client. This issue covers the Gateway-mediated swap/LP and cross-chain paths. Neither depends on the other to be useful, but both consume the DEX read plane ([#1580](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1580): cached book snapshot, `/markets` discovery). # Community request (anonymized) A community request asked whether Hummingbot could be brought to CL8Y DEX as a distribution channel for bot/strategy flow without marketing spend, and whether bridging between chains could eventually be part of that flow. Do not retain or reproduce handles, timestamps, quotations or any user-identifying information from that request in this issue, code, docs, tests, fixtures, commit messages or logs. # Current codebase ### Gateway (upstream) - TypeScript REST server; `src/chains/{ethereum,solana}` only; `src/connectors/{uniswap,pancakeswap,raydium,orca,meteora,jupiter,dflow,titan,okx,0x}`. - Connector sub-types: **Router** (`quote`, `trade`, `estimateGas`), **AMM** (`poolPrice`, `addLiquidity`, `removeLiquidity`), **CLMM** (positions). - Wallet management with encrypted storage and hardware-wallet support; `pnpm` + Node 18+; per-connector config schemas; interactive Swagger in dev. - Contribution path: fork, implement chain + connector, tests, docs, PR; chain/connector inclusion is governed (HGP) and carries a maintenance commitment. ### CL8Y DEX (this repository) - Terra Classic `columbus-5`, cosmwasm 1.x on a 0.47-era chain; bech32 prefix `cosmos`; gas floor **28.325 uluna/gas**. - Router `ExecuteSwapOperations` with per-hop `hybrid` params; pair `HybridSimulation`/`HybridReverseSimulation`; `provide_liquidity`/`withdraw_liquidity`; LP CW20s (18 decimals); factory pair discovery; `SwapOperation::TerraSwap`. - Zero-LCD route solver: `GET/POST /api/v1/route/solve` → `hops`, `router_operations`, `estimated_amount_out_net`, `optimality_scope`, `snapshot_age_ms`, `quote_kind` (`docs/route-solver.md`, `docs/integrators.md`). - Gas-by-message-shape rules (`skills/AGENTS_TERRACLASSIC_GAS.md`, `skills/AGENTS_HYBRID_LIMIT_GAS.md`). - Fee discounts and treasury routing (`docs/reference/fee-discount-tiers.md`). ### CL8Y Bridge (external system, consumed here — source of truth) - Public UI `https://bridge.cl8y.com`; source `code/cl8y-bridge-monorepo` (Solidity contracts, CosmWasm bridge, Solana program, operator and canceler services, frontend, `multichain-rs` shared crate). - Supported chains and bridge chain keys (bytes4): BSC `56` / `0x00000038`, opBNB `204` / `0x000000cc`, MegaETH `4326` / `0x000010e6`, Terra Classic `columbus-5` / `0x00000001`, Solana `mainnet-beta` / `0x00000005`. - Deployed bridge contracts: EVM proxy `0xb2a22c74da8e3642e0effc107d3ac362ce885369` on BSC and opBNB (identical CREATE3 addresses; ChainRegistry `0x2e5d36…`, TokenRegistry `0x3d8820…`, LockUnlock `0xd7b3bf…`, MintBurn `0x0a1a4b…`, plus the router); Terra Classic bridge `terra18m02l2f43c2dagqnz3kfccpgz9pzzz5hk9l5mh5wvr6dcvv47zfqdfs7la`; Solana bridge program `4XX8ndYXupw4Sb4SsRgAPTmBJJjfZbg8rWjj87iKEhVt` with BridgeConfig PDA `HarAAW2pPcgBwMhcwRsUxRqiDeihCJVjZCmdCWpJbmsD`. - Transfer lifecycle (watchtower): source deposit (EVM `deposit`/`depositNative`, Terra native `Lock`, Terra CW20 `Send { Lock }`) → operator observes and calls `ApproveWithdraw` → **withdrawal delay** (default `300` s, admin-settable 60–86 400 s) → anyone calls `ExecuteWithdraw`/`withdraw`; authorized **cancelers** may `CancelWithdrawApproval` during the delay, and admin `ReenableWithdrawApproval` resets the timer. Reorged deposits are cancelled and re-enabled the same way. - Fees and limits: Terra `Config.fee_bps` / `fee_config.standard_fee_bps` and EVM `getFeeConfig().standardFeeBps`; `min_bridge_amount` / `max_bridge_amount`; per-token `RateLimit` / `PeriodUsage`. ERC20 path pays the fee in `msg.value` at destination; native path deducts it from the bridged amount. - Transfer identity: V2 7-field hash `keccak256(srcChain, destChain, srcAccount, destAccount, destToken, netAmount, nonce)`; queries `ComputeWithdrawHash`, `DepositHash`, `DepositByNonce`, `PendingWithdraw` (all states, single hash), `ActiveWithdrawals` (non-terminal index, `next_start_after`), `WithdrawApproval`, `WithdrawDelay`, `RateLimit`, `PeriodUsage`, `Token`, `Chain`; Terra `SimulateBridge { token, amount, dest_chain_id }` previews the fee. - No bot-facing quote/deposit REST API: bridging is chain transactions plus contract queries. The operator exposes monitoring endpoints only (`/health`, `/status`, `/pending`, `/metrics`; `/pending` is auth-gated by `OPERATOR_API_TOKEN`). - Trust model: watchtower. On-chain hooks (hash, roles, delay) do not provide economic security without honest, monitored operator and canceler processes. - Bridged assets are mint/burn or lock/unlock representations registered per chain in the TokenRegistry; the bridge moves value, it does not create destination liquidity. ### Gaps - No Terra Classic chain in Gateway, no CosmWasm signing path, no CL8Y connector, no AMM/LP support for this venue from any Hummingbot strategy, no local Gateway test harness for this chain. - No bot-facing bridge client: no maintained way to price a transfer, submit a deposit/withdraw, follow approval → delay → execute, or reconcile a cancelled/re-enabled transfer. Cross-chain arbitrage cannot be built safely without that. # Why - **Cross-venue arbitrage is the highest-value bot flow.** `amm_arbitrage` needs a Gateway connector. Without one, CL8Y can only be reached from the client-side spot connector, which does not implement Gateway's AMM/CLMM contract and does not expose LP operations. - **Cross-chain arbitrage is only possible with the bridge.** CL8Y settles on Terra Classic; the venues that hold the other side of a cross-chain arb live on BSC/opBNB/MegaETH/Solana. CL8Y Bridge is already deployed on those chains, so the missing piece is a safe, bounded client that prices the bridge, tracks the delayed withdrawal, and keeps inventory rather than pretending a cross-chain leg is atomic. - **LP automation.** Gateway's AMM methods (`poolPrice`, `addLiquidity`, `removeLiquidity`) let strategy authors rebalance liquidity without writing CosmWasm messages. That directly improves book/pool depth. - **Standardization and safety.** Gateway centralizes wallet custody, gas estimation, and request validation, so every strategy reuses one audited signing path instead of a per-bot script. - **Ecosystem leverage.** A supported chain plus a bridge client benefits every strategy that wants Terra Classic liquidity, not just CL8Y. # Constraints and guardrails 1. **Wallet custody stays in Gateway.** Keys are created/imported through Gateway's existing encrypted wallet store; no mnemonic in cleartext config, logs, URLs, or CLI args. `cl8y` routes must work on loopback only by default and never expose key material. 2. **Chain identity is pinned.** `chainId` must be `columbus-5`; verify against the node on startup and per request when the node reports a different chain; refuse to sign otherwise. Config must not accept an arbitrary `chainId` override in production mode. 3. **Contract allowlist.** Signable targets are limited to configured factory/router/pair/fee-discount/treasury addresses discovered from the factory or the venue manifest, plus the pinned CL8Y Bridge contracts when bridge routes are enabled. No generic "execute arbitrary contract" endpoint, no user-supplied `to`. 4. **Quote/trade agreement.** `trade` must execute the exact route returned by `quote`, with a positive `min_return`/`belief_price` derived from `estimated_amount_out_net` and the caller's slippage bound. Reject stale quotes (`snapshot_age_ms`), degraded quote kinds, and missing execution metadata. Never accept `min_return = 0`. 5. **Simulation before send.** Re-verify the candidate trade with an on-chain `HybridSimulation`/router simulation (bounded) and refuse if simulated output differs from the quote beyond a documented tolerance. 6. **Gas is bounded and derived.** Use message-shape gas envelopes; cap `gas`/`fees` per route; never accept caller-supplied gas that exceeds policy; reject when gas price deviates from the configured floor by more than a bound. 7. **Pause/blacklist/freeze.** Preflight market flags and typed contract errors; no retries on deterministic reverts; surface them as structured errors. 8. **Token semantics.** Only allowlisted tokens with known decimals; community-tax or unknown CW20s refuse by default; `token_info` decimals must match the catalog. 9. **Idempotency and sequence.** Single-flight signing per wallet, cached account state, bounded `code 32` refresh, and request idempotency keys for `trade` so a retried HTTP call cannot double-spend. 10. **Bounded request surface.** Schema-validated payloads (amounts as strings), hard size caps, per-request timeouts, per-route rate limits, and no unbounded batch operations. 11. **Do not fork the upstream wallet or auth model.** Reuse Gateway's wallet/auth/rate-limit facilities; add only what the chain requires. 12. **The bridge is non-atomic — never model it as a swap.** A transfer has ≥`withdraw_delay` (default 300 s) plus operator attestation latency plus destination finality. `quote`/`trade` must never include a bridge leg; cross-chain arbitrage must be an inventory/rebalance strategy with explicit exposure limits. 13. **Bridge contract identity is pinned and verified.** Pinned address per chain, pinned bytes4 chain key, `Status`/`Config` paused check, token enabled check, `Token`/`Chain` registry lookup, `min_bridge_amount`/`max_bridge_amount`, and `RateLimit`/`PeriodUsage`. Never bridge to an unregistered destination token or an unverified address. 14. **Transfer hash parity is computed, never guessed.** Follow the V2 7-field encoding (destination token, net post-fee amount, nonce). Verify `ComputeWithdrawHash` against the local computation before submitting; reconcile from `PendingWithdraw` (all states) and `ActiveWithdrawals`. 15. **The delay window is a risk window.** Treat `ApproveWithdraw` as pending, not settled: watch for `CancelWithdrawApproval`/`ReenableWithdrawApproval` (which resets the timer), never execute before the delay, and never count a bridged amount as balance until `ExecuteWithdraw` commits and the destination balance is confirmed. 16. **Inventory-first.** Pre-position on both chains; bridge only to rebalance when imbalance exceeds a configured threshold and expected edge exceeds bridge fee + both-chain gas + delay/volatility buffer + destination slippage + cancel/operator risk. Hard per-chain and total in-flight caps, plus a max in-flight transfer count. 17. **Do not move user funds.** The bridge client only moves funds from the configured trading wallet(s) under the operator's explicit config and caps. No per-user bridging, no custodial transfers, no automatic bridging triggered by strategy profit alone. 18. **Bridge-side changes belong to the bridge repository.** This issue consumes the deployed bridge. New chains, fee changes, token registration, rate-limit policy, operator/canceler changes and bridge UI work go to `code/cl8y-bridge-monorepo` with its own invariants and reviews. 19. **Docs and anonymity.** No chat text, handles, or operator identities in code/docs/fixtures/logs. Unavailable live checks are explicit SKIP; executed failures remain FAIL. # Relevant files | Area | Files | | --- | --- | | New chain | `gateway/src/chains/terraclassic/` — `terraclassic.ts`, `terraclassic.config.ts`, `terraclassic.constants.ts`, `terraclassic.routes.ts`, wallet/sequence helpers | | New connector | `gateway/src/connectors/cl8y/` — `cl8y.ts`, `cl8y.config.ts`, `cl8y.constants.ts`, `cl8y.utils.ts`, `router-routes/`, `amm-routes/` | | Bridge client (new) | `integrations/cl8y_bridge_client/` — config/address pinning, fee + limit reads, hash computation, deposit/approve/execute state machine, status reconciliation, operator-API adapter | | Cross-chain arb harness | `packages/crosschain-arb/` — cost model, inventory ledger, exposure caps, orchestration, tests | | Chain route registry | `gateway/src/chains/chain.routes.ts`, `gateway/src/schemas/` | | Config + docs | `gateway/src/templates/` (config schema pattern), `gateway/docs/` | | Venue truth | `docs/route-solver.md`, `docs/integrators.md`, `docs/limit-orders.md`, `smartcontracts/packages/dex-common/src/pair.rs`, `smartcontracts/contracts/router/` | | Bridge truth (external repo) | `code/cl8y-bridge-monorepo`: `docs/architecture.md`, `docs/crosschain-flows.md`, `docs/security-model.md`, `docs/operator.md`, `docs/contracts-terraclassic.md`, `docs/contracts-evm.md`, `docs/TERRACLASSIC_BRIDGE_INVARIANTS.md`, `packages/contracts-terraclassic/bridge/src/query.rs`, `packages/contracts-evm/`, `packages/operator/src/api.rs`, `packages/multichain-rs/` | | Gas/fees | `skills/AGENTS_TERRACLASSIC_GAS.md`, `docs/reference/fee-discount-tiers.md` | | Local chain + bridge dev | `scripts/setup-cloud-agent-localterra.sh`, `docs/localterra-sdk53.md`; bridge repo `docs/local-development.md` (anvil + LocalTerra local bridge) | | Policy | `docs/security-model.md`, `docs/supply-chain-security.md` | # Recommended direction ### Phase 1 — chain implementation - `src/chains/terraclassic` using `@cosmjs/stargate` + `@cosmjs/cosmwasm-stargate` (or the current upstream-supported equivalent), with: node info/chain-id assertion, bank balances, CW20 balances via smart query, account number/sequence cache + single-flight, fee estimation from message shape, broadcast + tx result parsing (including wasm events for fills/refunds), and request timeouts. - Config schema: `chainId` (pinned), `nodeUrl`/`lcdUrl` allowlist, `gasPrice` (default `28.325uluna`, bounded override), `gasAdjustment` cap, `expectedBech32Prefix` (`cosmos`), factory/router/fee-discount addresses, token allowlist, per-trade notional cap, `maxOpenOrders`/`maxRoutes` bounds. - Chain routes: `status`, `balances`, `tokens`, `allowances`, `estimateGas`, `poll`, following the existing chain-route shape so the Python client needs no special case. ### Phase 2 — CL8Y connector - **Router**: `quote` from `GET/POST /api/v1/route/solve` (amount in, pool-only and hybrid modes, max hops), returning output, price impact context, route legs, expiry and a route fingerprint; `trade` executes the returned `router_operations` (single-hop pair `Swap` when the route is one hybrid hop, otherwise router `ExecuteSwapOperations`) with caller slippage → `min_return`; `estimateGas` from the documented envelopes. - **AMM**: `poolPrice` from pair `HybridSimulation` (pool-only params) or mirrored reserves; `addLiquidity`/`removeLiquidity` via pair messages with CW20 allowance handling and LP token accounting (18-decimal LP, `MINIMUM_LIQUIDITY` rules documented in `skills/AGENTS_REBALANCE_MINT_UST1_LP.md` and the pair contract). - **CLMM**: not applicable; document explicitly (no concentrated positions) so the Python client does not advertise it. - Route-level validation: path/route id echoed back from `quote`, so `trade` cannot silently substitute a different route. ### Phase 3 — CL8Y Bridge client (read + bounded write) - Bridge config module: pinned per-chain bridge address, bytes4 chain key, destination token registry, decimals, min/max amount, fee source, rate-limit source, delay source. Every value read from chain (Terra `Config`/`FeeConfig`/`WithdrawDelay`/`Token`/`Chain`/`RateLimit`/`PeriodUsage`; EVM `getFeeConfig`/`getCancelWindow`/TokenRegistry), never hardcoded. - Cost model: `bridge_fee = ceil(amount * fee_bps / 10_000)` per the deployed contract, plus both-chain gas, plus a configurable **delay/volatility buffer** (expected price move over `delay + attestation latency`), plus destination venue slippage/depth, plus a cancel/operator-risk margin. Refuse when edge ≤ cost. - Write paths (allowlisted): Terra native `Lock`, Terra CW20 `Send { Lock }`, EVM `deposit`/`depositNative`, destination `ExecuteWithdraw` (Terra) / `withdraw` (EVM). Reject an unregistered destination token, a chain that is disabled/paused, an amount outside min/max, and a rate-limit-exceeding amount before signing. - Transfer state machine persisted per transfer: `quoted → source_deposit_sent → deposit_confirmed → approval_observed → delay_elapsed → withdraw_executed → settled`, with terminal `cancelled`, `reapproved` (delay reset), `stuck`, `failed`. Reconcile from `PendingWithdraw`, `ActiveWithdrawals`, `DepositHash`, EVM events and destination balances; never infer settlement from an approval alone. - Operator monitoring adapter: optional `/status` + `/pending` reads (when `OPERATOR_API_TOKEN` is configured) to detect attestation lag; on lag or cancel events, halt new bridging and alert. Never treat the operator API as authority over chain state. - Safety: per-chain and total inventory caps, max in-flight transfers, max transfer size, per-token allowlist, pause-on-cancel, pause-on-operator-lag, and a manual `bridge kill switch`. ### Phase 4 — cross-chain inventory arbitrage - Separate `crosschain_inventory_arb` component (not shoehorned into `amm_arbitrage`): read CL8Y price (route solver), destination venue price (Gateway connector or CEX), bridge cost/limits, and inventory ledger. Decide between "trade on-chain", "rebalance via bridge", or "do nothing". - Inventory-first policy: trade the local leg only while destination-side and Terra-side inventory stay within configured bands; bridge only the amount needed to restore the band, never the full position. - Exposure accounting: value both legs in a common unit, include bridged-but-not-settled amounts as in-flight exposure (not spendable), and refuse new transfers while in-flight exposure exceeds the cap. - Explicitly document that the bridge cannot close an arb atomically: a 5-minute-plus delay means the strategy must tolerate adverse moves and must not size positions on the assumption that a transfer completes at the quoted price. ### Phase 5 — tests, docs, contribution - Unit + route-level tests with fixtures; LocalTerra integration suite; bridge E2E using the bridge monorepo's local development stack (anvil + LocalTerra, local bridge contracts) when available, otherwise explicit SKIP with a chain-truth fixture. - Docs PR to the gateway/hummingbot-site repos; PR to upstream with a maintenance commitment; vendor path (pinned image/commit) for users not waiting on governance. - Bridge documentation stays in the bridge repo; this repo documents the consumed contract, the cost model, the state machine, and the trust assumptions. # Given / When / Then **Given** a Gateway instance with the `terraclassic` chain and the `cl8y` connector configured, a funded wallet and a running indexer, **When** a strategy calls `quote` for LUNC → USTC and then `trade` with 1% slippage, **Then** `trade` signs exactly the quoted route with a positive `min_return`, uses the documented gas envelope, returns a tx hash, and reports the confirmed output from committed wasm events. **Given** a quote whose reserve snapshot is older than the freshness bound or whose route includes an unknown market flag, **When** `trade` is called, **Then** Gateway refuses with a structured error and does not sign — even if the caller supplies their own `min_return`. **Given** the node reports a chain id other than `columbus-5` (testnet, fork, or a malicious proxy), **When** any signing route is called, **Then** the request fails closed before keys are used, and the failure is visible in the status route. **Given** a CL8Y premium on Terra and a discount on a BSC venue for the bridged asset, both inventories funded, and the bridge not paused, **When** the cross-chain arb component evaluates the opportunity, **Then** it nets the bridge fee, both-chain gas, delay/volatility buffer, destination slippage and cancel risk; if the edge is positive and caps allow, it bridges only the rebalance amount, tracks `deposit → approval → delay → execute → settled`, and refuses to count the amount as spendable until settlement. **Given** the bridge approval is cancelled during the delay window, or the operator stops attesting, or the token/chain is paused or rate-limited, **When** the component would otherwise complete a transfer, **Then** it halts new bridging, marks the transfer `cancelled`/`stuck`, keeps the amount in in-flight exposure (never spendable), and surfaces an operator-visible alert. # Acceptance criteria 1. Gateway starts with the `terraclassic` chain and `cl8y` connector from config alone (documented schema, defaults, validation errors); `status` reports chain id, height, node health and wallet readiness. 2. Chain routes implement balances (bank + CW20), tokens/decimals, allowances, `estimateGas`, and `poll` with the standard response shape. 3. `cl8y.router.quote` returns route legs, expected output, price impact/degradation metadata, route fingerprint, freshness, and expiry; it supports pool-only, hybrid and multi-hop. 4. `cl8y.router.trade` executes only the fingerprinted quote with positive `min_return`; stale/degraded/unknown-market quotes are refused; simulated-vs-quoted deviation beyond tolerance is refused. 5. `estimateGas` matches the documented per-message envelopes within a stated tolerance for swap routes (1-hop pool, 1-hop hybrid, ≥2-hop router), and refuses when the envelope cannot be established. 6. `cl8y.amm.poolPrice`, `addLiquidity`, `removeLiquidity` work end-to-end with correct decimals, LP accounting, allowance handling, and `MINIMUM_LIQUIDITY` behaviour. 7. Contract allowlist is enforced: no route can sign an arbitrary contract, arbitrary message type, or unlisted token; attempts return a structured refusal. 8. Wallet safety: encrypted custody only, no key material in logs/errors/URLs, loopback-only by default, and sequence/idempotency guarantees prevent double-spend on retried `trade` calls. 9. `chainId`/node pinning, pause/blacklist/F6-freeze preflight, gas-price bounds, notional caps, and request size/rate limits are enforced and tested. 10. **Bridge identity and limits come from chain truth**: pinned per-chain bridge address + bytes4 chain key; `Status`/`Config` pause, token/chain enabled, min/max amount, fee bps, `withdraw_delay`, and `RateLimit`/`PeriodUsage` are read and enforced; the client refuses an unregistered destination token or an unverified address. 11. **Bridge cost model is complete**: fee (contract bps) + both-chain gas + configurable delay/volatility buffer + destination depth/slippage + cancel/operator-risk margin; the component refuses when net edge ≤ 0, and the model is unit-tested with a documented worked example. 12. **Bridge lifecycle is reconciled, not assumed**: V2 7-field hash computed locally and checked against `ComputeWithdrawHash`; state machine covers deposit → approval → delay → execute → settled, plus `cancelled`, `reapproved`, `stuck`, `failed`; nothing is spendable before settlement. 13. **Inventory and exposure controls**: per-chain/total caps, max transfer size, max in-flight transfers, per-token allowlist, in-flight exposure counted as non-spendable, and a bridge kill switch; a cancelled or stuck transfer cannot be double-counted or re-spent. 14. **No atomic bridge**: `quote`/`trade` never include a bridge leg; cross-chain arb runs only through the separate inventory component; config cannot enable bridge legs inside `trade`. 15. `amm_arbitrage` CEX↔CL8Y completes a LocalTerra end-to-end cycle in test mode (CEX leg simulated or paper), including a no-trade case below the profit threshold; the cross-chain component completes a local bridge cycle against the bridge monorepo's local stack, or records an explicit SKIP with the reason and a chain-truth fixture receipt. 16. Unit + route tests, coverage gate, and LocalTerra/bridge integration tests pass; `pnpm lint`/`pnpm test` are clean under the upstream toolchain. 17. Docs: chain/connector pages, bridge client page (cost model, state machine, limits, trust assumptions), config reference, examples, limitations (no order book/expiry/claims, no atomic bridge), and a troubleshooting section; upstream PR + governance/maintenance plan and vendor path documented. 18. `make verify-issue-<n>` (repo-local harness) and `docs/qa/issue-<n>/README.md` exist; `skills/AGENTS_HUMMINGBOT_GATEWAY.md` (**HG1–HG12**) and `skills/AGENTS_CL8Y_BRIDGE_CLIENT.md` (**BC1–BC10**) present. 19. No user handles, chat text or operator identities anywhere in the deliverable. # Test plan — all paths | # | Path | Case | Expected | | --- | --- | --- | --- | | T1 | Unit | Chain config validation: missing node, bad chain id, bad gas price, bad bech32 prefix | Actionable refusal at startup | | T2 | Unit | Node reports `columbus-5` / other chain / unreachable | Signing allowed / fail-closed / fail-closed with retry | | T3 | Unit | Balances: bank only, CW20 only, multiple CW20, zero, huge, decimals 6/18 | Exact string amounts, no float loss | | T4 | Unit | `estimateGas` for 1-hop pool, 1-hop hybrid, ≥2 hops, unknown route | Documented envelope / refused | | T5 | Unit | `quote` route fingerprint stability and route substitution attempt in `trade` | Mismatch refused | | T6 | Unit | `min_return=0`, negative, absurdly high, non-integer | 400; no signing | | T7 | Unit | Stale quote by 1 ms under/over bound; degraded `quote_kind`; unknown market flag | Accept at boundary / refuse | | T8 | Unit | Token allowlist: listed, unlisted, unknown decimals, community-tax token | Listed works; others refused with reason | | T9 | Unit | Contract allowlist: factory/router/pair vs arbitrary address, bridge address when bridge disabled | Only allowlisted signs; bridge routes gated | | T10 | Unit | Sequence mismatch `code 32`, concurrent `trade`, retried idempotency key | Single-flight, bounded refresh, exactly one tx | | T11 | Unit | Tx result parsing: success, revert with typed reason, out-of-gas, wasm event fills/hybrid fields | Structured result; no false success | | T12 | Unit | Fee/gas price bounds: at floor, above cap, manipulated low | Accept at floor / refuse | | T13 | Unit | Request schema: huge body, string overflow, extra fields, arrays over cap | 400 with no partial work | | T14 | Integration | LocalTerra swap 1-hop pool and 1-hop hybrid | Chain output matches quote within tolerance | | T15 | Integration | LocalTerra multi-hop router swap | Route legs honoured; output within slippage | | T16 | Integration | Add/remove liquidity, LP balance accounting, minimum liquidity edge | Correct LP amounts; edge refused or handled | | T17 | Integration | Paused pair, blacklisted wallet/token/pair, F6 freeze | Typed refusal; no retry storm | | T18 | Integration | Insufficient gas/CW20/allowance, expired route, node 5xx, timeout | Clear errors; no double spend | | T19 | Integration | `amm_arbitrage` CEX (paper) ↔ CL8Y: profitable, break-even, unprofitable | Trade only when profitable after fees+gas; skip otherwise | | T20 | Bridge unit | Fee/limit config reads: Terra `Config`/`FeeConfig`/`WithdrawDelay`, EVM `getFeeConfig`; boundary amounts at min, min−1, max, max+1 | Values match chain truth; out-of-range refused pre-sign | | T21 | Bridge unit | Paused bridge, disabled chain, disabled token, unregistered destination token, wrong decimals | Refused with typed reason; no signing | | T22 | Bridge unit | Hash: V2 7-field encoding vs `ComputeWithdrawHash` fixtures (Terra→EVM, EVM→Terra, native + CW20 + ERC20), wrong token/side/nonce | Exact match; any mismatch refused | | T23 | Bridge unit | Cost model: fee-only, gas-only, delay buffer dominates, negative edge, rounding up, zero amount | Correct arithmetic with ceiling; refuse non-positive edge | | T24 | Bridge unit | Rate limit/period usage at boundary; amount exceeding remaining period budget | Refused before signing | | T25 | Bridge integration | Local bridge (bridge repo local dev): Terra→EVM lock/deposit → approval → delay → execute; balances and fee collector delta | Settled once; fee matches config; no double withdraw | | T26 | Bridge integration | EVM→Terra deposit → `ApproveWithdraw` → delay → `ExecuteWithdraw`; CW20 and native paths | Settled once; correct recipient and amount | | T27 | Bridge integration | Cancel during delay, then re-enable (delay resets); execute attempt after re-enable before delay | Refused until new delay elapses; state `reapproved` | | T28 | Bridge integration | Delay boundary: execute at delay−1 s and delay+1 s | Revert `WithdrawDelayNotElapsed` then success | | T29 | Bridge integration | Duplicate hash / reused nonce / duplicate execute | `NonceAlreadyUsed`/replay refused; no double spend | | T30 | Bridge integration | Operator not attesting (lag), operator API unavailable, `pending` auth failure | Halt new bridging; existing transfer stays `stuck`; alert; no retry storm | | T31 | Cross-chain | Inventory band: local trade only, rebalance only, no-op; caps hit; in-flight exposure counted | Correct decision per worked example; no overspend | | T32 | Cross-chain | Price moves adversely during delay beyond buffer | Loss bounded by configured caps and buffer; alert; inventory band respected | | T33 | Regression | Existing ethereum/solana chains and connectors | Unaffected | | T34 | Ops | Loopback-only default, remote bind refusal, docs for tunnel | Refuses insecure remote exposure | | T35 | Deploy | Vendor image/pinned commit install; upstream PR build | Reproducible build; no network at runtime | # Adversarial test plan — attack, hack, abuse | # | Vector | Attack | Required behaviour | | --- | --- | --- | --- | | A1 | Fund drainer | Abuse `trade` with attacker-supplied contract address or message type | Allowlist + typed message builders only; no generic execute | | A2 | Quote substitution | Caller reuses a fingerprint with different route/amounts to get a better signed trade | Fingerprint binds route, amounts, tokens, expiry, slippage; mismatch refused | | A3 | Stale/malicious data source | Compromised indexer inflates output to induce a bad trade | On-chain simulation cross-check, freshness bound, deviation tolerance, pinned endpoints | | A4 | Chain-id confusion | Testnet/fork/malicious proxy replays mainnet expectations | Pinned `columbus-5`, node verification per request, fail closed | | A5 | Sandwich / MEV | Pending arb/manage tx is front-run on a public mempool | Slippage floors, bounded size, timing jitter, notional caps, documented exposure | | A6 | Double spend | Retried HTTP request or duplicate idempotency key creates two trades | Request idempotency key + sequence single-flight + tx-hash dedupe | | A7 | Key theft | Local file/process/log/endpoint exposure of the Gateway wallet | Encrypted store, loopback-only, redaction tests, no key endpoints, auth on non-loopback | | A8 | Malicious token | CW20 with hidden fee/blacklist/rebase or fake `token_info` | Allowlist + on-chain `token_info` check + refuse unknown semantics | | A9 | Gas griefing | Caller requests huge gas to burn funds, or node under-reports gas | Policy cap, message-shape envelope, min gas floor, refuse anomalies | | A10 | Reorg / false confirmation | Treat a reorged tx as final and trade again | Confirmation policy with height finality; recheck balances before next trade | | A11 | Rate-limit / resource exhaustion | Flood `quote` to exhaust the indexer budget or Gateway CPU | Per-route limits, timeouts, bounded solver params, backpressure | | A12 | Governance bypass | Retry through pause/blacklist/freeze with a different route shape | Preflight flags on every route; no bypass path | | A13 | Supply chain | Malicious npm dependency in the chain/connector | Pinned lockfile + audit in CI, reviewed deps, no postinstall scripts | | A14 | Log/telemetry leakage | Wallet address ↔ person mapping or amounts leaked | Minimal structured logs, no user identifiers, documented retention | | A15 | Fake bridge approval / forged deposit | Malicious or compromised operator attests a deposit that never happened; bot credits inventory early | Bot never treats approval as settlement; verifies the V2 hash against the source chain deposit and destination balance after execute; only tracks transfers it initiated | | A16 | Recipient substitution | Approval or deposit redirects funds to an attacker address | Hash binds source account, destination account, destination token and net amount; any deviation refused and alerted | | A17 | Bridge address spoofing | Config or an injected payload swaps in a lookalike bridge contract or chain key | Pinned address + bytes4 chain key, verified `Config`/`Status`, no config override at runtime | | A18 | Bridged-token spoofing | A fake bridged token or wrong token mapping is used as the destination leg | TokenRegistry/`Token` lookup, decimals + contract pinning, allowlist; refuse unregistered mints | | A19 | Cancel-window griefing | A canceler (or a malicious role) cancels approvals to delay funds, or a false positive blocks execution | Cancel detected, state `cancelled`, in-flight exposure retained, alert, no blind retry; re-enable path requires fresh delay and operator review | | A20 | Bridge pause / emergency | Admin pauses the bridge, or a chain is disabled mid-transfer | Halt new bridging; label in-flight transfers `stuck`; never assume eventual settlement; documented recovery path | | A21 | Destination withdraw front-run | Third party executes the permissionless `ExecuteWithdraw`/`withdraw` first | Execution still pays the recorded recipient and amount; bot confirms by hash/balance; no harm, no duplicate accounting | | A22 | Rate-limit exhaustion | A competing operator/bot consumes the per-token period budget | Read `RateLimit`/`PeriodUsage` before signing; back off; alert; never queue unbounded transfers | | A23 | Reorg double-spend | Source deposit is reorged out after approval | Watch for cancel/re-enable, recheck source deposit by hash before executing, and reconcile balances; never re-deposit automatically | | A24 | Wash / fake volume | Bridging back and forth to inflate volume or discounts | Not supported; inventory policy forbids circular rebalancing without a real edge; alert on ping-pong patterns | | A25 | Bridge admin compromise | Malicious fee collector, delay change, or token registration | Read config every cycle, refuse anomalous fee/delay/token changes beyond bounds, halt and alert | # Verification criteria - `make verify-issue-<n>`: unit/route tests, chain fixture tests, bridge client unit tests, `pnpm lint`, coverage gate, docs link check, and LocalTerra + local-bridge integration suites (explicit SKIP without chain; never a silent pass). - `docs/qa/issue-<n>/README.md` records each AC as PASS/FAIL/SKIP with commands, tx hashes, heights and UTC timestamps. Executed failures remain FAIL; unavailable live checks are explicit SKIP and do not close acceptance. - LocalTerra receipts: quote + trade + event-parsed output for 1-hop pool, 1-hop hybrid, multi-hop; LP add/remove; `gas_used < gas_wanted`; refusal receipts for stale quote, bad chain id, unlisted token, `min_return=0`. - Bridge receipts (local stack preferred, read-only live otherwise): source deposit tx/hash, `ComputeWithdrawHash` match, approval tx, delay elapsed, execute tx, destination balance delta, fee-collector delta, plus one cancelled/re-enabled transfer showing the delay reset, and one refusal for paused/unregistered/rate-limited. - Cross-chain receipts: one rebalance cycle with the cost model printed (fee, both-chain gas, buffer, slippage, margin) and one refused cycle where edge ≤ cost; in-flight exposure and caps shown before/after. - `amm_arbitrage` dry-run receipt: one profitable cycle and one skipped cycle with the cost breakdown. - Vendor install receipt from a clean environment (pinned commit/image), plus the upstream PR link and governance/maintenance plan. - Existing chains/connectors regression suite unchanged. - Source-only verification is not proof of deployment acceptance. # Out of scope - **Changing CL8Y Bridge itself.** Bridge contracts, operator/canceler services, fee/rate-limit policy, token registration, new chain support and the bridge UI stay in `code/cl8y-bridge-monorepo` with their own issues, invariants and reviews. This issue only consumes the deployed bridge and reports defects there. - **Atomic cross-chain trading.** No design may imply a bridge leg settles within a strategy tick, and no `trade`/`quote` route may include bridging. - Limit book orders, expiry, parks, claims (the spot connector issue owns those). - Custody of third-party/user funds, or bridging on behalf of anyone but the configured trading wallet. - New bridge chains or tokens; those are bridge-repo + governance decisions. - Perpetuals, options, or lending. - Upstream governance outcome (HGP); the vendor path must work regardless. - Changes to the DEX contracts or indexer (sibling issue owns the read plane). # Deliverables - `gateway/src/chains/terraclassic/*` and `gateway/src/connectors/cl8y/*` with route handlers, config schemas, constants and utils. - `integrations/cl8y_bridge_client/` (bridge config pinning, cost model, hash parity, deposit/approve/execute state machine, reconciliation, operator-API adapter) and `packages/crosschain-arb/` (inventory ledger, exposure caps, orchestration). - Test suites (unit + route + LocalTerra + local-bridge E2E) and CI wiring; example configs and `quote`-only dry-run mode. - `gateway/docs/terraclassic.md`, `gateway/docs/cl8y.md`, `docs/runbooks/hummingbot-gateway.md`, `docs/runbooks/cl8y-bridge-client.md` in this repo, `skills/AGENTS_HUMMINGBOT_GATEWAY.md` (**HG1–HG12**), `skills/AGENTS_CL8Y_BRIDGE_CLIENT.md` (**BC1–BC10**), `docs/qa/issue-<n>/README.md`, `make verify-issue-<n>`. - Upstream PR + docs PR + governance/maintenance plan; vendor install path. - Cross-links to the market-data ([#1580](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1580)) and spot-connector ([#1581](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1581)) issues, and a comment on the bridge repo only if a bridge-side gap is discovered (with a reproduction, not a workaround). # First-pass model recommendation Recommendation: a high-capability coding model with TypeScript + CosmJS + Solidity/ABI experience and access to both LocalTerra and the bridge monorepo's local development stack. The high-risk areas are signed-route fidelity, chain-id/bridge-address pinning, transfer-hash parity, and the non-atomic inventory accounting; a mistake in any of those moves funds or double-counts exposure.
PlasticDigits changed title from feat(integrations): Hummingbot Gateway Terra Classic chain and CL8Y router/AMM connector to feat(integrations): Hummingbot Gateway Terra Classic chain, CL8Y router/AMM connector and bridge-backed cross-chain arbitrage 2026-10-29 00:37:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/cl8y-dex-terraclassic#1582
No description provided.