Skip to content

Commit

Permalink
fix: uniswap v1
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Jul 9, 2021
1 parent 2164762 commit b166c2d
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build/lib/ypricemagic/uniswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def get_price_v1(asset, block=None):
factory = Contract("0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95")
try:
asset = Contract(asset)
exchange = interface.UniswapV1Exchange(factory.getExchange(asset))
exchange = Contract(factory.getExchange(asset))
eth_bought = exchange.getTokenToEthInputPrice(10 ** asset.decimals(), block_identifier=block)
exchange = interface.UniswapV1Exchange(factory.getExchange(usdc))
exchange = Contract(factory.getExchange(usdc))
usdc_bought = exchange.getEthToTokenInputPrice(eth_bought, block_identifier=block) / 1e6
fees = 0.997 ** 2
return usdc_bought / fees
Expand Down
Binary file removed dist/ypricemagic-0.1.1.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/ypricemagic-0.1.2.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='ypricemagic',
packages=find_packages(),
version='0.1.1',
version='0.1.2',
description='Use this tool to extract historical on-chain price data from an archive node. Shoutout to @bantg and @nymmrx for their awesome work on yearn-exporter that made this library possible.',
author='BobTheBuidler',
author_email = 'bobthebuidlerdefi@gmail.com',
Expand Down
2 changes: 1 addition & 1 deletion ypricemagic.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: ypricemagic
Version: 0.1.1
Version: 0.1.2
Summary: Use this tool to extract historical on-chain price data from an archive node. Shoutout to @bantg and @nymmrx for their awesome work on yearn-exporter that made this library possible.
Home-page: UNKNOWN
Author: BobTheBuidler
Expand Down
4 changes: 2 additions & 2 deletions ypricemagic/uniswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def get_price_v1(asset, block=None):
factory = Contract("0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95")
try:
asset = Contract(asset)
exchange = interface.UniswapV1Exchange(factory.getExchange(asset))
exchange = Contract(factory.getExchange(asset))
eth_bought = exchange.getTokenToEthInputPrice(10 ** asset.decimals(), block_identifier=block)
exchange = interface.UniswapV1Exchange(factory.getExchange(usdc))
exchange = Contract(factory.getExchange(usdc))
usdc_bought = exchange.getEthToTokenInputPrice(eth_bought, block_identifier=block) / 1e6
fees = 0.997 ** 2
return usdc_bought / fees
Expand Down

0 comments on commit b166c2d

Please sign in to comment.