diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc62b6..1a3ea43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## vNext +## v1.1.0 - Support deal sponsor - Add `sponsor` to `deal`. (#31) - Update deployment hosts: - production (#30) @@ -9,7 +9,7 @@ - Add integration test suite. (#21) - Add unit test suite. (#20) -## 1.0.0 - initial release +## v1.0.0 - initial release ### features diff --git a/Jenkinsfile_Subgraph_bellecour b/Jenkinsfile_Subgraph_bellecour index 5dbf228..3250668 100644 --- a/Jenkinsfile_Subgraph_bellecour +++ b/Jenkinsfile_Subgraph_bellecour @@ -6,6 +6,6 @@ deploySubGraph( targetRemoteHostIPFS : 'ipfs-upload.v8-bellecour.iex.ec', subgraphFolder: './', subgraphFilename: 'subgraph.bellecour.yaml', - subgraphVersionLabel: 'v1.0.0-rc.1', + subgraphVersionLabel: 'v1.1.0', subgraphLabel: 'bellecour/poco-v5' ) diff --git a/Jenkinsfile_Subgraph_bellecour_stagingv8 b/Jenkinsfile_Subgraph_bellecour_stagingv8 index eed830b..8208816 100644 --- a/Jenkinsfile_Subgraph_bellecour_stagingv8 +++ b/Jenkinsfile_Subgraph_bellecour_stagingv8 @@ -6,6 +6,6 @@ deploySubGraph( targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', subgraphFolder: './', subgraphFilename: 'subgraph.bellecour.yaml', - subgraphVersionLabel: 'v1.0.0-rc.1', + subgraphVersionLabel: 'v1.1.0', subgraphLabel: 'bellecour/poco-v5' ) diff --git a/package-lock.json b/package-lock.json index 9e28aa3..04092ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@iexec/subgraph", - "version": "1.0.0-rc.1", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@iexec/subgraph", - "version": "1.0.0-rc.1", + "version": "1.1.0", "license": "Apache-2.0", "dependencies": { "@iexec/poco": "^5.5.0", diff --git a/package.json b/package.json index dc1ab53..1aade5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@iexec/subgraph", - "version": "1.0.0-rc.1", + "version": "1.1.0", "author": "iExec", "license": "Apache-2.0", "scripts": { @@ -14,7 +14,6 @@ "deploy": "graph deploy ${NETWORK_NAME:-bellecour}/poco --node ${GRAPHNODE_URL:-http://localhost:8020} --ipfs ${IPFS_URL:-http://localhost:5001} --version-label ${VERSION_LABEL:-bellecour/poco-v5}", "deploy:all": "npm run build && npm run create && npm run deploy", "itest": "DEBUG=testcontainers:* mocha" - }, "lint-staged": { "*.{js,ts}": [ diff --git a/src/Modules/IexecPoco.ts b/src/Modules/IexecPoco.ts index e15eeb0..6fd4216 100644 --- a/src/Modules/IexecPoco.ts +++ b/src/Modules/IexecPoco.ts @@ -1,7 +1,8 @@ // SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 -import { BigInt } from '@graphprotocol/graph-ts'; +import { Address, BigInt, dataSource } from '@graphprotocol/graph-ts'; +const chainName = dataSource.network(); import { AccurateContribution as AccurateContributionEvent, @@ -127,10 +128,17 @@ export function handleMatchOrders(call: MatchOrdersCall): void { export function handleOrdersMatched(event: OrdersMatchedEvent): void { let contract = IexecInterfaceTokenContract.bind(event.address); let viewedDeal = contract.viewDeal(event.params.dealid); - + // The `sponsor` has been introduced on Bellecour for the PoCo v5.5.0 release: + // https://blockscout.bellecour.iex.ec/tx/0x71b904f526a9be218d35748f57d74ef6da20d12c88f94cfa1ec5ae2de187cb98 + // TODO: Use grafting instead, see https://thegraph.com/docs/en/subgraphs/cookbook/grafting/ + const sponsor = + chainName == 'bellecour' && event.block.number < BigInt.fromI32(30277938) + ? Address.zero().toHexString() + : viewedDeal.sponsor.toHex(); fetchAccount(viewedDeal.requester.toHex()).save(); fetchAccount(viewedDeal.beneficiary.toHex()).save(); fetchAccount(viewedDeal.callback.toHex()).save(); + fetchAccount(sponsor).save(); let deal = fetchDeal(event.params.dealid.toHex()); deal.app = viewedDeal.app.pointer.toHex(); @@ -154,7 +162,7 @@ export function handleOrdersMatched(event: OrdersMatchedEvent): void { deal.botSize = viewedDeal.botSize; deal.workerStake = viewedDeal.workerStake; deal.schedulerRewardRatio = viewedDeal.schedulerRewardRatio; - deal.sponsor = viewedDeal.sponsor.toHex(); + deal.sponsor = sponsor; deal.apporder = event.params.appHash.toHex(); deal.datasetorder = event.params.datasetHash.toHex(); deal.workerpoolorder = event.params.workerpoolHash.toHex();