Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
!/packages/subgraph/
/packages/subgraph/generated/
/packages/subgraph/build/
/packages/subgraph/subgraph.yaml
/packages/subgraph/.drone.yml
/packages/subgraph/.drone.yml
2 changes: 1 addition & 1 deletion packages/sdk/.drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ steps:
- test:unit

- name: subgraph-deploy
image: node:18.19
image: node:20.18
environment:
GRAPHNODE_URL: http://graphnode:8020
IPFS_URL: http://ipfs:5001
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { IExecModule } from 'iexec';
import type { IPoCo } from '../../../../generated/typechain/sharing/interfaces/IPoCo.js';

export async function getPocoContract(
iexec: IExecModule
): Promise<IPoCo> {
export async function getPocoContract(iexec: IExecModule): Promise<IPoCo> {
const client = await iexec.config.resolveContractsClient();
return client.getIExecContract() as unknown as IPoCo;
}
4 changes: 2 additions & 2 deletions packages/sdk/tests/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export const getTestConfig = (
: 'http://127.0.0.1:8080',
ipfsNode: process.env.DRONE ? 'http://ipfs:5001' : 'http://127.0.0.1:5001',
subgraphUrl: process.env.DRONE
? 'http://graphnode:8000/subgraphs/name/DataProtector-v2'
: 'http://127.0.0.1:8000/subgraphs/name/DataProtector-v2',
? 'http://graphnode:8000/subgraphs/name/bellecour/DataProtector-v2'
: 'http://127.0.0.1:8000/subgraphs/name/bellecour/DataProtector-v2',
};
return [ethProvider, options];
};
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/.drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ trigger:

steps:
- name: build-subgraph
image: node:18.19
image: node:20.18
environment:
ENV: prod
commands:
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ coverage.json

# subgraph
generated
subgraph.yaml
tests/.latest.json
subgraph.yaml
1 change: 1 addition & 0 deletions packages/subgraph/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.18
4 changes: 2 additions & 2 deletions packages/subgraph/deployer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.19
FROM node:20.18

RUN mkdir /app

Expand All @@ -8,4 +8,4 @@ WORKDIR /app/packages/subgraph

RUN npm ci

ENTRYPOINT [ "npm", "run", "all" ]
ENTRYPOINT [ "npm", "run", "all" ]
11 changes: 6 additions & 5 deletions packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"scripts": {
"format": "prettier --write \"(src|tests)/**/*.{ts,json}\"",
"check-format": "prettier --check \"(src|tests)/**/*.ts|tests/**/*.ts\"",
"build": "dotenv -e .env -- graph codegen && graph build --network ${NETWORK_NAME:-bellecour}",
"codegen": "graph codegen subgraph.template.yaml",
"build": "dotenv -e .env -- sh -c 'graph codegen subgraph.template.yaml && graph build subgraph.template.yaml --network ${NETWORK_NAME:-bellecour}'",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ DataProtector",
"create-local": "dotenv -e .env -- graph create --node ${GRAPHNODE_URL:-http://localhost:8020} ${NETWORK_NAME:-bellecour}/DataProtector-v2",
"remove-local": "dotenv -e .env -- graph remove --node ${GRAPHNODE_URL:-http://localhost:8020} ${NETWORK_NAME:-bellecour}/DataProtector-v2",
"deploy-local": "dotenv -e .env -- graph deploy --node ${GRAPHNODE_URL:-http://localhost:8020} --ipfs ${IPFS_URL:-http://localhost:5001} ${NETWORK_NAME:-bellecour}/DataProtector-v2 --version-label ${VERSION_LABEL:-dev}",
"create-local": "dotenv -e .env -- sh -c 'graph create ${NETWORK_NAME:-bellecour}/DataProtector-v2 --node ${GRAPHNODE_URL:-http://localhost:8020}'",
"remove-local": "dotenv -e .env -- sh -c 'graph remove ${NETWORK_NAME:-bellecour}/DataProtector-v2 --node ${GRAPHNODE_URL:-http://localhost:8020}'",
"deploy-local": "dotenv -e .env -- sh -c 'graph deploy ${NETWORK_NAME:-bellecour}/DataProtector-v2 subgraph.template.yaml --network ${NETWORK_NAME:-bellecour} --node ${GRAPHNODE_URL:-http://localhost:8020} --ipfs ${IPFS_URL:-http://localhost:5001} --version-label ${VERSION_LABEL:-dev}'",
"clean": "rm -rf generated && rm -rf build",
"all": "npm run clean && npm run codegen && npm run build && npm run create-local && npm run deploy-local",
"all": "npm run clean && npm run codegen && npm run create-local && npm run deploy-local",
"refresh-abis": "node tools/refreshAbis.mjs",
"test": "graph test",
"coverage": "graph test -- -c"
Expand Down
166 changes: 166 additions & 0 deletions packages/subgraph/subgraph.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
specVersion: 0.0.6
description: Subgraph for dataProtector smart contract
schema:
file: ./schema.graphql
dataSources:
- name: DataProtector
kind: ethereum/contract
source:
abi: DataProtector
address: "0x3a4Ab33F3D605e75b6D00A32A0Fa55C3628F6A59"
startBlock: 25455501
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- ProtectedData
- SchemaEntry
- Account
abis:
- name: Dataset
file: node_modules/@iexec/poco/build/contracts/Dataset.json
- name: DataProtector
file: ./abis/DataProtectorCoreABI.json
eventHandlers:
- event: DatasetSchema(indexed address,string)
handler: handleDatasetSchema
file: ./src/dataProtector.ts
network: bellecour
- name: DatasetRegistry
kind: ethereum/contract
source:
abi: DatasetRegistry
address: "0x0000000000000000000000000000000000000000"
startBlock: 25455501
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- ProtectedData
abis:
- name: Dataset
file: node_modules/@iexec/poco/build/contracts/Dataset.json
- name: DatasetRegistry
file: node_modules/@iexec/poco/build/contracts/DatasetRegistry.json
eventHandlers:
- event: Transfer(indexed address,indexed address,indexed uint256)
handler: handleTransferDataset
file: ./src/datasetRegistry.ts
network: bellecour
- name: AppRegistry
kind: ethereum/contract
source:
abi: AppRegistry
address: "0x0000000000000000000000000000000000000000"
startBlock: 28566236
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- App
abis:
- name: App
file: node_modules/@iexec/poco/build/contracts/App.json
- name: AppRegistry
file: node_modules/@iexec/poco/build/contracts/AppRegistry.json
eventHandlers:
- event: Transfer(indexed address,indexed address,indexed uint256)
handler: handleTransferApp
file: ./src/appRegistry.ts
network: bellecour
- name: DataProtectorSharing
kind: ethereum/contract
source:
abi: DataProtectorSharing
address: "0x1390c3c6a545198809F1C7c5Dd2600ef74D60925"
startBlock: 28566236
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Account
- Collection
- SubscriptionParam
- CollectionSubscription
- Rental
- RentalParam
- Sale
- SaleParam
- Consumption
abis:
- name: DataProtectorSharing
file: ./abis/DataProtectorSharingABI.json
eventHandlers:
- event: Transfer(indexed address,indexed address,indexed uint256)
handler: handleTransfer
- event: ProtectedDataTransfer(address,uint256,uint256,address)
handler: handleProtectedDataTransfer
- event: ProtectedDataConsumed(bytes32,address,uint8)
handler: handleProtectedDataConsumed
- event: NewSubscription(uint256,indexed address,uint48)
handler: handleNewSubscription
- event: NewSubscriptionParams(uint256,(uint72,uint40))
handler: handleNewSubscriptionParams
- event: ProtectedDataAddedForSubscription(uint256,address)
handler: handleProtectedDataAddedForSubscription
- event: ProtectedDataRemovedFromSubscription(uint256,address)
handler: handleProtectedDataRemovedFromSubscription
- event: NewRental(uint256,address,address,uint48)
handler: handleNewRental
- event: ProtectedDataAddedForRenting(uint256,address,(uint72,uint40))
handler: handleProtectedDataAddedForRenting
- event: ProtectedDataRemovedFromRenting(uint256,address)
handler: handleProtectedDataRemovedFromRenting
- event: ProtectedDataSold(uint256,address,address)
handler: handleProtectedDataSold
- event: ProtectedDataAddedForSale(uint256,address,uint72)
handler: handleProtectedDataAddedForSale
- event: ProtectedDataRemovedFromSale(uint256,address)
handler: handleProtectedDataRemovedFromSale
file: ./src/dataProtectorSharing.ts
network: bellecour
- name: AddOnlyAppWhitelistRegistry
kind: ethereum/contract
source:
abi: AddOnlyAppWhitelistRegistry
address: "0x498D324F711b8998Be81818742e268dEE30347c6"
startBlock: 28566234
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- AddOnlyAppWhitelist
abis:
- name: AddOnlyAppWhitelistRegistry
file: ./abis/AddOnlyAppWhitelistRegistryABI.json
eventHandlers:
- event: Transfer(indexed address,indexed address,indexed uint256)
handler: handleNewAddOnlyAppWhitelist
file: ./src/addOnlyAppWhitelistRegistry.ts
network: bellecour
templates:
- kind: ethereum/contract
name: AddOnlyAppWhitelistTemplate
source:
abi: AddOnlyAppWhitelist
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- App
abis:
- name: AddOnlyAppWhitelist
file: ./abis/AddOnlyAppWhitelistABI.json
- name: App
file: node_modules/@iexec/poco/build/contracts/App.json
eventHandlers:
- event: NewAppAddedToAddOnlyAppWhitelist(address)
handler: handleNewAppAdded
file: ./src/addOnlyAppWhitelist.ts
network: bellecour