Skip to content

A monorepo for running the prediction markets demo, using the market-creator and the trader services

License

Notifications You must be signed in to change notification settings

dagacha/prediction-markets

 
 

Repository files navigation

Prediction Markets

This is a demo that allows a user to run a market creator agent and a trader agent via a script.

To get started, the user must mint the services on-chain and populate three .env files as follows:

  1. .creator.env: this environment file should contain the variables for the market creator service
  2. .trader.env: this environment file should contain the variables for the trader service
  3. .demo.env: this environment file should contain the variables for the demo

System requirements

  • Python == 3.10
  • Pipenv >=2021.x.xx
  • Tendermint ==v0.34.19

The script automatically installs Tendermint v0.34.19 if it is not present in your system.

Instructions

Two Gnosis addresses, and corresponding secret keys, are recommended to be created for this demo:

  • Gnosis address #1 is associated with the trader agent (and you need to replace the field TRADER_AGENT_ADDRESS in the file .trader.env with that address). The corresponding private key needs to be set as the value of the env variable TRADER_P_KEY in the file .demo.env

  • Another Gnosis address #2 is associated with the market creator agent (and you need to replace the field CREATOR_AGENT_ADDRESS in the file .market.env with that address). The corresponding private key needs to be set as the value of the env variable CREATOR_P_KEY in the file .demo.env

Other variables that need to be filled in with your own values are:

  • OPENAI_API_KEY and ETHEREUM_LEDGER_RPC in the file .creator.env
  • OMEN_CREATORS and RPC_0 in the file .trader.env

Finally, the trader agent runs as part of a trader service, which is an autonomous service that is represented on-chain in the Autonolas protocol by a Safe multisig, corresponding to the variable SAFE_CONTRACT_ADDRESS in the file .trader.env. Follow the next steps to compute the Safe address corresponding to your agent address:

  • Visit https://registry.olas.network/services/mint and connect to the Gnosis network. For this demo we recommend connecting using a wallet with a Gnosis EOA account that you own.
  • In the field "Owner address" input a Gnosis address for which you will be able to sign later using a supported wallet. If you want to use the address you're connected to click on "Prefill Address".
  • Click on "Generate Hash & File" and enter the value bafybeicgjqgkf2wv54rows3lw4qxnaqnxannumuonh6vahb3ldlzu7cyhi
  • In the field "Canonical agent Ids" enter the number 12
  • In the field "No. of slots to canonical agent Ids" enter the number 1
  • In the field "Cost of agent instance bond (wei)" enter the number 10000000000000000
  • In the field "Threshold" enter the number 1
  • Press the "Submit" button. Your wallet will ask you to approve the transaction. Once the transaction is settled, you should see a message indicating that the service NFT has been minted successfully. You should also see that the service is in Pre-Registration state.
  • Next, you can navigate to https://registry.olas.network/services#my-services, select your service and go through the steps:
    1. Activate registration
    2. Register agents: here, you must use the value that you set previously for TRADER_AGENT_ADDRESS.
    3. This is the last step. A transaction for the safe's deployment is already prepared and needs to be executed.
  • After completing the process you will be able to retrieve the value for the variable SAFE_CONTRACT_ADDRESS from the field "Safe contract address" as shown in an example below

Safe address field]

Finally run the demo script:

./demo.sh

Two folders will be generated, one for each agent. Among other contents, the logs are accessible within the folders.

Demo video

A demo video is available.

About

A monorepo for running the prediction markets demo, using the market-creator and the trader services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%