Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ precommit:

docs:
cd docs/ && make html

install-editable:
pip install -e .
2,464 changes: 0 additions & 2,464 deletions poetry.lock

This file was deleted.

20 changes: 11 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[tool.poetry]
name = "uniswap-python"
version = "0.7.2" # this is automatically set in CI on tagged releases (before pushed to PyPI)
version = "0.7.2"
description = "An unofficial Python wrapper for the decentralized exchange Uniswap"
repository = "https://github.com/shanefontaine/uniswap-python"
repository = "https://github.com/TimeGPT-forcasting-model/uniswap-python.git"
readme = "README.md"
keywords = ["uniswap", "ethereum", "exchange", "trading"]
authors = ["Shane Fontaine <shane6fontaine@gmail.com>", "Erik Bjäreholt <erik@bjareho.lt>"]
authors = [
"Shane Fontaine <shane6fontaine@gmail.com>",
"Erik Bjäreholt <erik@bjareho.lt>",
"Benedict Zhou <machespresso@gmail.com>"
]
license = "MIT"
packages = [
{ include = "uniswap" },
Expand All @@ -18,7 +22,6 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]


[tool.poetry.scripts]
unipy = "uniswap:main"

Expand All @@ -39,15 +42,14 @@ flake8 = "*"
Sphinx = "*"
sphinx-book-theme = "*"
sphinx-click = "*"
pydata-sphinx-theme = "0.13.1" # due to: https://github.com/executablebooks/sphinx-book-theme/issues/711
pydata-sphinx-theme = "0.13.1"

[tool.pytest.ini_options]
log_cli = false # to print logs during tests, set to true
#log_level = "NOTSET"
log_cli = false

[tool.ruff]
ignore = ["E402", "E501"]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
50 changes: 50 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from setuptools import setup, find_packages

setup(
name='uniswap-python',
version='0.7.2',
description='An unofficial Python wrapper for the decentralized exchange Uniswap',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/TimeGPT-forcasting-model/uniswap-python.git',
author='Shane Fontaine, Erik Bjäreholt, Benedict Zhou',
author_email='machespresso@gmail.com',
license='MIT',
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Information Technology',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords='uniswap ethereum exchange trading',
packages=find_packages(include=['uniswap', 'uniswap.*']),
package_data={
'uniswap': ['assets/*.abi', 'assets/*/*.abi'],
},
install_requires=[
'web3>=6.0,<7.0',
'click>=8.0.3,<9.0',
'python-dotenv',
'typing-extensions',
],
entry_points={
'console_scripts': [
'unipy=uniswap:main',
],
},
extras_require={
'dev': [
'mypy',
'black',
'pytest>=6.0',
'pytest-cov',
'pytest-dotenv',
'flake8',
'Sphinx',
'sphinx-book-theme',
'sphinx-click',
'pydata-sphinx-theme==0.13.1',
],
},
python_requires='>=3.7.2',
)
8 changes: 8 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from uniswap.uniswap import Uniswap
from dotenv import load_dotenv

load_dotenv()

PRIVATE_KEY = os.getenv("PRIVATE_KEY")


266 changes: 266 additions & 0 deletions uniswap/assets/uniswap-v3/quoterv2.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_factory",
"type": "address"
},
{
"internalType": "address",
"name": "_WETH9",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"indexed": false,
"internalType": "uint24",
"name": "fee",
"type": "uint24"
}
],
"name": "PoolAddress",
"type": "event"
},
{
"inputs": [
{
"internalType": "int256",
"name": "amount0Delta",
"type": "int256"
},
{
"internalType": "int256",
"name": "amount1Delta",
"type": "int256"
},
{
"internalType": "bytes",
"name": "path",
"type": "bytes"
}
],
"name": "uniswapV3SwapCallback",
"outputs": [],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint24",
"name": "fee",
"type": "uint24"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "uint160",
"name": "sqrtPriceLimitX96",
"type": "uint160"
}
],
"internalType": "struct QuoteExactInputSingleParams",
"name": "params",
"type": "tuple"
}
],
"name": "quoteExactInputSingle",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
},
{
"internalType": "uint160",
"name": "sqrtPriceX96After",
"type": "uint160"
},
{
"internalType": "uint32",
"name": "initializedTicksCrossed",
"type": "uint32"
},
{
"internalType": "uint256",
"name": "gasEstimate",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "path",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
}
],
"name": "quoteExactInput",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
},
{
"internalType": "uint160[]",
"name": "sqrtPriceX96AfterList",
"type": "uint160[]"
},
{
"internalType": "uint32[]",
"name": "initializedTicksCrossedList",
"type": "uint32[]"
},
{
"internalType": "uint256",
"name": "gasEstimate",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint24",
"name": "fee",
"type": "uint24"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint160",
"name": "sqrtPriceLimitX96",
"type": "uint160"
}
],
"internalType": "struct QuoteExactOutputSingleParams",
"name": "params",
"type": "tuple"
}
],
"name": "quoteExactOutputSingle",
"outputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "uint160",
"name": "sqrtPriceX96After",
"type": "uint160"
},
{
"internalType": "uint32",
"name": "initializedTicksCrossed",
"type": "uint32"
},
{
"internalType": "uint256",
"name": "gasEstimate",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "path",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"name": "quoteExactOutput",
"outputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "uint160[]",
"name": "sqrtPriceX96AfterList",
"type": "uint160[]"
},
{
"internalType": "uint32[]",
"name": "initializedTicksCrossedList",
"type": "uint32[]"
},
{
"internalType": "uint256",
"name": "gasEstimate",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading