Skip to content

Commit

Permalink
404 add methods to pmat for storing prediction into ipfs and adding t…
Browse files Browse the repository at this point in the history
…hat to contract mapping (#446)

* Small log | PMAT integration for agent result mapping | test

* Subgraph integration for result mapping

* WIP

* Added IPFS upload to DeployableTraderAgent

* Added test for ipfs upload/unpin

* Removed test hardcoding

* Local test deploy working

* Small fixes before PR review

* Fixing CI

* Added txHashes to contract prediction being stored on chain

* Fixed isort

* Missing secrets

* Added safety margin

* Fixing test

* Adding new test

* Making tests pass

* local_web3 session scoped

* Tests finally passing locally

* Fixing unit tests

* Increasing rtol on market_moving bet test

* Fixed isort

* Fixed mypy

* Incrased timeout of test

* Making tests pass

* Reactivating tests

* Update tests_integration/tools/ipfs/test_ipfs_handler.py

Co-authored-by: Evan Griffiths <56087052+evangriffiths@users.noreply.github.com>

* Implemented PR comments

* Extracted local_chain test to other PR

* Fixed isort

---------

Co-authored-by: Evan Griffiths <56087052+evangriffiths@users.noreply.github.com>
  • Loading branch information
gabrielfior and evangriffiths authored Oct 2, 2024
1 parent 1ce2148 commit 3a0883a
Show file tree
Hide file tree
Showing 18 changed files with 594 additions and 47 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
MANIFOLD_API_KEY=
BET_FROM_PRIVATE_KEY=
OPENAI_API_KEY=
GRAPH_API_KEY=
GRAPH_API_KEY=
PINATA_API_KEY=
PINATA_API_SECRET=
2 changes: 2 additions & 0 deletions .github/workflows/python_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }}
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
METACULUS_API_KEY: ${{ secrets.METACULUS_API_KEY }}
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_API_SECRET: ${{ secrets.PINATA_API_SECRET }}

jobs:
mypy:
Expand Down
67 changes: 46 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

171 changes: 171 additions & 0 deletions prediction_market_agent_tooling/abis/omen_agentresultmapping.abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
[
{
"type": "constructor",
"inputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "addPrediction",
"inputs": [
{
"name": "marketAddress",
"type": "address",
"internalType": "address"
},
{
"name": "prediction",
"type": "tuple",
"internalType": "struct Prediction",
"components": [
{
"name": "publisherAddress",
"type": "address",
"internalType": "address"
},
{
"name": "ipfsHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "txHashes",
"type": "bytes32[]",
"internalType": "bytes32[]"
},
{
"name": "estimatedProbabilityBps",
"type": "uint16",
"internalType": "uint16"
}
]
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getPredictionByIndex",
"inputs": [
{
"name": "marketAddress",
"type": "address",
"internalType": "address"
},
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "tuple",
"internalType": "struct Prediction",
"components": [
{
"name": "publisherAddress",
"type": "address",
"internalType": "address"
},
{
"name": "ipfsHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "txHashes",
"type": "bytes32[]",
"internalType": "bytes32[]"
},
{
"name": "estimatedProbabilityBps",
"type": "uint16",
"internalType": "uint16"
}
]
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getPredictions",
"inputs": [
{
"name": "marketAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "tuple[]",
"internalType": "struct Prediction[]",
"components": [
{
"name": "publisherAddress",
"type": "address",
"internalType": "address"
},
{
"name": "ipfsHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "txHashes",
"type": "bytes32[]",
"internalType": "bytes32[]"
},
{
"name": "estimatedProbabilityBps",
"type": "uint16",
"internalType": "uint16"
}
]
}
],
"stateMutability": "view"
},
{
"type": "event",
"name": "PredictionAdded",
"inputs": [
{
"name": "marketAddress",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "estimatedProbabilityBps",
"type": "uint16",
"indexed": false,
"internalType": "uint16"
},
{
"name": "publisherAddress",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "txHashes",
"type": "bytes32[]",
"indexed": false,
"internalType": "bytes32[]"
},
{
"name": "ipfsHash",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
}
]
Loading

0 comments on commit 3a0883a

Please sign in to comment.