gnosis / prediction-market-agent-tooling

Tools to benchmark, deploy and monitor prediction market agents.
GNU Lesser General Public License v3.0
17 stars 2 forks source link

Making Safe safer #373

Open kongzii opened 1 month ago

kongzii commented 1 month ago

Currently, we support Safe and its single-signed transactions (if only one signer is required). That works out of the box with PMAT. However, we would like to use Safe for safer storage of funds.

The problem is, with only one signer, anyone who gets to the private key can remove the Spending limit (plus maybe Spending limit transactions don't work on arbitrary contracts).

We should be able to use https://github.com/gnosisguild/zodiac-modifier-roles to create a role for the agent's account on Safe that will be allowed to only send a certain amount of xDai and only use the Reality's contract, for anything else, multiple signers from our team would be required.

gabrielfior commented 1 month ago

A bit more context for my own understanding: -> The function we want to complete via a Safe wallet is submitAnswer (link to contract). Calling this function involves sending with the transaction X amount of xDAI (we antecipate sending 10 xDAI per answer) -> As described above, we want to use Zodiac's module and allow the EOA to spend <= 10 xDAI with transactions interacting with RealityETH contract. -> I would suggest exploring Zodiad'c SDK for easier interaction - it seems that EtherWithinAllowance should be a good start (what is missing is the requirement to interact only with RealityEth's submitAnswer method).

kongzii commented 1 month ago

Another (simpler) option would be:

  1. Have a single Safe with funds, Gnosis AI would be signers.
  2. Each agent would have a daily spending limit
  3. Before agent does something, it would withdraw required xDai from Safe to his wallet

However I still like the Zodiac Roles solution more, because

  1. This would be a single point of failure
  2. We couldn't track how Agent's balance changes over time (as we do with Replicator right now to see if it is losing money)

Just wanted to mention it, maybe it will be a good solution for something in the future..