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

Appearance settings

Commit f7ef9fc

Browse filesBrowse files
authored
fix: typing issues in uniswap.py (#214)
1 parent 06e95ac commit f7ef9fc
Copy full SHA for f7ef9fc

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎uniswap/uniswap.py

Copy file name to clipboardExpand all lines: uniswap/uniswap.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33
import logging
44
import functools
5-
from typing import List, Any, Optional, Union, Tuple, Dict
5+
from typing import List, Any, Optional, Union, Tuple, Dict, Iterable
66

77
from web3 import Web3
88
from web3.eth import Contract
@@ -1256,7 +1256,7 @@ def get_raw_price(
12561256
token_out = self.get_weth_address()
12571257

12581258
if self.version == 2:
1259-
params = [
1259+
params: Iterable[Union[ChecksumAddress,Optional[int]]] = [
12601260
self.w3.toChecksumAddress(token_in),
12611261
self.w3.toChecksumAddress(token_out),
12621262
]
@@ -1337,7 +1337,7 @@ def estimate_price_impact(
13371337
return 1
13381338

13391339
if price_small == 0:
1340-
# Occures when `token_out` amount in the pool equals 0
1340+
# Occurs when `token_out` amount in the pool equals 0
13411341
return 1
13421342
try:
13431343
cost_amount = self.get_price_input(
@@ -1351,7 +1351,7 @@ def estimate_price_impact(
13511351
cost_amount / (amount_in / (10 ** self.get_token(token_in).decimals))
13521352
) / 10 ** self.get_token(token_out).decimals
13531353

1354-
return (price_small - price_amount) / price_small
1354+
return float((price_small - price_amount) / price_small)
13551355

13561356
# ------ Exchange ------------------------------------------------------------------
13571357
@supports([1, 2])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.