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

Commitbc1b18d

Browse files
committed
Update uniswap.py
bug fixes when building and pushing transactions
1 parenta477a71 commitbc1b18d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎uniswap/uniswap.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def _get_token_token_input_price(
331331
returnint(self._get_token_eth_input_price(token0,qty,fee))
332332

333333
route= [token0,self.get_weth_address(),token1]
334-
logger.warning(f"No route specified, assuming route:{route}")
334+
#logger.warning(f"No route specified, assuming route: {route}")
335335

336336
ifself.version==2:
337337
price:int=self.router.functions.getAmountsOut(qty,route).call()[-1]
@@ -418,7 +418,7 @@ def _get_token_token_output_price(
418418
returnint(self._get_token_eth_output_price(token0,Wei(qty),fee))
419419

420420
route= [token0,self.get_weth_address(),token1]
421-
logger.warning(f"No route specified, assuming route:{route}")
421+
#logger.warning(f"No route specified, assuming route: {route}")
422422

423423
ifself.version==2:
424424
price:int=self.router.functions.getAmountsIn(qty,route).call()[0]
@@ -535,7 +535,7 @@ def simulate_trade(
535535
fee_on_transfer:bool=False,
536536
)->HexBytes:
537537
quote_token_decimals=self.get_token(quote_token).decimals
538-
exchange_rate=self.get_price_input(base_token,quote_token,int(10**quote_token_decimals))
538+
exchange_rate=self.get_raw_price(base_token,quote_token)
539539
amount_out=exchange_rate*qty* (10**quote_token_decimals)
540540
fee=qty*self.get_fee_taker
541541

@@ -1654,9 +1654,9 @@ def _deadline(self) -> int:
16541654
def_build_txn(
16551655
self,function:ContractFunction,tx_params:Optional[TxParams]=None
16561656
)->HexBytes:
1657-
"""Build transaction."""
16581657
ifnottx_params:
16591658
tx_params=self._get_tx_params()
1659+
"""Build transaction."""
16601660
transaction=function.build_transaction(tx_params)
16611661

16621662
if"gas"notintx_params:
@@ -1688,11 +1688,13 @@ def _send_txn(
16881688
self.last_nonce=Nonce(tx_params["nonce"]+1)
16891689

16901690
def_build_and_send_tx(
1691-
self,transaction,tx_params:Optional[TxParams]=None
1691+
self,function:ContractFunction,tx_params:Optional[TxParams]=None
16921692
)->HexBytes:
1693+
ifnottx_params:
1694+
tx_params=self._get_tx_params()
16931695
"""Build and send a transaction."""
16941696
transaction=self._build_txn(function,tx_params)
1695-
return_send_txn(transaction,tx_params)
1697+
returnself._send_txn(transaction,tx_params)
16961698

16971699
def_get_tx_params(
16981700
self,value:Wei=Wei(0),gas:Optional[Wei]=None

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp