Metadata-Version: 2.3
Name: dexsim
Version: 0.1.0
Summary: API to create and interact with Uniswap based decentralized exchange
Author-email: Dave Bryson <davebryson@users.noreply.github.com>
License: Apache-2.0
Keywords: agent-based modeling,ethereum,simulation,solidity,uniswap
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.11
Requires-Dist: omegaconf
Requires-Dist: simular-evm>=0.2.6
Description-Content-Type: text/markdown

# DEXSim

An API to create and interact with a local version of Uniswap v3. Configure and deploy a number of token pools for trading and experimentation.

Built on [Simular](https://simular.readthedocs.io/en/latest/)


## Install
```console
> pip install dexsim
```

## Quick Start

### Configuration
You can setup pools and any other additional information in a YAML file. This file is passed as a parameter to the `DEX` constructor.

**Example:**
File: *config.yaml*
```yaml
simulator:
  pools:
    eth_usdc:
      tokens:
        0: "usdc"
        1: "eth"
      fee: 0.30
      price: 3000.00
    dia_usdc:
      tokens:
        0: "dia"
        1: "usdc"
      fee: 0.05
      price: 1.0
```

### Create an interact with a Uniswap DEX

```python
from dexsim.dex import DEX

# Create the Unswap DEX based on the configuration file
dex = DEX('./config.yaml')

assert 2 == dex.total_number_of_pools()

# create a wallet for Bob
bob = dex.create_wallet()

# mint 9000 USDC and 3 WETH for bob
dex.pools.eth_usdc_pool.mint_tokens(9000, 3, bob)

# Add some liquidity to the pool and get the NFT position token id
 _, _, tokenid =  dex.pools.eth_usdc_pool.mint_liquidity_position(3000, 1, 2900, 3100, bob)

```

See `tests/` for several examples of use.

