https://github.com/adrienc21/uniswap-mm
Uniswap - Simple Market Maker
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Repository
Uniswap - Simple Market Maker
Basic Info
- Host: GitHub
- Owner: AdrienC21
- License: mit
- Language: Python
- Default Branch: main
- Size: 161 KB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Uniswap - Simple Market Maker
Uniswap - Simple Market Maker is a Python library that can be used to process transactions on Uniswap.
Installation
Clone this repository :
bash
git clone https://github.com/AdrienC21/uniswap-mm.git
Usage
Edit the file config.py with the following information :
python
address = "" # (str) Wallet Address ("0x...")
private_key = "" # (str) Wallet private key ("0x...")
provider = "" # (str) url of mainnet (ex : "https://mainnet.infura.io/v3/...")
Edit the file transaction_information.py :
```bash
sell (str) : "buy" or "sell".
If set to "buy", we want to buy
coin_a (str) : name of the first crypto used in the transaction. The name has to be the one used in coinmarketcap.com url
coinb (str) : name of the second crypto used in the transaction.
amount (float) : quantity of crypto to exchange (in wei)
minmax (float) : if we want to buy
destaddress (str) : Default=config.address. Address that will receive <coinb> deadline (int) : Maximum amount of time in seconds we wait for the transaction not to revert.
Example :
status = "sell" coina = "ethereum" coinb = "basic-attention-token" amount = 0.005 minmax = 0. destaddress = config.address deadline = 600 ```
Run the file runmarketmaker.py to process a swap on Uniswap. The hash transaction will be print in the console.
Quick Overview
The library is a wrapper of an already existing Web3 / Uniswap wrapper entitled uniswap-python-v2. The file uniswap_tools.py has been modified to correct some errors and to add an automatic extraction of the average gas used on Uniswap and an estimation of the current gas price (function inside gas.py).
Utils.py contains the core functions and transaction_information.py and config.py contain parameters that need to be edited.
runmarkmetmaker.py execute a trade.
An estimation of gas parameters and the address of the different crypto we want to use are found by scrapping crypto websites (Coinmarketcap and Crypto).
Those features are obtained here :


Documentation
gas.py
get_gas
python
d = get_gas()
gas = get_gas()["gas"]
gasPrice = get_gas()["gasPrice"]
Scrap the web to obtain data relative to gas on ethereum platform.
utils.py
extract_token ```python
Link corresponding to BAT is :
https://coinmarketcap.com/fr/currencies/basic-attention-token/
Hence coin_name = basic-attention-token" if we want to use BAT
coinname = "basic-attention-token" tokenaddress = extracttoken(coinname)
token_address = "0x0d8775f648430679a709e98d2b0cb6250d2887ef"
``` Extract the contract address of the token coinname based on etherscan.io database. The name coinname must be the one contained in its coinmarketcap's url.
exchange ```python from uniswap_tools import *
address : wallet address, ChecksumAddress format
client = UniswapV2Client(address, config.private_key, provider=config.provider)
status = "sell" coina = "ethereum" coinb = "basic-attention-token" amount = 0.005 minmax = 0. destaddress = config.address deadline = 600 # 10 minutes
t = exchange(client, status, coina, coinb, amountf, minmaxf, destaddress, deadline=600)
t : hash transaction need to be converted in string using t.hex()
``` Process a transaction on Uniswap.
License
Owner
- Name: Adrien Carrel
- Login: AdrienC21
- Kind: user
- Location: London
- Website: https://adriencarrel.com/
- Twitter: adriencarrel_
- Repositories: 3
- Profile: https://github.com/AdrienC21
Quantitative Researcher MSc Imperial College London (Advanced Computing) MEng CentraleSupélec (Applied Mathematics, Diplôme d'ingénieur)
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0