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

fix: bumped dependencies and fixed default values missing on newer graph-cli #7

Merged
merged 2 commits into from
Jun 12, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/deploy-production-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '20'
registry-url: https://registry.npmjs.org
- name: yarn add ts-node
run: yarn add ts-node
Expand All @@ -28,6 +28,6 @@ jobs:

# Run scripts
- name: Prepare mainnet
run: ./node_modules/.bin/mustache ./config/mainnet.json subgraph.template.yaml > subgraph.yaml && ./node_modules/@graphprotocol/graph-cli/bin/graph codegen --output-dir src/types/
run: ./node_modules/.bin/mustache ./config/mainnet.json subgraph.template.yaml > subgraph.yaml && ./node_modules/@graphprotocol/graph-cli/bin/run codegen --output-dir src/types/
- name: Deploy to mainnet staging
run: ./node_modules/@graphprotocol/graph-cli/bin/graph deploy graphprotocol/billing --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{secrets.access_token}}
run: ./node_modules/@graphprotocol/graph-cli/bin/run deploy graphprotocol/billing --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{secrets.access_token}}
6 changes: 3 additions & 3 deletions .github/workflows/deploy-staging-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '20'
registry-url: https://registry.npmjs.org
- name: yarn add ts-node
run: yarn add ts-node
Expand All @@ -28,6 +28,6 @@ jobs:

# Run scripts
- name: Prepare mainnet
run: ./node_modules/.bin/mustache ./config/mainnet.json subgraph.template.yaml > subgraph.yaml && ./node_modules/@graphprotocol/graph-cli/bin/graph codegen --output-dir src/types/
run: ./node_modules/.bin/mustache ./config/mainnet.json subgraph.template.yaml > subgraph.yaml && ./node_modules/@graphprotocol/graph-cli/bin/run codegen --output-dir src/types/
- name: Deploy to mainnet staging
run: ./node_modules/@graphprotocol/graph-cli/bin/graph deploy graphprotocol/billing-staging --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{secrets.access_token}}
run: ./node_modules/@graphprotocol/graph-cli/bin/run deploy graphprotocol/billing-staging --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{secrets.access_token}}
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '20'
registry-url: https://registry.npmjs.org
- name: yarn add ts-node
run: yarn add ts-node
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"deploy-testnet": "yarn && yarn prepare:testnet && graph deploy davekaj/billing --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy-mainnet": "yarn && yarn prepare:mainnet && graph deploy graphprotocol/billing --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy-test": "yarn && yarn prepare:mainnet && graph deploy <SUBGRAPH_NAME> --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy-studio": "yarn && yarn prepare:mainnet && graph deploy --studio graph-billing-arbitrum",
"lint": "yarn eslint .",
"lint-fix": "eslint . --fix",
"prettier": "prettier '**/*.ts'",
"prettier-write": "prettier --write '**/*.ts'"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.29.0",
"@graphprotocol/graph-ts": "^0.26.0",
"@graphprotocol/graph-cli": "0.68.0",
"@graphprotocol/graph-ts": "0.32.0",
"@types/node": "16.4.7",
"@typescript-eslint/eslint-plugin": "4.28.5",
"@typescript-eslint/parser": "4.28.5",
Expand Down
9 changes: 9 additions & 0 deletions src/mappings/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export function getBilling(eventAddress: Address): Billing {
billing = new Billing(DEFAULT_BILLING_ID)
let contract = BillingContract.bind(eventAddress)
billing.governor = contract.governor()
billing.totalTokensAdded = BigInt.fromI32(0)
billing.totalTokensPulled = BigInt.fromI32(0)
billing.totalTokensRemoved = BigInt.fromI32(0)
billing.totalCurrentBalance = BigInt.fromI32(0)
billing.save()
}

Expand All @@ -28,6 +32,11 @@ export function createOrLoadUser(userAddress: Address): User {
let user = User.load(id)
if (user == null) {
user = new User(id)
user.billingBalance = BigInt.fromI32(0)
user.totalTokensAdded = BigInt.fromI32(0)
user.totalTokensPulled = BigInt.fromI32(0)
user.totalTokensRemoved = BigInt.fromI32(0)
user.polygonGRTBalance = BigInt.fromI32(0)
}
return user as User
}
Expand Down
4 changes: 3 additions & 1 deletion subgraph.template.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
specVersion: 0.0.2
specVersion: 1.0.0
description: The Gateway Billing Subgraph
repository: https://github.com/edgeandnode/billing-subgraph
schema:
file: ./schema.graphql
indexerHints:
prune: auto
dataSources:
- kind: ethereum/contract
name: Billing
Expand Down
Loading
Loading