mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
parent
4e939c70c0
commit
d80ba60637
@ -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.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.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.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)
|
- [v4.subgraph.mumbai.oceanprotocol.com](https://v4.subgraph.mumbai.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql)
|
||||||
|
|
||||||
## ⛵ Example Queries
|
## ⛵ Example Queries
|
||||||
|
@ -3,32 +3,24 @@ Copyright 2023 Ocean Protocol Foundation
|
|||||||
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- [Kubernetes deployment](#kubernetes-deployment)
|
- [Kubernetes deployment](#kubernetes-deployment)
|
||||||
* [Postgresql](#postgresql)
|
- [Postgresql](#postgresql)
|
||||||
* [IPFS](#ipfs)
|
- [IPFS](#ipfs)
|
||||||
* [Graph-node](#graph-node)
|
- [Graph-node](#graph-node)
|
||||||
- [Docker Compose deployment](#docker-compose-deployment)
|
- [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)
|
- [Ocean-subgraph deployment](#ocean-subgraph-deployment)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Kubernetes 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
|
- PostgreSQL
|
||||||
|
|
||||||
- IPFS
|
- IPFS
|
||||||
|
|
||||||
|
|
||||||
Templates (yaml files) provided and could be customized based on the environment's specifics.
|
Templates (yaml files) provided and could be customized based on the environment's specifics.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Postgresql
|
##### Postgresql
|
||||||
|
|
||||||
It is recommended to deploy PostgreSQL as helm chart
|
It is recommended to deploy PostgreSQL as helm chart
|
||||||
@ -63,41 +55,41 @@ spec:
|
|||||||
app: ipfs
|
app: ipfs
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: ipfs/go-ipfs:v0.4.22
|
- image: ipfs/go-ipfs:v0.4.22
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /debug/metrics/prometheus
|
path: /debug/metrics/prometheus
|
||||||
port: api
|
port: api
|
||||||
scheme: HTTP
|
scheme: HTTP
|
||||||
initialDelaySeconds: 15
|
initialDelaySeconds: 15
|
||||||
periodSeconds: 3
|
periodSeconds: 3
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
name: s1-ipfs
|
name: s1-ipfs
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5001
|
- containerPort: 5001
|
||||||
name: api
|
name: api
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
name: gateway
|
name: gateway
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /debug/metrics/prometheus
|
path: /debug/metrics/prometheus
|
||||||
port: api
|
port: api
|
||||||
scheme: HTTP
|
scheme: HTTP
|
||||||
initialDelaySeconds: 15
|
initialDelaySeconds: 15
|
||||||
periodSeconds: 3
|
periodSeconds: 3
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
terminationMessagePath: /dev/termination-log
|
terminationMessagePath: /dev/termination-log
|
||||||
terminationMessagePolicy: File
|
terminationMessagePolicy: File
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /data/ipfs
|
- mountPath: /data/ipfs
|
||||||
name: ipfs-storage
|
name: ipfs-storage
|
||||||
dnsPolicy: ClusterFirst
|
dnsPolicy: ClusterFirst
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
schedulerName: default-scheduler
|
schedulerName: default-scheduler
|
||||||
@ -110,20 +102,20 @@ spec:
|
|||||||
partition: 0
|
partition: 0
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
- apiVersion: v1
|
- apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: ipfs-storage
|
name: ipfs-storage
|
||||||
spec:
|
spec:
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 1G
|
storage: 1G
|
||||||
volumeMode: Filesystem
|
volumeMode: Filesystem
|
||||||
status:
|
status:
|
||||||
phase: Pending
|
phase: Pending
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
@ -135,19 +127,17 @@ spec:
|
|||||||
clusterIP:
|
clusterIP:
|
||||||
clusterIPs:
|
clusterIPs:
|
||||||
ipFamilies:
|
ipFamilies:
|
||||||
- IPv4
|
- IPv4
|
||||||
ipFamilyPolicy: SingleStack
|
ipFamilyPolicy: SingleStack
|
||||||
ports:
|
ports:
|
||||||
- name: api
|
- name: api
|
||||||
port: 5001
|
port: 5001
|
||||||
- name: gateway
|
- name: gateway
|
||||||
port: 8080
|
port: 8080
|
||||||
selector:
|
selector:
|
||||||
app: ipfs
|
app: ipfs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Graph-node
|
##### Graph-node
|
||||||
|
|
||||||
The following annotated templated can be customized to deploy graph-node deployment and service:
|
The following annotated templated can be customized to deploy graph-node deployment and service:
|
||||||
@ -179,66 +169,66 @@ spec:
|
|||||||
app: mumbai-graph-node
|
app: mumbai-graph-node
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- env:
|
- env:
|
||||||
- name: ipfs
|
- name: ipfs
|
||||||
value: ipfs.<namespace>.svc.cluster.local:5001
|
value: ipfs.<namespace>.svc.cluster.local:5001
|
||||||
- name: postgres_host
|
- name: postgres_host
|
||||||
value: postgresql.<namespace>.svc.cluster.local
|
value: postgresql.<namespace>.svc.cluster.local
|
||||||
- name: postgres_user
|
- name: postgres_user
|
||||||
value: < postgresql user >
|
value: < postgresql user >
|
||||||
- name: postgres_pass
|
- name: postgres_pass
|
||||||
value: < postgresql database password >
|
value: < postgresql database password >
|
||||||
- name: postgres_db
|
- name: postgres_db
|
||||||
value: < postgresql database >
|
value: < postgresql database >
|
||||||
- name: ethereum
|
- name: ethereum
|
||||||
value: mumbai:https://polygon-mumbai.infura.io/v3/< INFURA ID>
|
value: mumbai:https://polygon-mumbai.infura.io/v3/< INFURA ID>
|
||||||
- name: GRAPH_KILL_IF_UNRESPONSIVE
|
- name: GRAPH_KILL_IF_UNRESPONSIVE
|
||||||
value: "true"
|
value: 'true'
|
||||||
image: graphprotocol/graph-node:v0.28.2
|
image: graphprotocol/graph-node:v0.28.2
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
port: 8000
|
port: 8000
|
||||||
scheme: HTTP
|
scheme: HTTP
|
||||||
initialDelaySeconds: 20
|
initialDelaySeconds: 20
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
name: mumbai-graph-node
|
name: mumbai-graph-node
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
name: graphql
|
name: graphql
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 8020
|
- containerPort: 8020
|
||||||
name: jsonrpc
|
name: jsonrpc
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 8030
|
- containerPort: 8030
|
||||||
name: indexnode
|
name: indexnode
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 8040
|
- containerPort: 8040
|
||||||
name: metrics
|
name: metrics
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
port: 8000
|
port: 8000
|
||||||
scheme: HTTP
|
scheme: HTTP
|
||||||
initialDelaySeconds: 20
|
initialDelaySeconds: 20
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: "2"
|
cpu: '2'
|
||||||
memory: 1536Mi
|
memory: 1536Mi
|
||||||
requests:
|
requests:
|
||||||
cpu: 1500m
|
cpu: 1500m
|
||||||
memory: 1536Mi
|
memory: 1536Mi
|
||||||
terminationMessagePath: /dev/termination-log
|
terminationMessagePath: /dev/termination-log
|
||||||
terminationMessagePolicy: File
|
terminationMessagePolicy: File
|
||||||
dnsPolicy: ClusterFirst
|
dnsPolicy: ClusterFirst
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
schedulerName: default-scheduler
|
schedulerName: default-scheduler
|
||||||
@ -249,37 +239,34 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: mumbai-graph-node
|
app: mumbai-graph-node
|
||||||
name: mumbai-graph-node
|
name: mumbai-graph-node
|
||||||
spec:
|
spec:
|
||||||
clusterIP:
|
clusterIP:
|
||||||
clusterIPs:
|
clusterIPs:
|
||||||
internalTrafficPolicy: Cluster
|
internalTrafficPolicy: Cluster
|
||||||
ipFamilies:
|
ipFamilies:
|
||||||
- IPv4
|
- IPv4
|
||||||
ipFamilyPolicy: SingleStack
|
ipFamilyPolicy: SingleStack
|
||||||
ports:
|
ports:
|
||||||
- name: graphql
|
- name: graphql
|
||||||
port: 8000
|
port: 8000
|
||||||
- name: jsonrpc
|
- name: jsonrpc
|
||||||
port: 8020
|
port: 8020
|
||||||
- name: indexnode
|
- name: indexnode
|
||||||
port: 8030
|
port: 8030
|
||||||
- name: metrics
|
- name: metrics
|
||||||
port: 8040
|
port: 8040
|
||||||
selector:
|
selector:
|
||||||
app: mumbai-graph-node
|
app: mumbai-graph-node
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Docker Compose deployment
|
#### Docker Compose deployment
|
||||||
|
|
||||||
##### Single systemd service (Graph-node+Postgresql+IPFS)
|
##### 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
|
```yaml
|
||||||
version: '3'
|
version: '3'
|
||||||
@ -318,7 +305,7 @@ services:
|
|||||||
restart: on-failure
|
restart: on-failure
|
||||||
ports:
|
ports:
|
||||||
- '5432:5432'
|
- '5432:5432'
|
||||||
command: ["postgres", "-cshared_preload_libraries=pg_stat_statements"]
|
command: ['postgres', '-cshared_preload_libraries=pg_stat_statements']
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: graph-node
|
POSTGRES_USER: graph-node
|
||||||
POSTGRES_PASSWORD: < password >
|
POSTGRES_PASSWORD: < password >
|
||||||
@ -332,9 +319,7 @@ volumes:
|
|||||||
driver: local
|
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
|
```shell
|
||||||
[Unit]
|
[Unit]
|
||||||
@ -357,8 +342,6 @@ ExecStopPost=/usr/bin/env docker-compose -p $PROJECT down
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c) run:
|
c) run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
@ -371,16 +354,12 @@ optional - enable service to start at boot:
|
|||||||
$ sudo systemctl enable docker-compose@graph-node.service
|
$ sudo systemctl enable docker-compose@graph-node.service
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
d) start aquarius service:
|
d) start aquarius service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ sudo systemctl start docker-compose@graph-node.service
|
$ sudo systemctl start docker-compose@graph-node.service
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
check status:
|
check status:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
@ -406,8 +385,6 @@ Jun 25 17:05:25 testvm systemd[1]: Finished graph-node service with docker compo
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- check containers status
|
- check containers status
|
||||||
|
|
||||||
```shell
|
```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
|
postgres:15.3 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres Up 55 minutes
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- check logs for graph-node container
|
- check logs for graph-node container
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ docker logs graph-node [--follow]
|
$ docker logs graph-node [--follow]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Ocean-subgraph deployment
|
#### Ocean-subgraph deployment
|
||||||
|
|
||||||
- install Node.js locally
|
- 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:
|
- run inside the extracted directory:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ npm i
|
$ npm i
|
||||||
```
|
```
|
||||||
|
|
||||||
then
|
then
|
||||||
|
|
||||||
(Note: in this example we are deploying on graph-node running for `mumbai` testnet )
|
(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
|
```shell
|
||||||
$ npm run quickstart:mumbai
|
$ npm run quickstart:mumbai
|
||||||
|
|
||||||
> ocean-subgraph@3.0.8 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
|
> 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 energyweb
|
||||||
Skipping moonriver
|
Skipping moonriver
|
||||||
Skipping mainnet
|
Skipping mainnet
|
||||||
Skipping goerli
|
|
||||||
Skipping polygonedge
|
Skipping polygonedge
|
||||||
Skipping gaiaxtestnet
|
Skipping gaiaxtestnet
|
||||||
Skipping alfajores
|
Skipping alfajores
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
"quickstart:development": "node ./scripts/generatenetworkssubgraphs.js development && npm run codegen && npm run create:local && npm run deploy:local",
|
"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: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: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: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: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",
|
"quickstart:moonbase": "node ./scripts/generatenetworkssubgraphs.js moonbase && npm run codegen && npm run create:local && npm run deploy:local",
|
||||||
|
@ -118,6 +118,21 @@ export function handlePredictionPayout(event: PredictionPayout): void {
|
|||||||
|
|
||||||
predictPrediction.payout = predictionPayout.id
|
predictPrediction.payout = predictionPayout.id
|
||||||
predictPrediction.save()
|
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 {
|
export function handleNewSubscription(event: NewSubscription): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user