Compare commits

...

19 Commits
v4.0.0 ... main

Author SHA1 Message Date
dependabot[bot] 2f322ee016
Bump ejs and @graphprotocol/graph-cli (#780)
Bumps [ejs](https://github.com/mde/ejs) to 3.1.10 and updates ancestor dependency @graphprotocol/graph-cli. These dependencies need to be updated together.


Updates `ejs` from 3.1.9 to 3.1.10
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.9...v3.1.10)

Updates `@graphprotocol/graph-cli` from 0.61.0 to 0.71.0

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
- dependency-name: "@graphprotocol/graph-cli"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 12:50:11 +03:00
dependabot[bot] ecc9092f5b
Bump typescript from 5.2.2 to 5.4.5 (#779)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.2.2 to 5.4.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.2.2...v5.4.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-25 12:54:34 +03:00
dependabot[bot] ae1a33755f
Bump undici from 5.27.2 to 5.28.4 (#777)
Bumps [undici](https://github.com/nodejs/undici) from 5.27.2 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.27.2...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 15:57:47 +03:00
dependabot[bot] 63bc3f8409
Bump tar from 4.4.13 to 4.4.19 (#775)
Bumps [tar](https://github.com/isaacs/node-tar) from 4.4.13 to 4.4.19.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v4.4.13...v4.4.19)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 15:50:19 +03:00
dependabot[bot] b9bfe07a92
Bump express (#776)
Bumps  and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `express` from 4.17.1 to 4.19.2
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.1...4.19.2)

Updates `express` from 4.18.2 to 4.19.2
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.1...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 15:49:25 +03:00
Alex Coseru d80ba60637
fix missing logic (#751)
* fix missing logic

* remove goerli
2024-03-21 10:45:33 +02:00
dependabot[bot] 4e939c70c0
Bump @typescript-eslint/parser from 6.7.4 to 6.19.0 (#766)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.7.4 to 6.19.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.19.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-23 18:16:19 +03:00
Alex Coseru ba5e514ddf
Use latest barge (#750) 2023-11-29 16:04:30 +02:00
alexcos20 8930eef827 Release 4.0.2 2023-11-22 13:46:59 +02:00
Alex Coseru 36ae877984
fix deps (#744) 2023-11-22 13:46:11 +02:00
alexcos20 cf58c9aae4 Release 4.0.1 2023-11-22 09:11:10 +02:00
Alex Coseru 8bc4dab920
Feature/add_optimism & use graph-node 0.33.0 (#742)
* bump contracts

* remove ss contracts

* add optimism

* fix

* use upcoming barge

* move deactivateMint and delete sell test

* add withMint=True and delete sell test

* fix lint

* more fixes

* more fixes
2023-11-22 09:09:40 +02:00
dependabot[bot] fc07962311
Bump chai and @types/chai (#729)
Bumps [chai](https://github.com/chaijs/chai) and [@types/chai](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/chai). These dependencies needed to be updated together.

Updates `chai` from 4.3.7 to 4.3.10
- [Release notes](https://github.com/chaijs/chai/releases)
- [Changelog](https://github.com/chaijs/chai/blob/4.x.x/History.md)
- [Commits](https://github.com/chaijs/chai/compare/v4.3.7...v4.3.10)

Updates `@types/chai` from 4.3.5 to 4.3.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/chai)

---
updated-dependencies:
- dependency-name: chai
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: "@types/chai"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 19:30:20 +02:00
dependabot[bot] 0077cfa69f
Bump @graphprotocol/graph-cli from 0.56.0 to 0.61.0 (#738)
Bumps @graphprotocol/graph-cli from 0.56.0 to 0.61.0.

---
updated-dependencies:
- dependency-name: "@graphprotocol/graph-cli"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 19:29:59 +02:00
dependabot[bot] 90ad128bc2
Bump crypto-js from 4.1.1 to 4.2.0 (#733)
Bumps [crypto-js](https://github.com/brix/crypto-js) from 4.1.1 to 4.2.0.
- [Commits](https://github.com/brix/crypto-js/compare/4.1.1...4.2.0)

---
updated-dependencies:
- dependency-name: crypto-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 19:01:25 +02:00
dependabot[bot] 0880f714b0
Bump release-it from 15.11.0 to 17.0.0 (#737)
Bumps [release-it](https://github.com/release-it/release-it) from 15.11.0 to 17.0.0.
- [Release notes](https://github.com/release-it/release-it/releases)
- [Changelog](https://github.com/release-it/release-it/blob/main/CHANGELOG.md)
- [Commits](https://github.com/release-it/release-it/compare/15.11.0...17.0.0)

---
updated-dependencies:
- dependency-name: release-it
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 19:00:58 +02:00
dependabot[bot] 7ee41bc29b
Bump minimist from 1.2.5 to 1.2.6 (#740)
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.6.
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 19:00:38 +02:00
dependabot[bot] 957db42e59
Bump tar from 4.4.13 to 4.4.19 (#741)
Bumps [tar](https://github.com/isaacs/node-tar) from 4.4.13 to 4.4.19.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v4.4.13...v4.4.19)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 19:00:24 +02:00
dependabot[bot] db6c3eeeea
Bump @graphprotocol/graph-ts from 0.30.0 to 0.31.0 (#730)
Bumps @graphprotocol/graph-ts from 0.30.0 to 0.31.0.

---
updated-dependencies:
- dependency-name: "@graphprotocol/graph-ts"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 18:59:27 +02:00
14 changed files with 7858 additions and 3596 deletions

View File

@ -37,8 +37,6 @@ jobs:
with:
repository: 'oceanprotocol/barge'
path: 'barge'
ref: main
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_PASSWORD && env.DOCKERHUB_USERNAME }}
run: |
@ -51,8 +49,6 @@ jobs:
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --with-thegraph --skip-subgraph-deploy --no-dashboard 2>&1 > start_ocean.log &
env:
CONTRACTS_VERSION: predictoor3
- run: npm ci

View File

@ -4,10 +4,31 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [v4.0.0](https://github.com/oceanprotocol/ocean-subgraph/compare/v3.0.10...v4.0.0)
#### [v4.0.2](https://github.com/oceanprotocol/ocean-subgraph/compare/v4.0.1...v4.0.2)
- fix deps [`#744`](https://github.com/oceanprotocol/ocean-subgraph/pull/744)
#### [v4.0.1](https://github.com/oceanprotocol/ocean-subgraph/compare/v4.0.0...v4.0.1)
> 22 November 2023
- Feature/add_optimism & use graph-node 0.33.0 [`#742`](https://github.com/oceanprotocol/ocean-subgraph/pull/742)
- Bump chai and @types/chai [`#729`](https://github.com/oceanprotocol/ocean-subgraph/pull/729)
- Bump @graphprotocol/graph-cli from 0.56.0 to 0.61.0 [`#738`](https://github.com/oceanprotocol/ocean-subgraph/pull/738)
- Bump crypto-js from 4.1.1 to 4.2.0 [`#733`](https://github.com/oceanprotocol/ocean-subgraph/pull/733)
- Bump release-it from 15.11.0 to 17.0.0 [`#737`](https://github.com/oceanprotocol/ocean-subgraph/pull/737)
- Bump minimist from 1.2.5 to 1.2.6 [`#740`](https://github.com/oceanprotocol/ocean-subgraph/pull/740)
- Bump tar from 4.4.13 to 4.4.19 [`#741`](https://github.com/oceanprotocol/ocean-subgraph/pull/741)
- Bump @graphprotocol/graph-ts from 0.30.0 to 0.31.0 [`#730`](https://github.com/oceanprotocol/ocean-subgraph/pull/730)
- Release 4.0.1 [`cf58c9a`](https://github.com/oceanprotocol/ocean-subgraph/commit/cf58c9aae4aa16f7a30b4c93de72786b1d4b3b3f)
### [v4.0.0](https://github.com/oceanprotocol/ocean-subgraph/compare/v3.0.10...v4.0.0)
> 21 November 2023
- Predictoor support [`#678`](https://github.com/oceanprotocol/ocean-subgraph/pull/678)
- bump deps [`#725`](https://github.com/oceanprotocol/ocean-subgraph/pull/725)
- Release 4.0.0 [`329ea98`](https://github.com/oceanprotocol/ocean-subgraph/commit/329ea980b628417652de8a444808ba7f470515c8)
#### [v3.0.10](https://github.com/oceanprotocol/ocean-subgraph/compare/v3.0.9...v3.0.10)

View File

@ -35,7 +35,6 @@ This subgraph is deployed under `/subgraphs/name/oceanprotocol/ocean-subgraph/`
- [v4.subgraph.bsc.oceanprotocol.com](https://v4.subgraph.bsc.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql)
- [v4.subgraph.moonriver.oceanprotocol.com](https://v4.subgraph.moonriver.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql)
- [v4.subgraph.energyweb.oceanprotocol.com](https://v4.subgraph.energyweb.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql)
- [v4.subgraph.goerli.oceanprotocol.com](https://v4.subgraph.goerli.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql)
- [v4.subgraph.mumbai.oceanprotocol.com](https://v4.subgraph.mumbai.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql)
## ⛵ Example Queries

View File

@ -3,32 +3,24 @@ Copyright 2023 Ocean Protocol Foundation
SPDX-License-Identifier: Apache-2.0
-->
- [Kubernetes deployment](#kubernetes-deployment)
* [Postgresql](#postgresql)
* [IPFS](#ipfs)
* [Graph-node](#graph-node)
- [Postgresql](#postgresql)
- [IPFS](#ipfs)
- [Graph-node](#graph-node)
- [Docker Compose deployment](#docker-compose-deployment)
* [Single systemd service (Graph-node+Postgresql+IPFS)](#single-systemd-service-graph-nodepostgresqlipfs)
- [Single systemd service (Graph-node+Postgresql+IPFS)](#single-systemd-service-graph-nodepostgresqlipfs)
- [Ocean-subgraph deployment](#ocean-subgraph-deployment)
#### Kubernetes deployment
[ocean-subgraph](https://github.com/oceanprotocol/ocean-subgraph) must be deployed on top of [graph-node](https://github.com/graphprotocol/graph-node) which has the following dependencies:
[ocean-subgraph](https://github.com/oceanprotocol/ocean-subgraph) must be deployed on top of [graph-node](https://github.com/graphprotocol/graph-node) which has the following dependencies:
- PostgreSQL
- IPFS
Templates (yaml files) provided and could be customized based on the environment's specifics.
##### Postgresql
It is recommended to deploy PostgreSQL as helm chart
@ -63,41 +55,41 @@ spec:
app: ipfs
spec:
containers:
- image: ipfs/go-ipfs:v0.4.22
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /debug/metrics/prometheus
port: api
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 1
name: s1-ipfs
ports:
- containerPort: 5001
name: api
protocol: TCP
- containerPort: 8080
name: gateway
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /debug/metrics/prometheus
port: api
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 1
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/ipfs
name: ipfs-storage
- image: ipfs/go-ipfs:v0.4.22
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /debug/metrics/prometheus
port: api
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 1
name: s1-ipfs
ports:
- containerPort: 5001
name: api
protocol: TCP
- containerPort: 8080
name: gateway
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /debug/metrics/prometheus
port: api
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 1
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/ipfs
name: ipfs-storage
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
@ -110,20 +102,20 @@ spec:
partition: 0
type: RollingUpdate
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
name: ipfs-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1G
volumeMode: Filesystem
status:
phase: Pending
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
name: ipfs-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1G
volumeMode: Filesystem
status:
phase: Pending
---
apiVersion: v1
kind: Service
@ -135,19 +127,17 @@ spec:
clusterIP:
clusterIPs:
ipFamilies:
- IPv4
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: api
port: 5001
- name: gateway
port: 8080
- name: api
port: 5001
- name: gateway
port: 8080
selector:
app: ipfs
```
##### Graph-node
The following annotated templated can be customized to deploy graph-node deployment and service:
@ -179,66 +169,66 @@ spec:
app: mumbai-graph-node
spec:
containers:
- env:
- name: ipfs
value: ipfs.<namespace>.svc.cluster.local:5001
- name: postgres_host
value: postgresql.<namespace>.svc.cluster.local
- name: postgres_user
value: < postgresql user >
- name: postgres_pass
value: < postgresql database password >
- name: postgres_db
value: < postgresql database >
- name: ethereum
value: mumbai:https://polygon-mumbai.infura.io/v3/< INFURA ID>
- name: GRAPH_KILL_IF_UNRESPONSIVE
value: "true"
image: graphprotocol/graph-node:v0.28.2
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8000
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: mumbai-graph-node
ports:
- containerPort: 8000
name: graphql
protocol: TCP
- containerPort: 8020
name: jsonrpc
protocol: TCP
- containerPort: 8030
name: indexnode
protocol: TCP
- containerPort: 8040
name: metrics
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8000
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: "2"
memory: 1536Mi
requests:
cpu: 1500m
memory: 1536Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
- env:
- name: ipfs
value: ipfs.<namespace>.svc.cluster.local:5001
- name: postgres_host
value: postgresql.<namespace>.svc.cluster.local
- name: postgres_user
value: < postgresql user >
- name: postgres_pass
value: < postgresql database password >
- name: postgres_db
value: < postgresql database >
- name: ethereum
value: mumbai:https://polygon-mumbai.infura.io/v3/< INFURA ID>
- name: GRAPH_KILL_IF_UNRESPONSIVE
value: 'true'
image: graphprotocol/graph-node:v0.28.2
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8000
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: mumbai-graph-node
ports:
- containerPort: 8000
name: graphql
protocol: TCP
- containerPort: 8020
name: jsonrpc
protocol: TCP
- containerPort: 8030
name: indexnode
protocol: TCP
- containerPort: 8040
name: metrics
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8000
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: '2'
memory: 1536Mi
requests:
cpu: 1500m
memory: 1536Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
@ -249,37 +239,34 @@ kind: Service
metadata:
labels:
app: mumbai-graph-node
name: mumbai-graph-node
name: mumbai-graph-node
spec:
clusterIP:
clusterIPs:
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: graphql
port: 8000
- name: jsonrpc
port: 8020
- name: indexnode
port: 8030
- name: metrics
port: 8040
- name: graphql
port: 8000
- name: jsonrpc
port: 8020
- name: indexnode
port: 8030
- name: metrics
port: 8040
selector:
app: mumbai-graph-node
```
#### Docker Compose deployment
##### Single systemd service (Graph-node+Postgresql+IPFS)
a) create */etc/docker/compose/graph-node/docker-compose.yml* file
a) create _/etc/docker/compose/graph-node/docker-compose.yml_ file
*/etc/docker/compose/graph-node/docker-compose.yml* (annotated - example for `mumbai` network)
_/etc/docker/compose/graph-node/docker-compose.yml_ (annotated - example for `mumbai` network)
```yaml
version: '3'
@ -318,7 +305,7 @@ services:
restart: on-failure
ports:
- '5432:5432'
command: ["postgres", "-cshared_preload_libraries=pg_stat_statements"]
command: ['postgres', '-cshared_preload_libraries=pg_stat_statements']
environment:
POSTGRES_USER: graph-node
POSTGRES_PASSWORD: < password >
@ -332,9 +319,7 @@ volumes:
driver: local
```
b) create */etc/systemd/system/docker-compose@graph-node.service* file
b) create _/etc/systemd/system/docker-compose@graph-node.service_ file
```shell
[Unit]
@ -357,8 +342,6 @@ ExecStopPost=/usr/bin/env docker-compose -p $PROJECT down
WantedBy=multi-user.target
```
c) run:
```shell
@ -371,16 +354,12 @@ optional - enable service to start at boot:
$ sudo systemctl enable docker-compose@graph-node.service
```
d) start aquarius service:
```shell
$ sudo systemctl start docker-compose@graph-node.service
```
check status:
```shell
@ -406,8 +385,6 @@ Jun 25 17:05:25 testvm systemd[1]: Finished graph-node service with docker compo
```
- check containers status
```shell
@ -418,35 +395,31 @@ ipfs/go-ipfs:v0.4.23 4001/tcp, 8080-8081/tcp, 0.0.0.0:5001->5001/t
postgres:15.3 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres Up 55 minutes
```
- check logs for graph-node container
```shell
$ docker logs graph-node [--follow]
```
#### Ocean-subgraph deployment
- install Node.js locally
- download and extract [Ocean-subgraph](https://github.com/oceanprotocol/ocean-subgraph) (check [here](https://github.com/oceanprotocol/ocean-subgraph/releases) the available releases)
- download and extract [Ocean-subgraph](https://github.com/oceanprotocol/ocean-subgraph) (check [here](https://github.com/oceanprotocol/ocean-subgraph/releases) the available releases)
- run inside the extracted directory:
```shell
$ npm i
```
then
then
(Note: in this example we are deploying on graph-node running for `mumbai` testnet )
Note: for `ocean-subgraph` deployment in kubernetes environment, both `graph-node` and `ipfs` services must be locally forwarded using `kubectl port-forward` command.
Note: for `ocean-subgraph` deployment in kubernetes environment, both `graph-node` and `ipfs` services must be locally forwarded using `kubectl port-forward` command.
```shell
$ npm run quickstart:mumbai
$ npm run quickstart:mumbai
> ocean-subgraph@3.0.8 quickstart:mumbai
> node ./scripts/generatenetworkssubgraphs.js mumbai && npm run codegen && npm run create:local && npm run deploy:local
@ -458,7 +431,6 @@ Skipping bsc
Skipping energyweb
Skipping moonriver
Skipping mainnet
Skipping goerli
Skipping polygonedge
Skipping gaiaxtestnet
Skipping alfajores

10734
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
{
"name": "ocean-subgraph",
"version": "4.0.0",
"version": "4.0.2",
"scripts": {
"start": "",
"quickstart:development": "node ./scripts/generatenetworkssubgraphs.js development && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:barge": "node ./scripts/generatenetworkssubgraphs.js development && npm run codegen && npm run create:local-barge && npm run deploy:local-barge",
"quickstart:rinkeby": "node ./scripts/generatenetworkssubgraphs.js rinkeby && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:goerli": "node ./scripts/generatenetworkssubgraphs.js goerli && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:ropsten": "node ./scripts/generatenetworkssubgraphs.js ropsten && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:mumbai": "node ./scripts/generatenetworkssubgraphs.js mumbai && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:moonbase": "node ./scripts/generatenetworkssubgraphs.js moonbase && npm run codegen && npm run create:local && npm run deploy:local",
@ -19,6 +18,8 @@
"quickstart:bsc": "node ./scripts/generatenetworkssubgraphs.js bsc && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:oasis_saphire_testnet": "node ./scripts/generatenetworkssubgraphs.js oasis_saphire_testnet && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:oasis_saphire": "node ./scripts/generatenetworkssubgraphs.js oasis_saphire && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:optimism": "node ./scripts/generatenetworkssubgraphs.js optimism && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:optimism_sepolia": "node ./scripts/generatenetworkssubgraphs.js optimism_sepolia && npm run codegen && npm run create:local && npm run deploy:local",
"create:thegraph": "graph create oceanprotocol/ocean-subgraph --node https://api.thegraph.com/deploy/",
"create:local": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-barge": "graph create oceanprotocol/ocean-subgraph --node http://172.15.0.15:8020",
@ -48,16 +49,14 @@
"changelog": "auto-changelog -p"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.56.0",
"@graphprotocol/graph-ts": "^0.30.0",
"@types/chai": "^4.3.5",
"@types/chai": "^4.3.11",
"@types/chai-spies": "^1.0.3",
"@types/mocha": "^10.0.2",
"@types/node": "^20.8.2",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@typescript-eslint/parser": "^6.19.0",
"auto-changelog": "^2.4.0",
"chai": "^4.3.7",
"chai": "^4.3.10",
"chai-spies": "^1.0.0",
"cross-fetch": "^3.1.6",
"eslint": "^7.32.0",
@ -71,18 +70,18 @@
"mocha": "^10.2.0",
"mock-local-storage": "^1.1.24",
"prettier": "^2.8.8",
"release-it": "^15.11.0",
"release-it": "^17.0.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"ts-node-register": "^1.0.0",
"typescript": "^5.2.2"
"typescript": "^5.4.5",
"@oceanprotocol/lib": "^2.7.0"
},
"dependencies": {
"@oceanprotocol/contracts": "^2.0.2",
"@oceanprotocol/lib": "^2.7.0",
"cross-fetch": "^3.1.6",
"ethereumjs-util": "^7.1.5"
"@oceanprotocol/contracts": "^2.0.3",
"@graphprotocol/graph-cli": "^0.71.0",
"@graphprotocol/graph-ts": "^0.31.0"
},
"repository": {
"type": "git",

View File

@ -403,7 +403,6 @@ type Template @entity{
id: ID!
fixedRateTemplates: [String!]
dispenserTemplates: [String!]
ssTemplates: [String!]
}
# Not tracking allocationToId or idToAllocation

View File

@ -118,6 +118,21 @@ export function handlePredictionPayout(event: PredictionPayout): void {
predictPrediction.payout = predictionPayout.id
predictPrediction.save()
let shouldUpdateSlot = false
const predictSlot = getPredictSlot(
event.address.toHexString(),
event.params.slot.toI32()
)
if (event.params.status == 1 && predictSlot.status !== 'Paying') {
predictSlot.status = 'Paying'
shouldUpdateSlot = true
}
if (event.params.status == 2 && predictSlot.status !== 'Canceled') {
predictSlot.status = 'Canceled'
shouldUpdateSlot = true
}
if (shouldUpdateSlot == true) predictSlot.save()
}
export function handleNewSubscription(event: NewSubscription): void {

View File

@ -3,8 +3,6 @@ import {
TokenRemoved,
OPCFeeChanged,
FactoryRouter,
SSContractAdded,
SSContractRemoved,
FixedRateContractAdded,
FixedRateContractRemoved,
DispenserContractAdded,
@ -91,32 +89,6 @@ export function handleTokenRemoved(event: TokenRemoved): void {
opc.approvedTokens = newList
opc.save()
}
export function handleSSContractAdded(event: SSContractAdded): void {
// add token to approvedTokens
const templates = getTemplates()
let existingContracts: string[]
if (!templates.ssTemplates) existingContracts = []
else existingContracts = templates.ssTemplates as string[]
if (!existingContracts.includes(event.params.contractAddress.toHexString()))
existingContracts.push(event.params.contractAddress.toHexString())
templates.ssTemplates = existingContracts
templates.save()
}
export function handleSSContractRemoved(event: SSContractRemoved): void {
const templates = getTemplates()
const newList: string[] = []
let existingContracts: string[]
if (!templates.ssTemplates) existingContracts = []
else existingContracts = templates.ssTemplates as string[]
if (!existingContracts || existingContracts.length < 1) return
while (existingContracts.length > 0) {
const role = existingContracts.shift().toString()
if (!role) break
if (role != event.params.contractAddress.toHexString()) newList.push(role)
}
templates.ssTemplates = newList
templates.save()
}
export function handleFixedRateContractAdded(
event: FixedRateContractAdded

View File

@ -52,6 +52,11 @@ export function updateFixedRateExchangeSupply(
fixedRateDetails.value.value8.toBigDecimal(),
baseToken.decimals
)
// update withMint state
fixedRateExchange.withMint = fixedRateDetails.value.value11
// update active state
fixedRateExchange.active = fixedRateDetails.value.value6
fixedRateExchange.save()
}

View File

@ -13,7 +13,7 @@ export function getGlobalStats(): GlobalStatistic {
let globalStats = GlobalStatistic.load(GLOBAL_ID)
if (!globalStats) {
globalStats = new GlobalStatistic(GLOBAL_ID)
globalStats.version = '4.0.0'
globalStats.version = '4.0.2'
globalStats.orderCount = 0
globalStats.fixedCount = 0
globalStats.datatokenCount = 0

View File

@ -268,10 +268,6 @@ dataSources:
handler: handleTokenRemoved
- event: OPCFeeChanged(indexed address,uint256,uint256,uint256,uint256)
handler: handleOPCFeeChanged
- event: SSContractAdded(indexed address,indexed address)
handler: handleSSContractAdded
- event: SSContractRemoved(indexed address,indexed address)
handler: handleSSContractRemoved
- event: FixedRateContractAdded(indexed address,indexed address)
handler: handleFixedRateContractAdded
- event: FixedRateContractRemoved(indexed address,indexed address)

View File

@ -44,7 +44,7 @@ describe('Fixed Rate Exchange tests', async () => {
const publishMarketSwapFee = '0.003'
const templateIndex = 1
const dtAmount = '10'
const datatoken = new Datatoken(web3, 8996)
// const datatoken = new Datatoken(web3, 8996)
let datatokenAddress: string
let fixedRateAddress: string
let baseTokenAddress: string
@ -108,7 +108,7 @@ describe('Fixed Rate Exchange tests', async () => {
fixedRate: price,
marketFee: publishMarketSwapFee,
allowedConsumer: ZERO_ADDRESS,
withMint: false
withMint: true
}
const result = await Factory.createNftWithDatatokenWithFixedRate(
@ -356,7 +356,8 @@ describe('Fixed Rate Exchange tests', async () => {
'incorrect value for: baseToken.id'
)
assert(
fixed.datatokenSupply === '0',
fixed.datatokenSupply ===
'115792089237316195423570985008687900000000000000000000000000',
'incorrect value for: datatokenSupply'
)
assert(
@ -378,7 +379,7 @@ describe('Fixed Rate Exchange tests', async () => {
fixed.allowedSwapper === ZERO_ADDRESS,
'incorrect value for: allowedSwapper'
)
assert(fixed.withMint === null, 'incorrect value for: withMint')
assert(fixed.withMint === true, 'incorrect value for: withMint')
assert(fixed.isMinter === null, 'incorrect value for: isMinter')
assert(fixed.updates, 'incorrect value for: updates.id')
assert(fixed.swaps, 'incorrect value for: swaps')
@ -496,125 +497,6 @@ describe('Fixed Rate Exchange tests', async () => {
'incorrect value: 3nd eventIndex'
)
})
it('Deactivates exchange', async () => {
const deactiveQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(deactiveQuery)
})
const initialActive = (await initialResponse.json()).data.fixedRateExchange
.active
assert(initialActive === true, 'incorrect value for: initialActive')
// Deactivate exchange
await fixedRate.deactivate(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(deactiveQuery)
})
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedActive.active === false, 'incorrect value for: updatedActive')
assert(
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
'incorrect value: eventIndex'
)
})
it('Activates exchange', async () => {
const activeQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(activeQuery)
})
const initialActive = (await initialResponse.json()).data.fixedRateExchange
.active
assert(initialActive === false, 'incorrect value for: initialActive')
// Activate exchange
await fixedRate.activate(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(activeQuery)
})
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedActive.active === true, 'incorrect value for: updatedActive')
assert(
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
'incorrect value: eventIndex'
)
})
it('Activate Minting', async () => {
const mintingQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const initialMint = (await initialResponse.json()).data.fixedRateExchange
.withMint
assert(initialMint === null, 'incorrect value for: initialMint')
// Activate minting
const tx = await fixedRate.activateMint(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const updatedMint = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedMint.withMint === true, 'incorrect value for: updatedMint')
assert(
updatedMint.eventIndex === tx.events.ExchangeMintStateChanged.logIndex,
'incorrect value for: eventIndex'
)
})
it('Deactivate Minting', async () => {
const mintingQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const initialMint = (await initialResponse.json()).data.fixedRateExchange
.withMint
assert(initialMint === true, 'incorrect value for: initialMint')
// Activate minting
const tx = await fixedRate.deactivateMint(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const updatedMint = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedMint.withMint === false, 'incorrect value for: updatedMint')
assert(
updatedMint.eventIndex === tx.events.ExchangeMintStateChanged.logIndex,
'incorrect value for: eventIndex'
)
})
it('User1 buys a datatoken', async () => {
const swapsQuery = {
@ -721,57 +603,63 @@ describe('Fixed Rate Exchange tests', async () => {
assert(swaps.eventIndex === tx.logIndex, 'incorrect value for: eventIndex')
assert(swaps.__typename === 'FixedRateExchangeSwap', 'incorrect __typename')
})
it('User1 sells a datatoken', async () => {
await datatoken.approve(datatokenAddress, fixedRateAddress, dtAmount, user1)
const tx = (await fixedRate.sellDatatokens(user1, exchangeId, '10', '9'))
.events?.Swapped
const oceanFeeAmount = web3.utils.fromWei(
new BN(tx.returnValues.oceanFeeAmount)
)
assert(tx != null)
await sleep(sleepMs)
const swapsQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){
swaps(orderBy: createdTimestamp, orderDirection: desc){
id
exchangeId{id}
by{id}
baseTokenAmount
dataTokenAmount
block
createdTimestamp
tx
eventIndex
oceanFeeAmount
__typename
}
}}`
it('Deactivate Minting', async () => {
const mintingQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint, eventIndex}}`
}
// Check initial swaps
const response = await fetch(subgraphUrl, {
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(swapsQuery)
body: JSON.stringify(mintingQuery)
})
const swaps = (await response.json()).data.fixedRateExchange.swaps[0]
const swappedAmount = web3.utils.fromWei(
new BN(tx.returnValues.baseTokenSwappedAmount)
)
const initialMint = (await initialResponse.json()).data.fixedRateExchange
.withMint
assert(initialMint === true, 'incorrect value for: initialMint')
// Activate minting
const tx = await fixedRate.deactivateMint(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const updatedMint = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedMint.withMint === false, 'incorrect value for: updatedMint')
assert(
swaps.id ===
`${tx.transactionHash}-${fixedRateId}-${tx.logIndex.toFixed(1)}`,
'incorrect: id'
updatedMint.eventIndex === tx.events.ExchangeMintStateChanged.logIndex,
'incorrect value for: eventIndex'
)
})
it('Activate Minting', async () => {
const mintingQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const initialMint = (await initialResponse.json()).data.fixedRateExchange
.withMint
assert(initialMint === false, 'incorrect value for: initialMint')
// Activate minting
const tx = await fixedRate.activateMint(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(mintingQuery)
})
const updatedMint = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedMint.withMint === true, 'incorrect value for: updatedMint')
assert(
updatedMint.eventIndex === tx.events.ExchangeMintStateChanged.logIndex,
'incorrect value for: eventIndex'
)
assert(swaps.exchangeId.id === fixedRateId, 'incorrect: exchangeId')
assert(swaps.by.id === user1, 'incorrect value for: id')
assert(swaps.baseTokenAmount === swappedAmount, 'incorrect baseTokenAmount')
assert(swaps.dataTokenAmount === dtAmount, 'incorrect: dataTokenAmount')
assert(swaps.block === tx.blockNumber, 'incorrect value for: block')
assert(swaps.createdTimestamp >= time, 'incorrect: createdTimestamp')
assert(swaps.createdTimestamp < time + 25, 'incorrect: createdTimestamp 2')
assert(swaps.oceanFeeAmount === oceanFeeAmount, 'incorrect: oceanFeeAmount')
assert(swaps.tx === tx.transactionHash, 'incorrect value for: tx')
assert(swaps.eventIndex === tx.logIndex, 'incorrect value for: eventIndex')
assert(swaps.__typename === 'FixedRateExchangeSwap', 'incorrect __typename')
})
it('Updates allowed swapper', async () => {
@ -810,4 +698,63 @@ describe('Fixed Rate Exchange tests', async () => {
'incorrect value for: eventIndex'
)
})
it('Deactivates exchange', async () => {
const deactiveQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(deactiveQuery)
})
const initialActive = (await initialResponse.json()).data.fixedRateExchange
.active
assert(initialActive === true, 'incorrect value for: initialActive')
// Deactivate exchange
await fixedRate.deactivate(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(deactiveQuery)
})
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedActive.active === false, 'incorrect value for: updatedActive')
assert(
updatedActive.eventIndex !== null && updatedActive.eventIndex >= 0,
'incorrect value: eventIndex'
)
})
it('Activates exchange', async () => {
const activeQuery = {
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
}
const initialResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(activeQuery)
})
const initialActive = (await initialResponse.json()).data.fixedRateExchange
.active
assert(initialActive === false, 'incorrect value for: initialActive')
// Activate exchange
await fixedRate.activate(publisher, exchangeId)
await sleep(sleepMs)
// Check the updated value for active
const updatedResponse = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(activeQuery)
})
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedActive.active === true, 'incorrect value for: updatedActive')
assert(
updatedActive.eventIndex !== null && updatedActive.eventIndex >= 0,
'incorrect value: eventIndex'
)
})
})

View File

@ -64,7 +64,7 @@ describe('User tests', async () => {
const publishMarketSwapFee = '0.003'
const templateIndex = 1
const dtAmount = '10'
const datatoken = new Datatoken(web3, 8996)
// const datatoken = new Datatoken(web3, 8996)
let datatokenAddress: string
let fixedRateAddress: string
let baseTokenAddress: string
@ -123,7 +123,7 @@ describe('User tests', async () => {
fixedRate: price,
marketFee: publishMarketSwapFee,
allowedConsumer: ZERO_ADDRESS,
withMint: false
withMint: true
}
const result = await Factory.createNftWithDatatokenWithFixedRate(
@ -196,27 +196,6 @@ describe('User tests', async () => {
assert(user.totalSales === '0', 'incorrect value for: totalSales')
assert(user.__typename === 'User', 'incorrect value for: __typename')
})
it('User1 sells a datatoken', async () => {
const initialUser = await userQuery(user1)
await datatoken.approve(datatokenAddress, fixedRateAddress, dtAmount, user1)
const tx = (await fixedRate.sellDatatokens(user1, exchangeId, '10', '9'))
.events?.Swapped
assert(tx != null)
const user = await userQuery(user1)
assert(user.id === user1, 'incorrect value for: id')
assert(user.tokenBalancesOwned.length === 0, 'incorrect tokenBalancesOwned')
assert(user.orders.length === 0, 'incorrect value for: orders')
assert(
user.freSwaps.length === initialUser.freSwaps.length,
'incorrect value for: freSwaps'
)
assert(user.totalOrders === '0', 'incorrect value for: totalOrders')
assert(user.totalSales === '0', 'incorrect value for: totalSales')
assert(user.__typename === 'User', 'incorrect value for: __typename')
})
it('Check user fields after publishing & ordering a datatoken', async () => {
// Start with publishing a new datatoken
const nftParams: NftCreateData = {