Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fad544

Browse files
committed
test: added tests for polygon
1 parentf74d23a commit8fad544

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

‎.github/workflows/test.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
# Public key for PRs, plz don't abuse
1111
PROVIDER_MAINNET:${{ secrets.MAINNET_PROVIDER || 'https://mainnet.infura.io/v3/42ffb4f2549c4a5fa3b5d6db70f6fad1' }}
1212
PROVIDER_ARBITRUM:'https://rpc.ankr.com/arbitrum'
13+
PROVIDER_POLYGON:'https://rpc.ankr.com/polygon'
1314
PROVIDER_XDAI:'https://rpc.ankr.com/gnosis'
1415

1516
jobs:
@@ -24,15 +25,12 @@ jobs:
2425
include:
2526
-network:arbitrum
2627
uniswap-version:3
27-
#include:
28+
-network:polygon
29+
uniswap-version:3
2830
# - network: xdai
2931
# uniswap-version: 3
30-
#include:
3132
# - network: optimism
3233
# uniswap-version: 3
33-
#include:
34-
# - network: polygon
35-
# uniswap-version: 3
3634

3735
steps:
3836
-uses:actions/checkout@v2
@@ -74,7 +72,7 @@ jobs:
7472
-name:Test
7573
env:
7674
# Use the secret if available, otherwise fallback to the public key
77-
PROVIDER:${{ ((matrix.network == 'mainnet') && env.PROVIDER_MAINNET) || ((matrix.network == 'arbitrum') && env.PROVIDER_ARBITRUM) }}
75+
PROVIDER:${{ ((matrix.network == 'mainnet') && env.PROVIDER_MAINNET) || ((matrix.network == 'arbitrum') && env.PROVIDER_ARBITRUM)|| ((matrix.network == 'polygon') && env.PROVIDER_POLYGON)}}
7876
UNISWAP_VERSION:${{ matrix.uniswap-version }}
7977
run:|
8078
make test

‎uniswap/cli.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,18 @@ def tokendb(ctx: click.Context, metadata: bool) -> None:
109109
"""List known token addresses"""
110110
uni:Uniswap=ctx.obj["UNISWAP"]
111111
forsymbol,addringet_tokens(uni.netname).items():
112-
ifmetadataandaddr!="0x0000000000000000000000000000000000000000":
112+
if (
113+
metadata
114+
andaddr!="0x0000000000000000000000000000000000000000"# ETH
115+
andaddr!="0x0000000000000000000000000000000000001010"# MATIC
116+
):
113117
data=uni.get_token(_str_to_addr(addr))
114-
assertdata.symbol.lower()==symbol.lower()
118+
ifdata.symbol.lower()!=symbol.lower():
119+
logger.warning(
120+
"Requested symbol '%s' doesn't agree with contract symbol '%s'",
121+
symbol,
122+
data.symbol,
123+
)
115124
click.echo(data)
116125
else:
117126
click.echo(BaseToken(symbol,addr))

‎uniswap/tokens.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,31 @@
3737
}.items()
3838
}
3939

40+
tokens_xdai:Dict[str,ChecksumAddress]= {
41+
k:Web3.toChecksumAddress(v)
42+
fork,vin {
43+
"XDAI":"0x0000000000000000000000000000000000000000",
44+
"WXDAI":"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
45+
"ETH":"0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1",# WETH
46+
"WETH":"0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1",
47+
"DAI":"0x44fa8e6f47987339850636f88629646662444217",# bridged DAI
48+
"USDC":"0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
49+
"UNI":"0x4537e328bf7e4efa29d05caea260d7fe26af9d74",
50+
}.items()
51+
}
52+
53+
tokens_polygon:Dict[str,ChecksumAddress]= {
54+
k:Web3.toChecksumAddress(v)
55+
fork,vin {
56+
"MATIC":"0x0000000000000000000000000000000000001010",
57+
"ETH":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",# WETH
58+
"WETH":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
59+
"UNI":"0xb33eaad8d922b1083446dc23f610c2567fb5180f",
60+
"DAI":"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
61+
"USDC":"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
62+
}.items()
63+
}
64+
4065

4166
defget_tokens(netname:str)->Dict[str,ChecksumAddress]:
4267
"""
@@ -49,5 +74,9 @@ def get_tokens(netname: str) -> Dict[str, ChecksumAddress]:
4974
returntokens_rinkeby
5075
elifnetname=="arbitrum":
5176
returntokens_arbitrum
77+
elifnetname=="xdai":
78+
returntokens_xdai
79+
elifnetname=="polygon":
80+
returntokens_polygon
5281
else:
53-
raiseException(f"Unknown net '{netname}'")
82+
raiseException(f"Unknown net '{netname}' for tokendb")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp