Skip to content

Develop#50

Merged
noymaxx merged 9 commits into
mainfrom
develop
Mar 29, 2026
Merged

Develop#50
noymaxx merged 9 commits into
mainfrom
develop

Conversation

@noymaxx
Copy link
Copy Markdown
Contributor

@noymaxx noymaxx commented Mar 29, 2026

No description provided.

noymaxx added 9 commits March 25, 2026 20:13
Adds executionTimeout() route-level middleware that enforces a 15s
hard deadline on prepare/quote handlers. If the handler doesn't
respond within the timeout, a 504 EXECUTION_TIMEOUT is sent.

Applied to 17 endpoints across 6 route files:
- swap: /quote, /prepare
- staking: /prepare-enter, /prepare-exit, /prepare-claim
- avax-swap: /quote, /prepare
- avax-lending: /prepare-supply, /prepare-redeem, /prepare-borrow, /prepare-repay
- avax-liquid-staking: /prepare-stake, /prepare-request-unlock, /prepare-redeem
- dca: /prepare-create, /prepare-cancel

Prevents silent hangs when RPCs are congested and never respond.
…ross all Base chain modules

Adds 8 new error codes to errorCodes.ts:
- INSUFFICIENT_BALANCE (400), INSUFFICIENT_LP_BALANCE (400)
- NO_LIQUIDITY (400), NO_LP_POSITION (400), NO_REWARDS (400)
- EXECUTOR_NOT_CONFIGURED (500)
- ORDER_UNAUTHORIZED (403), ORDER_INACTIVE (400)

Converts ~20 raw throw new Error() to throw new AppError() in:
- prepare-enter-strategy, prepare-exit-strategy, prepare-claim-rewards
- get-quote, prepare-cancel-order, get-orders
- aerodrome-swap, aerodrome.service, swap-provider, protocols

Before: all Base chain errors returned generic 500 INTERNAL_ERROR.
After: semantic HTTP status codes (400/403/404/502) with structured
error bodies matching the Avalanche modules pattern.
Adds config/demo.ts with:
- Pinned contract addresses (Executor, Adapter, DCAVault)
- Pinned Aerodrome protocol addresses (Router, Factory, Voter)
- Canonical demo flow: ETH swap → Add Liquidity → Stake → Claim → Exit
- Demo tokens and pool references for WETH/USDC volatile
- isDemoMode() helper (NODE_ENV=demo or DEMO_MODE=true)
- Wider timeouts (20s exec, 5s RPC) and slippage (2%) for live demos

Updates .env.example with:
- BASE_RPC_URLS / AVAX_RPC_URLS multi-RPC documentation
- AVAX_EXECUTOR_ADDRESS placeholder
- NODE_ENV options (development/demo/production)
- DEMO_MODE flag
- ALLOWED_ORIGINS documentation
Adds hexagonal architecture ports for future bridge integration:

types/cross-chain.ts — Shared types:
  - MessagingProtocol (wormhole | ccip | layerzero | lifi)
  - MessageStatus (pending → confirming → relayed → executed | failed)
  - CrossChainRoute, CrossChainFee, ExecuteRouteResult, etc.

domain/ports/CrossChainMessagingPort.ts — Single protocol adapter:
  - getRoutes(): find routes for a source→dest transfer
  - estimateFee(): lightweight fee estimation
  - executeRoute(): prepare unsigned transactions
  - getMessageStatus(): track in-flight messages

domain/ports/RoutingPort.ts — Multi-protocol aggregator:
  - getRoutes(): queries all messaging adapters, returns best route
  - executeRoute(): delegates to the correct adapter
  - getRouteStatus(): track status

Interface only — no implementation. Future adapters (Wormhole, CCIP,
LayerZero, LI.FI) will implement CrossChainMessagingPort.
H10 — config/wallet-roles.ts:
  - Documents 4 wallet roles: USER, USER_ADAPTER, DCA_EXECUTOR, TREASURY
  - Defines per-transaction limits for DCA executor (0.5 ETH max single, 5 ETH session)
  - ExecutionAuditEntry interface for DCA action logging

H11 — DEPLOY_CHECKLIST.md:
  - Pre-deploy: contract addresses, RPC endpoints, schema alignment, rate limits
  - Deploy steps: tag, build, health check, smoke test
  - Post-deploy: verification steps and rollback procedure
@noymaxx noymaxx merged commit f4ff7f7 into main Mar 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant