Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results sprint 25 #81

Merged
merged 17 commits into from
Dec 12, 2023
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
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
}
],
"no-trailing-spaces": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
"object-curly-spacing": ["error", "always"],
"@typescript-eslint/no-explicit-any": "error",
"comma-dangle": [
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
resetProject: true
secrets:
accessToken: ${{ secrets.SUBQL_ACCESS_TOKEN }}
ethNodeApiKey: ${{ secrets.ETH_NODE_API_KEY }}

subql_deploy_centrifuge_staging:
if: ${{ github.repository == 'centrifuge/pools-subql' && github.ref_name == 'main' }}
Expand All @@ -45,6 +46,7 @@ jobs:
resetProject: true
secrets:
accessToken: ${{ secrets.SUBQL_ACCESS_TOKEN }}
ethNodeApiKey: ${{ secrets.ETH_NODE_API_KEY }}

subql_deploy_centrifuge_production:
if: ${{ github.repository == 'centrifuge/pools-subql' && startsWith(github.ref_name, 'release-') }}
Expand All @@ -61,3 +63,4 @@ jobs:
resetProject: false
secrets:
accessToken: ${{ secrets.SUBQL_ACCESS_TOKEN }}
ethNodeApiKey: ${{ secrets.ETH_NODE_API_KEY }}
47 changes: 34 additions & 13 deletions .github/workflows/subql_deploy_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,36 @@ on:
secrets:
accessToken:
required: true
ethNodeApiKey:
required: true

jobs:
subql_deploy_workflow:
runs-on: ubuntu-latest
env:
SUBQL_INDEXER_VERSION: v3.1.0
SUBQL_INDEXER_VERSION: v3.4.7
SUBQL_ETH_INDEXER_VERSION: v3.1.2
SUBQL_QUERY_VERSION: v2.6.0
CHAIN_ID: ${{ inputs.chainId }}
SUBQL_ACCESS_TOKEN: ${{ secrets.accessToken }}
SUBQL_PROJ_ORG: ${{ inputs.projOrg }}
SUBQL_PROJ_IMAGE: ${{ inputs.projImage }}
SUBQL_DEPLOYMENT_TYPE: ${{ inputs.deploymentType }}
ETH_NODE_API_KEY: ${{ secrets.ethNodeApiKey }}
steps:
- name: Check out repo's default branch
uses: actions/checkout@v3
- name: Generate new project.yaml
run: yq ". *=d load(\"chains/$CHAIN_ID.yaml\")" chains/base.yaml > project.yaml
- name: Generate new project-centrifuge.yaml
run: yq ". *=d load(\"chains-cfg/$CHAIN_ID.yaml\")" chains-cfg/base.yaml > project-centrifuge.yaml
- name: Generate new project-ethereum.yaml
run: yq ". *=d load(\"chains-evm/$CHAIN_ID.yaml\")" chains-evm/base.yaml | envsubst > project-ethereum.yaml
- name: Extract Chain Parameters to ENV
run: |
echo "SUBQL_PROJ_NAME=$(yq '.name' project.yaml)" >> $GITHUB_ENV
echo "SUBQL_PROJ_DECRIPTION=$(yq '.description' project.yaml)" >> $GITHUB_ENV
echo "SUBQL_ENDPOINT=$(yq '.network.endpoint' project.yaml)" >> $GITHUB_ENV
echo "SUBQL_PROJ_NAME=$(yq '.name' project-centrifuge.yaml)" >> $GITHUB_ENV
echo "SUBQL_PROJ_DECRIPTION=$(yq '.description' project-centrifuge.yaml)" >> $GITHUB_ENV
echo "SUBQL_CFG_ENDPOINT=$(yq '.network.endpoint' project-centrifuge.yaml)" >> $GITHUB_ENV
echo "SUBQL_EVM_ENDPOINT=$(yq '.network.endpoint' project-ethereum.yaml)" >> $GITHUB_ENV
echo "SUBQL_EVM_DICT=$(yq '.network.dictionary' project-ethereum.yaml)" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -56,10 +64,9 @@ jobs:
run: yarn subql --version
- name: Publish SubQL version
run: |
OUTPUT=$(npx subql publish -o -f .)
IPFSCID="${OUTPUT##*' '}"
echo "IPFSCID=$IPFSCID" >> $GITHUB_ENV
echo "CID: $IPFSCID"
npx subql publish -o -f .
echo "CFG_IPFSCID=$(cat .project-centrifuge-cid)" >> $GITHUB_ENV
echo "EVM_IPFSCID=$(cat .project-ethereum-cid)" >> $GITHUB_ENV
- name: Delete Project
if: ${{ inputs.resetProject }}
run: |
Expand All @@ -77,15 +84,29 @@ jobs:
--org="$SUBQL_PROJ_ORG" \
--projectName="$SUBQL_PROJ_NAME" \
--logoURL="$SUBQL_PROJ_IMAGE"
- name: Deploy Version
- name: Deploy CFG Version
run: |
npx subql deployment:deploy \
-d \
--org="$SUBQL_PROJ_ORG" \
--endpoint="$SUBQL_ENDPOINT" \
--endpoint="$SUBQL_CFG_ENDPOINT" \
--projectName="$SUBQL_PROJ_NAME" \
--ipfsCID="$IPFSCID" \
--ipfsCID="$CFG_IPFSCID" \
--type=$SUBQL_DEPLOYMENT_TYPE \
--disableHistorical \
--indexerVersion="$SUBQL_INDEXER_VERSION" \
--queryVersion="$SUBQL_QUERY_VERSION"
# - name: Deploy EVM Version
# run: |
# npx subql deployment:deploy \
# -d \
# --org="$SUBQL_PROJ_ORG" \
# --endpoint="$SUBQL_EVM_ENDPOINT" \
# --dict="$SUBQL_EVM_DICT" \
# --projectName="$SUBQL_PROJ_NAME" \
# --ipfsCID="$EVM_IPFSCID" \
# --type=$SUBQL_DEPLOYMENT_TYPE \
# --disableHistorical \
# --indexerBatchSize=30 \
# --indexerVersion="$SUBQL_ETH_INDEXER_VERSION" \
# --queryVersion="$SUBQL_QUERY_VERSION"
20 changes: 11 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ jobs:
name: 'Check Build'
runs-on: ubuntu-latest
env:
SUBQL_INDEXER_VERSION: v1.21.1
SUBQL_QUERY_VERSION: v1.11.0
CHAIN_ID: development
SUBQL_INDEXER_VERSION: v3.4.7
SUBQL_QUERY_VERSION: v2.6.0
CHAIN_ID: demo
steps:
- name: Check out repo's default branch
uses: actions/checkout@v3
- name: Generate new project.yaml
run: yq ". *=d load(\"chains/$CHAIN_ID.yaml\")" chains/base.yaml > project.yaml
- name: Generate new project-centrifuge.yaml
run: yq ". *=d load(\"chains-cfg/$CHAIN_ID.yaml\")" chains-cfg/base.yaml > project-centrifuge.yaml
- name: Generate new project-ethereum.yaml
run: yq ". *=d load(\"chains-evm/$CHAIN_ID.yaml\")" chains-evm/base.yaml | envsubst > project-ethereum.yaml
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -41,11 +43,11 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: Initialise project.yaml
run: cp chains/base.yaml project.yaml
run: cp chains-cfg/base.yaml project.yaml
- name: 'Setup Node'
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: 'Install Dependencies'
run: yarn install
- name: 'Generate Entities'
Expand All @@ -59,11 +61,11 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: Initialise project.yaml
run: cp chains/base.yaml project.yaml
run: cp chains-cfg/base.yaml project.yaml
- name: 'Setup Node'
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: 'Install Dependencies'
run: yarn install
- name: 'Generate Entities'
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ src/types

.data/

project.yaml
centrifuge.yaml

**/project.yaml
**/project-centrifuge.yaml
**/project-ethereum.yaml
*-cid
File renamed without changes.
7 changes: 6 additions & 1 deletion chains/base.yaml → chains-cfg/base.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
specVersion: 1.0.0
name: centrifuge-pools
description: 'SubQuery API powered by EMBRIO.tech to query Centrifuge chain data for analytics insights on how Centrifuge is unlocking economic opportunity for all by connecting people to borrow and lend money transparently and cost-effectively.'
version: 1.0.0
runner:
node:
Expand All @@ -8,7 +9,6 @@ runner:
query:
name: '@subql/query'
version: '2'
description: 'SubQuery API powered by EMBRIO.tech to query Centrifuge chain data for analytics insights on how Centrifuge is unlocking economic opportunity for all by connecting people to borrow and lend money transparently and cost-effectively.'
repository: https://github.com/centrifuge/pools-subql
schema:
file: ./schema.graphql
Expand Down Expand Up @@ -99,6 +99,11 @@ dataSources:
filter:
module: loans
method: Closed
- handler: handleLoanDebtTransferred
kind: substrate/EventHandler
filter:
module: loans
method: DebtTransferred
- handler: handleTokenTransfer
kind: substrate/EventHandler
filter:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions chains-cfg/development-embrio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'centrifuge-subql'
repository: 'https://github.com/embrio-tech/centrifuge-subql'
network:
endpoint: wss://fullnode.demo.k-f.dev/public-ws
chainId: '0xe0e40f62affe742eb92d75c07830671ef3e0cc6efc1ecaf81cf34a28148e91f0'
chaintypes:
file: ./dist/chaintypes.js
dataSources:
- kind: substrate/Runtime
startBlock: 1534900 #1st October 2023
File renamed without changes.
47 changes: 47 additions & 0 deletions chains-evm/base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
specVersion: 1.0.0
name: centrifuge-pools
version: 1.0.0
runner:
node:
name: '@subql/node-ethereum'
version: '3'
query:
name: '@subql/query'
version: '2'
description: 'SubQuery API powered by EMBRIO.tech to query Centrifuge chain data for analytics insights on how Centrifuge is unlocking economic opportunity for all by connecting people to borrow and lend money transparently and cost-effectively.'
repository: https://github.com/centrifuge/pools-subql
schema:
file: './schema.graphql'
dataSources:
- kind: ethereum/Runtime
startBlock: 9787696
options:
abi: poolManager
address: '0x53c155d44C03CC28f892f90aA0C442850716D75F'
assets:
poolManager:
file: './poolManager.abi.json'
mapping:
file: './dist/index.js'
handlers:
- handler: handleEvmDeployTranche
kind: ethereum/LogHandler
filter:
topics:
- DeployTranche(uint64 indexed poolId, bytes16 indexed trancheId, address indexed token)
templates:
- name: TrancheTracker
kind: ethereum/Runtime
options:
abi: erc20
assets:
erc20:
file: './erc20.abi.json'
mapping:
file: ./dist/index.js
handlers:
- handler: handleEvmTransfer
kind: ethereum/LogHandler
filter:
topics:
- Transfer(address indexed from, address indexed to, uint256 value)
4 changes: 4 additions & 0 deletions chains-evm/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
network:
chainId: '5' #Goerli
endpoint: "https://goerli.infura.io/v3/${ETH_NODE_API_KEY}"
dictionary: "https://dict-tyk.subquery.network/query/eth-goerli"
6 changes: 6 additions & 0 deletions chains-evm/development-embrio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: 'centrifuge-subql'
repository: 'https://github.com/embrio-tech/centrifuge-subql'
network:
chainId: '5' #Goerli
endpoint: "https://goerli.infura.io/v3/${ETH_NODE_API_KEY}"
dictionary: "https://dict-tyk.subquery.network/query/eth-goerli"
7 changes: 0 additions & 7 deletions chains/development-embrio.yaml

This file was deleted.

Loading