Skip to content

Commit

Permalink
Fix the balance calcuations of the 1inch eth pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
valo committed Jan 10, 2021
1 parent 4d268b2 commit 40e6c09
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ def priceOf1InchPair(oneinch_pair: interface.IMooniswap, router_address: str):

if token0 == "0x0000000000000000000000000000000000000000":
token0 = WETH
token0Reserves = oneinch_pair.balance()
else:
token0 = interface.IERC20(token0)
token0Reserves = token0.balanceOf(oneinch_pair)

if token1 == "0x0000000000000000000000000000000000000000":
token1 = WETH
token1Reserves = oneinch_pair.balance()
else:
token1 = interface.IERC20(token1)
token1Reserves = token1.balanceOf(oneinch_pair)

token0Reserves = token0.balanceOf(oneinch_pair)
token1Reserves = token1.balanceOf(oneinch_pair)

token0Price = priceOf(token0, router_address)
token1Price = priceOf(token1, router_address)
Expand Down

0 comments on commit 40e6c09

Please sign in to comment.