diff --git a/README.md b/README.md index bde0af9..bbdb327 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Repository holding the contracts made by Gnosis Labs team. | Contract Name | Description | Mainnet Address | TheGraph | |----------------------------|-------------------------------------------------------|-------------------------------------------||-------------------------------------------| | OmenThumbnailMapping | Manages IPFS hashes for market thumbnails on Omen 2.0 | [0xe0cf08311F03850497B0ed6A2cf067f1750C3eFc](https://gnosisscan.io/address/0xe0cf08311f03850497b0ed6a2cf067f1750c3efc#code) | [omen-thumbnailmapping](https://thegraph.com/studio/subgraph/omen-thumbnailmapping/) | -| OmenAgentResultMapping | Maps prediction results to markets on Omen 2.0 | [0xbe1F6944496923683ca849fc0cC93fD10523cB83](https://gnosisscan.io/address/0xbe1F6944496923683ca849fc0cC93fD10523cB83#code) | [omen-agentresultmapping](https://thegraph.com/studio/subgraph/omen-agentresultmapping/) | +| OmenAgentResultMapping | Maps prediction results to markets on Omen 2.0 | [0xbe1F6944496923683ca849fc0cC93fD10523cB83](https://gnosisscan.io/address/0x260E1077dEA98e738324A6cEfB0EE9A272eD471a#code) | [omen-agentresultmapping](https://thegraph.com/studio/subgraph/omen-agentresultmapping/) | ## Set up contracts development diff --git a/graphs/omen-agentresultmapping/abis/OmenAgentResultMapping.json b/graphs/omen-agentresultmapping/abis/OmenAgentResultMapping.json index 0f353cf..0454df4 100644 --- a/graphs/omen-agentresultmapping/abis/OmenAgentResultMapping.json +++ b/graphs/omen-agentresultmapping/abis/OmenAgentResultMapping.json @@ -1,127 +1,139 @@ [ - { "type": "constructor", "inputs": [], "stateMutability": "nonpayable" }, + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { - "type": "function", - "name": "addPrediction", + "anonymous": false, "inputs": [ - { "name": "marketAddress", "type": "address", "internalType": "address" }, { - "name": "prediction", - "type": "tuple", - "internalType": "struct Prediction", + "indexed": true, + "internalType": "address", + "name": "marketAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "estimatedProbabilityBps", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "publisherAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "txHashes", + "type": "bytes32[]" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "name": "PredictionAdded", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "marketAddress", "type": "address" }, + { "components": [ { + "internalType": "address", "name": "publisherAddress", - "type": "address", - "internalType": "address" + "type": "address" }, - { "name": "ipfsHash", "type": "bytes32", "internalType": "bytes32" }, - { "name": "txHash", "type": "bytes32", "internalType": "bytes32" }, + { "internalType": "bytes32", "name": "ipfsHash", "type": "bytes32" }, { + "internalType": "bytes32[]", + "name": "txHashes", + "type": "bytes32[]" + }, + { + "internalType": "uint16", "name": "estimatedProbabilityBps", - "type": "uint16", - "internalType": "uint16" + "type": "uint16" } - ] + ], + "internalType": "struct Prediction", + "name": "prediction", + "type": "tuple" } ], + "name": "addPrediction", "outputs": [], - "stateMutability": "nonpayable" + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "getPredictionByIndex", "inputs": [ - { "name": "marketAddress", "type": "address", "internalType": "address" }, - { "name": "index", "type": "uint256", "internalType": "uint256" } + { "internalType": "address", "name": "marketAddress", "type": "address" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } ], + "name": "getPredictionByIndex", "outputs": [ { - "name": "", - "type": "tuple", - "internalType": "struct Prediction", "components": [ { + "internalType": "address", "name": "publisherAddress", - "type": "address", - "internalType": "address" + "type": "address" }, - { "name": "ipfsHash", "type": "bytes32", "internalType": "bytes32" }, - { "name": "txHash", "type": "bytes32", "internalType": "bytes32" }, + { "internalType": "bytes32", "name": "ipfsHash", "type": "bytes32" }, { + "internalType": "bytes32[]", + "name": "txHashes", + "type": "bytes32[]" + }, + { + "internalType": "uint16", "name": "estimatedProbabilityBps", - "type": "uint16", - "internalType": "uint16" + "type": "uint16" } - ] + ], + "internalType": "struct Prediction", + "name": "", + "type": "tuple" } ], - "stateMutability": "view" + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "getPredictions", "inputs": [ - { "name": "marketAddress", "type": "address", "internalType": "address" } + { "internalType": "address", "name": "marketAddress", "type": "address" } ], + "name": "getPredictions", "outputs": [ { - "name": "", - "type": "tuple[]", - "internalType": "struct Prediction[]", "components": [ { + "internalType": "address", "name": "publisherAddress", - "type": "address", - "internalType": "address" + "type": "address" + }, + { "internalType": "bytes32", "name": "ipfsHash", "type": "bytes32" }, + { + "internalType": "bytes32[]", + "name": "txHashes", + "type": "bytes32[]" }, - { "name": "ipfsHash", "type": "bytes32", "internalType": "bytes32" }, - { "name": "txHash", "type": "bytes32", "internalType": "bytes32" }, { + "internalType": "uint16", "name": "estimatedProbabilityBps", - "type": "uint16", - "internalType": "uint16" + "type": "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": "txHash", - "type": "bytes32", - "indexed": false, - "internalType": "bytes32" - }, - { - "name": "ipfsHash", - "type": "bytes32", - "indexed": false, - "internalType": "bytes32" + ], + "internalType": "struct Prediction[]", + "name": "", + "type": "tuple[]" } ], - "anonymous": false + "stateMutability": "view", + "type": "function" } ] diff --git a/graphs/omen-agentresultmapping/networks.json b/graphs/omen-agentresultmapping/networks.json index dcf13a3..df70f3e 100644 --- a/graphs/omen-agentresultmapping/networks.json +++ b/graphs/omen-agentresultmapping/networks.json @@ -1,8 +1,8 @@ { "gnosis": { "OmenAgentResultMapping": { - "address": "0xbe1F6944496923683ca849fc0cC93fD10523cB83", - "startBlock": 36085528 + "address": "0x260E1077dEA98e738324A6cEfB0EE9A272eD471a", + "startBlock": 36267341 } } } \ No newline at end of file diff --git a/graphs/omen-agentresultmapping/schema.graphql b/graphs/omen-agentresultmapping/schema.graphql index b3a8025..4a15ea0 100644 --- a/graphs/omen-agentresultmapping/schema.graphql +++ b/graphs/omen-agentresultmapping/schema.graphql @@ -3,7 +3,7 @@ type PredictionAdded @entity(immutable: true) { marketAddress: Bytes! # address estimatedProbabilityBps: Int! # uint16 publisherAddress: Bytes! # address - txHash: Bytes! # bytes32 + txHashes: [Bytes!]! # bytes32[] ipfsHash: Bytes! # bytes32 blockNumber: BigInt! blockTimestamp: BigInt! diff --git a/graphs/omen-agentresultmapping/src/omen-agent-result-mapping.ts b/graphs/omen-agentresultmapping/src/omen-agent-result-mapping.ts index 837b35b..f0f0943 100644 --- a/graphs/omen-agentresultmapping/src/omen-agent-result-mapping.ts +++ b/graphs/omen-agentresultmapping/src/omen-agent-result-mapping.ts @@ -8,7 +8,7 @@ export function handlePredictionAdded(event: PredictionAddedEvent): void { entity.marketAddress = event.params.marketAddress entity.estimatedProbabilityBps = event.params.estimatedProbabilityBps entity.publisherAddress = event.params.publisherAddress - entity.txHash = event.params.txHash + entity.txHashes = event.params.txHashes entity.ipfsHash = event.params.ipfsHash entity.blockNumber = event.block.number diff --git a/graphs/omen-agentresultmapping/subgraph.yaml b/graphs/omen-agentresultmapping/subgraph.yaml index 9057a77..bb9efa9 100644 --- a/graphs/omen-agentresultmapping/subgraph.yaml +++ b/graphs/omen-agentresultmapping/subgraph.yaml @@ -8,9 +8,9 @@ dataSources: name: OmenAgentResultMapping network: gnosis source: - address: "0xbe1F6944496923683ca849fc0cC93fD10523cB83" + address: "0x260E1077dEA98e738324A6cEfB0EE9A272eD471a" abi: OmenAgentResultMapping - startBlock: 36085528 + startBlock: 36267341 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -21,6 +21,6 @@ dataSources: - name: OmenAgentResultMapping file: ./abis/OmenAgentResultMapping.json eventHandlers: - - event: PredictionAdded(indexed address,uint16,indexed address,bytes32,bytes32) + - event: PredictionAdded(indexed address,uint16,indexed address,bytes32[],bytes32) handler: handlePredictionAdded file: ./src/omen-agent-result-mapping.ts diff --git a/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping-utils.ts b/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping-utils.ts index 75fc85b..f374663 100644 --- a/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping-utils.ts +++ b/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping-utils.ts @@ -6,7 +6,7 @@ export function createPredictionAddedEvent( marketAddress: Address, estimatedProbabilityBps: i32, publisherAddress: Address, - txHash: Bytes, + txHashes: Array, ipfsHash: Bytes ): PredictionAdded { let predictionAddedEvent = changetype(newMockEvent()) @@ -32,7 +32,10 @@ export function createPredictionAddedEvent( ) ) predictionAddedEvent.parameters.push( - new ethereum.EventParam("txHash", ethereum.Value.fromFixedBytes(txHash)) + new ethereum.EventParam( + "txHashes", + ethereum.Value.fromFixedBytesArray(txHashes) + ) ) predictionAddedEvent.parameters.push( new ethereum.EventParam("ipfsHash", ethereum.Value.fromFixedBytes(ipfsHash)) diff --git a/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping.test.ts b/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping.test.ts index 08149eb..3096a6f 100644 --- a/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping.test.ts +++ b/graphs/omen-agentresultmapping/tests/omen-agent-result-mapping.test.ts @@ -24,13 +24,13 @@ describe("Describe entity assertions", () => { let publisherAddress = Address.fromString( "0x0000000000000000000000000000000000000001" ) - let txHash = Bytes.fromI32(1234567890) + let txHashes = [Bytes.fromI32(1234567890)] let ipfsHash = Bytes.fromI32(1234567890) let newPredictionAddedEvent = createPredictionAddedEvent( marketAddress, estimatedProbabilityBps, publisherAddress, - txHash, + txHashes, ipfsHash ) handlePredictionAdded(newPredictionAddedEvent) @@ -68,8 +68,8 @@ describe("Describe entity assertions", () => { assert.fieldEquals( "PredictionAdded", "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", - "txHash", - "1234567890" + "txHashes", + "[1234567890]" ) assert.fieldEquals( "PredictionAdded", diff --git a/graphs/omen-agentresultmapping/yarn.lock b/graphs/omen-agentresultmapping/yarn.lock index b957c27..87de8a0 100644 --- a/graphs/omen-agentresultmapping/yarn.lock +++ b/graphs/omen-agentresultmapping/yarn.lock @@ -572,9 +572,9 @@ integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== "@types/node@*", "@types/node@>=13.7.0": - version "22.5.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.5.tgz#52f939dd0f65fc552a4ad0b392f3c466cc5d7a44" - integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA== + version "22.7.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc" + integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg== dependencies: undici-types "~6.19.2"