Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## vNext
## v1.1.0 - Support deal sponsor
- Add `sponsor` to `deal`. (#31)
- Update deployment hosts:
- production (#30)
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile_Subgraph_bellecour
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
2 changes: 1 addition & 1 deletion Jenkinsfile_Subgraph_bellecour_stagingv8
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
4 changes: 2 additions & 2 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iexec/subgraph",
"version": "1.0.0-rc.1",
"version": "1.1.0",
"author": "iExec",
"license": "Apache-2.0",
"scripts": {
Expand All @@ -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}": [
Expand Down
14 changes: 11 additions & 3 deletions src/Modules/IexecPoco.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// 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,
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down