diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66111f9..bf7146b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ env: # Public key for PRs, plz don't abuse PROVIDER_MAINNET: ${{ secrets.MAINNET_PROVIDER || 'https://mainnet.infura.io/v3/42ffb4f2549c4a5fa3b5d6db70f6fad1' }} PROVIDER_ARBITRUM: 'https://rpc.ankr.com/arbitrum' + PROVIDER_POLYGON: 'https://rpc.ankr.com/polygon' PROVIDER_XDAI: 'https://rpc.ankr.com/gnosis' jobs: @@ -24,15 +25,12 @@ jobs: include: - network: arbitrum uniswap-version: 3 - #include: + - network: polygon + uniswap-version: 3 # - network: xdai # uniswap-version: 3 - #include: # - network: optimism # uniswap-version: 3 - #include: - # - network: polygon - # uniswap-version: 3 steps: - uses: actions/checkout@v2 @@ -74,7 +72,7 @@ jobs: - name: Test env: # Use the secret if available, otherwise fallback to the public key - PROVIDER: ${{ ((matrix.network == 'mainnet') && env.PROVIDER_MAINNET) || ((matrix.network == 'arbitrum') && env.PROVIDER_ARBITRUM) }} + PROVIDER: ${{ ((matrix.network == 'mainnet') && env.PROVIDER_MAINNET) || ((matrix.network == 'arbitrum') && env.PROVIDER_ARBITRUM) || ((matrix.network == 'polygon') && env.PROVIDER_POLYGON) }} UNISWAP_VERSION: ${{ matrix.uniswap-version }} run: | make test diff --git a/uniswap/cli.py b/uniswap/cli.py index 76e18dd..6f9f408 100644 --- a/uniswap/cli.py +++ b/uniswap/cli.py @@ -109,9 +109,18 @@ def tokendb(ctx: click.Context, metadata: bool) -> None: """List known token addresses""" uni: Uniswap = ctx.obj["UNISWAP"] for symbol, addr in get_tokens(uni.netname).items(): - if metadata and addr != "0x0000000000000000000000000000000000000000": + if ( + metadata + and addr != "0x0000000000000000000000000000000000000000" # ETH + and addr != "0x0000000000000000000000000000000000001010" # MATIC + ): data = uni.get_token(_str_to_addr(addr)) - assert data.symbol.lower() == symbol.lower() + if data.symbol.lower() != symbol.lower(): + logger.warning( + "Requested symbol '%s' doesn't agree with contract symbol '%s'", + symbol, + data.symbol, + ) click.echo(data) else: click.echo(BaseToken(symbol, addr)) diff --git a/uniswap/tokens.py b/uniswap/tokens.py index 551b77e..fa02677 100644 --- a/uniswap/tokens.py +++ b/uniswap/tokens.py @@ -37,6 +37,31 @@ }.items() } +tokens_xdai: Dict[str, ChecksumAddress] = { + k: Web3.toChecksumAddress(v) + for k, v in { + "XDAI": "0x0000000000000000000000000000000000000000", + "WXDAI": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", + "ETH": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1", # WETH + "WETH": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1", + "DAI": "0x44fa8e6f47987339850636f88629646662444217", # bridged DAI + "USDC": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83", + "UNI": "0x4537e328bf7e4efa29d05caea260d7fe26af9d74", + }.items() +} + +tokens_polygon: Dict[str, ChecksumAddress] = { + k: Web3.toChecksumAddress(v) + for k, v in { + "MATIC": "0x0000000000000000000000000000000000001010", + "ETH": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", # WETH + "WETH": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + "UNI": "0xb33eaad8d922b1083446dc23f610c2567fb5180f", + "DAI": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + "USDC": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + }.items() +} + def get_tokens(netname: str) -> Dict[str, ChecksumAddress]: """ @@ -49,5 +74,9 @@ def get_tokens(netname: str) -> Dict[str, ChecksumAddress]: return tokens_rinkeby elif netname == "arbitrum": return tokens_arbitrum + elif netname == "xdai": + return tokens_xdai + elif netname == "polygon": + return tokens_polygon else: - raise Exception(f"Unknown net '{netname}'") + raise Exception(f"Unknown net '{netname}' for tokendb") pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy