Skip to content

Commit

Permalink
fix: bumped dependencies and fixed default values missing on newer gr…
Browse files Browse the repository at this point in the history
…aph-cli
  • Loading branch information
juanmardefago committed Feb 26, 2024
1 parent f68ba24 commit 46a6ffc
Show file tree
Hide file tree
Showing 4 changed files with 1,292 additions and 1,391 deletions.
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

0 comments on commit 46a6ffc

Please sign in to comment.