Skip to content

Commit

Permalink
fix: change to bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
hangleang committed Jun 4, 2024
1 parent 0e27868 commit 9886581
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions subgraph/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ const path = require("path");

module.exports = {
root: true,
extends: ["../.eslintrc.js", "plugin:@typescript-eslint/recommended"],
extends: ["../.eslintrc.js"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
parserOptions: {
project: path.resolve(__dirname, "./tsconfig.json"),
sourceType: "module",
Expand Down
4 changes: 2 additions & 2 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type MACI @entity {
id: ID!
owner: Bytes! # address
stateTreeDepth: Int! # uint8
stateTreeDepth: BigInt! # uint8
updatedAt: BigInt!
blockNumber: BigInt!
txHash: Bytes!
Expand Down Expand Up @@ -39,7 +39,7 @@ type Poll @entity {
id: Bytes! # poll address
pollId: BigInt # uint256
duration: BigInt! # uint256
treeDepth: Int! # uint8
treeDepth: BigInt! # uint8
maxMessages: BigInt
maxVoteOption: BigInt
messageProcessor: Bytes # address
Expand Down
3 changes: 1 addition & 2 deletions subgraph/src/maci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export function handleDeployPoll(event: DeployPollEvent): void {
entity.subsidy = event.params.pollAddr.subsidy;
entity.maxMessages = maxValues.value0;
entity.maxVoteOption = maxValues.value1;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
entity.treeDepth = treeDepths.value0;
entity.treeDepth = GraphBN.fromI32(treeDepths.value0);
entity.duration = durations.value1;

entity.blockNumber = event.block.number;
Expand Down
3 changes: 1 addition & 2 deletions subgraph/src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export const createOrLoadMACI = (
if (!maci) {
maci = new MACI(DEFAULT_MACI_ID);
maci.owner = owner !== null ? owner : (event.transaction.from as Bytes);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
maci.stateTreeDepth = stateTreeDepth.toI32();
maci.stateTreeDepth = stateTreeDepth;
maci.updatedAt = event.block.timestamp;
maci.blockNumber = event.block.number;
maci.txHash = event.transaction.hash;
Expand Down

0 comments on commit 9886581

Please sign in to comment.