Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Autoparallel committed Feb 16, 2024
1 parent 7671f68 commit 4d1160b
Showing 1 changed file with 34 additions and 31 deletions.
65 changes: 34 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
# Arbiter Template

Minimal template for simulating contracts with arbiter. This template provides an example of how to build Agent-Based Models (ABM) with evm parity. In this model, you can think of anything that happens as a *behavior* of an agent. Agents can have externally owned accounts (EOAs), interact with each other, and interact with smart contracts.

This repository has an example behavior [`Incrementer`](src/bahaviors/incrementer.rs). The current design philosophy is that the user should only ever have to build agent behaviors implementing the [`Behavior`](https://github.com/primitivefinance/arbiter/blob/fe6b556d715d641aa9378ae20560629ec6ba5b43/arbiter-engine/src/machine.rs#L73) trait. In this example, the `Incrementer` behavior is configured with a [config file](https://github.com/primitivefinance/arbiter-template/blob/main/configs/example.toml). Configuring behaviors with a config file is a design choice we made to enable versatile parameterization at runtime as opposed to compile time.

### Prerequisites

- Rust programming language and Cargo package manager (latest stable version recommended)
- [Foundry](https://book.getfoundry.sh/getting-started/installation) is used behind the scenes to generate rust contract bindings. Make sure you have forge installed and up to date.

## Usage

> `cargo generate` is a tool to create new Rust projects from pre-existing templates. It is used to create a new project from a template.
``` bash
cargo install cargo-generate
```
Use the template
```
cargo generate --git https://github.com/primitivefinance/arbiter-template
```


> Run the template project
```bash
cargo run simulate configs/example.toml -vvv
```

## Log Verbosity
The `-vvv` flag is used to increase the verbosity of the logs. The more `v`'s, the more verbose the logs.
# Arbiter UniswapV3 Integration
The most hotly requested example to develop alongside Arbiter is with the Uniswap V3 contracts.
Uniswap V3 is a decentralized exchange that allows users to provide liquidity to the platform and earn fees in return.
Liquidity management is a key aspect of Uniswap V3 and there is much to learn about how to manage liquidity in a way that is profitable and sustainable.
We hope to provide useful behaviors and simulations from those that will allow people to battletest the protocol and their own strategies on top of it.

## Goals
**Initially:**
- [ ] Create basic deployment behaviors to get the Uniswap V3 contracts deployed into the Arbiter environment.
- [ ] Create basic liquidity management behaviors to allow users to provide liquidity to the Uniswap V3 contracts.
- [ ] Create basic swapping behaviors to allow users to swap on the Uniswap V3 contracts.
- [ ] Create an arbitrage behavior so that UniV3 can track simulated price paths.

---
**Later:**
- [ ] Fork state from mainnet to allow for simulations from historical data.
- [ ] Thoroughly manage gas costs and other costs associated with interacting with the Uniswap V3 contracts.
- [ ] Create more complex liquidity management behaviors to allow users to manage their liquidity in a more sophisticated way, e.g., with optimization schemes.


## Ideology
We should aim to create extensible and generic behaviors that can be customized to do more complex things.
For instance, swapping can be extended to include more complex logic for determining the best price to swap at, e.g., arbitrage.
We want these behaviors to be as generic and nuclear as possible so that they can be used in other contexts like legos.
This will allow us to build more complex strategies on top of these basic behaviors.
Code here will be reusable, extensible, modular, and composable.

Of course, we will also go about this iteratively.
We will not have the perfect abstractions from the start, but we will aim to refactor and improve the code as we go along.
Efforts here will likely induce changes in the Arbiter core or engine, and we will aim to make those changes as well.

## Contribution
We are open to contributions from the community!
If you have any issues to make, PRs to open, or other discussions to have, please feel free to do so.

0 comments on commit 4d1160b

Please sign in to comment.