Skip to content

feat(examples): Add Polygon and Arbitrum support to simulation examples#998

Open
tvinagre wants to merge 2 commits into
mainfrom
tl/ENG-5644-add-polygon-arbitrum-examples
Open

feat(examples): Add Polygon and Arbitrum support to simulation examples#998
tvinagre wants to merge 2 commits into
mainfrom
tl/ENG-5644-add-polygon-arbitrum-examples

Conversation

@tvinagre
Copy link
Copy Markdown
Collaborator

@tvinagre tvinagre commented May 7, 2026

Summary

  • Add Chain::Polygon support to price_printer and quickstart examples with exchanges: uniswap_v2, quickswap_v2, uniswap_v3, uniswap_v4
  • Add Chain::Arbitrum support with exchanges: uniswap_v2, uniswap_v3, pancakeswap_v3, uniswap_v4
  • Auto-detect TLS based on TYCHO_API_KEY presence — when unset, uses plain HTTP/WS and prints a warning, enabling local indexer usage
  • Add default buy/sell tokens for Polygon (USDC → WPOL) and Arbitrum (USDC → WETH) in quickstart

ENG-5644 ENG-5612

Test plan

  • cargo check passes for both examples
  • Tested price_printer against local Polygon indexer at localhost:4242
  • Verify quickstart works end-to-end against a Polygon/Arbitrum indexer

🤖 Generated with Claude Code

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@tvinagre tvinagre force-pushed the tl/ENG-5644-add-polygon-arbitrum-examples branch from 5c43e2e to 01ef7c6 Compare May 7, 2026 15:16
Comment on lines +115 to +119
let tycho_api_key: Option<String> = env::var("TYCHO_API_KEY").ok();
let no_tls = tycho_api_key.is_none();
if no_tls {
eprintln!("Warning: TYCHO_API_KEY not set. Using plain HTTP/WS (no TLS).");
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's overkill and not safe. Only useful when using on a local tycho instance no?

If yes then I'd rather make it a cli arg to manually disable it than risking external people using no TLS without noticing just because they forgot to set an env variable

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only useful when using on a local tycho instance no?
Yes, for self-hosted or port-forwarded cases

tvinagre and others added 2 commits May 13, 2026 01:07
Add Chain::Polygon and Chain::Arbitrum arms to price_printer and
quickstart examples with their available exchanges. Auto-detect TLS
based on TYCHO_API_KEY presence to support local indexer instances.

ENG-5644 ENG-5612

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… flag

Addresses PR review: auto-detecting TLS from TYCHO_API_KEY absence
risks users accidentally running without TLS. Now requires an explicit
--no-tls flag, with a warning when disabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tvinagre tvinagre force-pushed the tl/ENG-5644-add-polygon-arbitrum-examples branch from f0cdb9c to 4a0729e Compare May 13, 2026 00:07
Comment on lines +119 to +122
let no_tls = cli.no_tls;
if no_tls {
eprintln!("Warning: TLS is disabled. Only use this for local/self-hosted Tycho instances.");
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intermediate var is pretty shallow tbh... I would skip it and just use cli.no_tls directly.

Suggested change
let no_tls = cli.no_tls;
if no_tls {
eprintln!("Warning: TLS is disabled. Only use this for local/self-hosted Tycho instances.");
}
if cli.no_tls {
eprintln!("Warning: TLS is disabled. Only use this for local/self-hosted Tycho instances.");
}

Comment on lines -104 to -105
// Perform an early check to ensure `RPC_URL` is set.
// This prevents errors from occurring later during UI interactions for curve.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this? I like that this indicated to new users that this is needed for curve specifically.

Comment on lines +139 to +142
let no_tls = cli.no_tls;
if no_tls {
eprintln!("Warning: TLS is disabled. Only use this for local/self-hosted Tycho instances.");
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants