delvtech / agent0

Analysis & simulation repo for Delv
https://agent0.readthedocs.io/en/latest/
Apache License 2.0
45 stars 18 forks source link

DESIGN: support multiple pools in agent0 #1452

Closed slundqui closed 2 months ago

slundqui commented 3 months ago

Currently, an agent0 agent object can only interact with a single pool. Ideally, we would have an agent be part of the chain, with the pool being an argument for trading.

One major blocking factor is the python wallet object. This object is being maintained by transactions made through python, and can become out of sync with the underlying chain. Additionally, this object can become out of sync whenever a transaction is done using the same underlying wallet, but not through agent0.

One solution to this is to not maintain the agent's wallet in Python. Instead, any accesses to an agent wallet is a database query, where the database keeps track (asynchronously ideally) of all of the agent's events. We then have queries to the db to get, e.g., current positions and relevant positions wrt a hyperdrive pool.

Chainsync needs the following updates to support this:

Other requirements: