Clone this repository
git clone [email protected]:cowprotocol/solver-template-py.git
- Python 3.10 (or probably also 3.9)
- Rust v1.60.0 or Docker
python3.10 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
python -m src._server
This can also be run via docker with
docker run -p 8000:8000 gchr.io/cowprotocol/solver-template-py
or build your own docker image with
docker build -t test-solver-image .
curl -X POST "http://127.0.0.1:8000/solve" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
--data "@data/example.json"
Clone the services project with
git clone https://github.com/cowprotocol/services.git
cd services
NODE_URL=<NODE_URL>
cargo run --bin autopilot -- --skip-event-sync true --node-url $NODE_URL --shadow https://barn.api.cow.fi/mainnet --drivers "test|http://localhost:11088/test"
cargo run -p driver -- --config playground/driver.toml --ethrpc $NODE_URL
Navigate to barn.cowswap.exchange/ and place a tiny (real) order. See your driver pick it up and include it in the next auction being sent to your solver
- How to Build a Solver: https://docs.cow.fi/tutorials/how-to-write-a-solver
- In Depth Solver Specification: https://docs.cow.fi/off-chain-services/in-depth-solver-specification
- Settlement Contract (namely the settle method): https://github.com/cowprotocol/contracts/blob/ff6fb7cad7787b8d43a6468809cacb799601a10e/src/contracts/GPv2Settlement.sol#L121-L143
- Interaction Model (Currently missing from this framework): https://github.com/cowprotocol/services/blob/cda5e36db34c55e7bf9eb4ea8b6e36ecb046f2b2/crates/shared/src/http_solver/model.rs#L125-L130