From 79501feb7a4820a83d435cedf08260a7a236ab06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernani=20S=C3=A3o=20Thiago?= Date: Thu, 16 Nov 2023 11:36:55 -0300 Subject: [PATCH] Support Cronos (#13) add support for cronos network --- .github/workflows/all.yaml | 9 +++++---- .github/workflows/master.yaml | 8 ++++---- .github/workflows/qa.yaml | 10 ++++++---- README.md | 6 +++--- config/cronos-mainnet.json | 11 +++++++++++ config/goerli.json | 10 ---------- package.json | 5 ++--- subgraph.template.yaml | 5 ++++- 8 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 config/cronos-mainnet.json delete mode 100644 config/goerli.json diff --git a/.github/workflows/all.yaml b/.github/workflows/all.yaml index 939cc82..d75bf0e 100644 --- a/.github/workflows/all.yaml +++ b/.github/workflows/all.yaml @@ -23,11 +23,12 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.GHB_TOKEN }} - name: Lint run: npm run lint - - name: Build Goerli - run: npm run build:goerli + - name: Test + run: npm run test - name: Build Mumbai run: npm run build:mumbai + - name: Build Cronos + run: npm run build:cronos-mainnet - name: Build Polygon run: npm run build:polygon - - name: Test - run: npm run test + diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 66da709..521008a 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -25,14 +25,14 @@ jobs: run: npm run lint - name: Subgraph Auth run: yarn graph:auth -- ${{ secrets.THEGRAPH_API_KEY }} - - name: Build Goerli - run: npm run build:goerli - - name: Deploy Goerli Hosted Service - run: npm run deploy:goerli - name: Build Mumbai run: npm run build:mumbai - name: Deploy Mumbai Hosted Service run: npm run deploy:mumbai + - name: Build Cronos + run: npm run build:cronos-mainnet + - name: Deploy Self-hosted Cronos + run: npx graph deploy --node ${{ secrets.SELF_HOSTED_SUBGRAPH_URL }} --version-label ${{ github.sha }} cronos-mainnet_prod_nft-roles - name: Build Polygon run: npm run build:polygon - name: Test diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 2ff34e4..8e67a95 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -23,14 +23,16 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.GHB_TOKEN }} - name: Lint run: npm run lint - - name: Build Goerli - run: npm run build:goerli + - name: Test + run: npm run test - name: Build Mumbai run: npm run build:mumbai + - name: Build Cronos + run: npm run build:cronos-mainnet + - name: Deploy Self-hosted Cronos QA + run: npx graph deploy --node ${{ secrets.SELF_HOSTED_SUBGRAPH_URL }} --version-label qa cronos-mainnet_qa_nft-roles - name: Build Polygon run: npm run build:polygon - - name: Test - run: npm run test - name: Delete Satsuma Polygon QA run: | curl -X DELETE https://subgraphs.alchemy.com/api/subgraphs/8c268d3e8b83112a7d0c732a9b88ba1c732da600bffaf68790171b9a0b5d5394/polygon-roles-registry/qa/delete -H 'x-api-key: ${{ secrets.SATSUMA_DEPLOY_KEY }}' diff --git a/README.md b/README.md index 7e12bd6..c32ed6c 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,16 @@ Get started by installing dependencies, building the project and running the tes ```shell npm ci -npm run build:goerli +npm run build:mumbai npm test ``` ## Build Project Building subgraphs consist in generating the code and building the project against a manifest file. This repository -provides a subgraph manifest for each network supported. You can build the project for **Goerli** with the following +provides a subgraph manifest for each network supported. You can build the project for **Mumbai** with the following command: ```shell -cp subgraph-goerli.yaml subgraph.yaml && graph codegen subgraph.yaml +npm run build:mumbai ``` diff --git a/config/cronos-mainnet.json b/config/cronos-mainnet.json new file mode 100644 index 0000000..ca7806d --- /dev/null +++ b/config/cronos-mainnet.json @@ -0,0 +1,11 @@ +{ + "isSelfHosted": true, + "network": "cronos-mainnet", + "ERC721": [ + { + "name": "BoredCandyCity", + "address": "0xe1049178296ce004996afb16b0816c5a95ac8482", + "startBlock": 5203166 + } + ] +} diff --git a/config/goerli.json b/config/goerli.json deleted file mode 100644 index d06c149..0000000 --- a/config/goerli.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "goerli", - "ERC721": [ - { - "name": "ChronosTraveler", - "address": "0x450c91d1fe9f3d57b91218f6ff96f7994eec4d32", - "startBlock": 8099655 - } - ] -} \ No newline at end of file diff --git a/package.json b/package.json index 7ff6eef..53b10a1 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,12 @@ }, "scripts": { "graph:auth": "graph auth --product hosted-service", - "build:goerli": "node mustache.config.js goerli && graph codegen subgraph.yaml && graph build subgraph.yaml", "build:mumbai": "node mustache.config.js mumbai && graph codegen subgraph.yaml && graph build subgraph.yaml", "build:polygon": "node mustache.config.js polygon && graph codegen subgraph.yaml && graph build subgraph.yaml", - "deploy:goerli": "graph deploy --node https://api.thegraph.com/deploy/ orium-network/nft-roles-goerli", + "build:cronos-mainnet": "node mustache.config.js cronos-mainnet && graph codegen subgraph.yaml && graph build subgraph.yaml", "deploy:mumbai": "graph deploy --node https://api.thegraph.com/deploy/ orium-network/nft-roles-mumbai", "deploy:polygon": "graph deploy --node https://api.thegraph.com/deploy/ orium-network/nft-roles-polygon", - "test": "graph test", + "test": "node mustache.config.js polygon && graph codegen subgraph.yaml && graph test", "coverage": "graph test -- -c", "lint": "npx eslint src/", "lint:fix": "npx eslint src/ --fix && npx prettier --write .", diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 1203296..216c436 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -58,6 +58,9 @@ dataSources: network: {{network}} source: abi: ERC7432 +{{#isSelfHosted}} + startBlock: 1 +{{/isSelfHosted}} mapping: kind: ethereum/events apiVersion: 0.0.6 @@ -79,4 +82,4 @@ dataSources: handler: handleRoleRevoked - event: RoleApprovalForAll(indexed address,indexed address,bool) handler: handleRoleApprovalForAll - file: ./src/erc7432/index.ts \ No newline at end of file + file: ./src/erc7432/index.ts