agent0 icon indicating copy to clipboard operation
agent0 copied to clipboard

DESIGN: support multiple pools in agent0

Open slundqui opened this issue 10 months ago • 0 comments

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:

  • [x] Extend chainsync to run in the remote connection case in interactive hyperdrive. #1456
  • [x] Stream all transfer single + hyperdrive events into the db. #1453
  • [x] DB supports multiple pools. #1455
    • Currently one db per pool, likely should be in the same db, maybe in the same table.

Other requirements:

  • [ ] agents need to be multi-pool #1458

slundqui avatar May 01 '24 19:05 slundqui