Skip to content

Commit

Permalink
Fix govenr subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Nov 6, 2023
1 parent 9520dbc commit 05d1def
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 204 deletions.
4 changes: 2 additions & 2 deletions packages/react-app/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const networks = Object.freeze({
name: 'Goerli tesnet',
explorer: 'etherscan',
questsSubgraph: 'https://api.studio.thegraph.com/query/33583/quests-goerli/version/latest',
governSubgraph: 'https://api.thegraph.com/subgraphs/name/corantin/govern-goerli',
governSubgraph: 'https://api.studio.thegraph.com/query/33583/govern-goerli/version/latest',
tokenPairSubgraph: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
questFactoryAddress: HardhatDeployement[5].goerli.contracts.QuestFactory.address,
celesteAddress: HardhatDeployement[5].goerli.contracts.Celeste.address,
Expand All @@ -24,7 +24,7 @@ export const networks = Object.freeze({
},
goerliStaging: {
stagingOf: 'goerli',
governSubgraph: 'https://api.thegraph.com/subgraphs/name/corantin/govern-goerli-staging',
// governSubgraph: 'https://api.thegraph.com/subgraphs/name/corantin/govern-goerli-staging',
} as StagingNetworkModel,
gnosis: {
networkId: 'xdai',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
startBlock: {{startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.1
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
startBlock: {{startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.4
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Collateral
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
startBlock: {{startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.4
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Collateral
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
startBlock: {{startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.1
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- RegistryEntry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit subgraph.yaml,this is a generated file.
# Instead, edit subgraph.template.yaml and run `yarn manifest-<network>-[staging]`
specVersion: 0.0.2
specVersion: 0.0.5
description: A template for Aragon subgraphs
repository: https://github.com/aragon/govern
schema:
Expand Down
6 changes: 3 additions & 3 deletions packages/subgraphs/govern-subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"manifest:gnosis": "node ./scripts/mustache gnosis",
"build": "graph build",
"codegen": "graph codegen",
"deploy:goerli": "dotenv -- cross-var yarn manifest:goerli && graph deploy corantin/govern-goerli --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token %THE_GRAPH_ACCESS_TOKEN%",
"deploy:goerli": "graph deploy --studio govern-goerli",
"deploy:goerli-staging": "dotenv -- cross-var yarn manifest:goerli && graph deploy corantin/govern-goerli-staging --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token %THE_GRAPH_ACCESS_TOKEN%",
"deploy:gnosis": "dotenv -- cross-var yarn manifest:gnosis && graph deploy corantin/govern-1hive-xdai --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token %THE_GRAPH_ACCESS_TOKEN%",
"deploy:gnosis-staging": "dotenv -- cross-var yarn manifest:gnosis && graph deploy corantin/govern-1hive-gnosis-staging --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token %THE_GRAPH_ACCESS_TOKEN%",
Expand All @@ -19,8 +19,8 @@
"graph": "graph"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.19.0",
"@graphprotocol/graph-ts": "^0.19.0",
"@graphprotocol/graph-cli": "^0.60.0",
"@graphprotocol/graph-ts": "^0.31.0",
"mustache": "^4.2.0"
},
"dependencies": {
Expand Down
13 changes: 8 additions & 5 deletions packages/subgraphs/govern-subgraph/src/Govern.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts";
import { Address } from "@graphprotocol/graph-ts";
import {
Executed as ExecutedEvent,
Frozen as FrozenEvent,
Expand All @@ -12,12 +12,15 @@ import { Govern, Deposit, Withdraw } from "../generated/schema";
import { frozenRoles, roleGranted, roleRevoked } from "./lib/MiniACL";
import { loadOrCreateContainer } from "./GovernQueue";
import { handleContainerEventExecute } from "./utils/events";
import { buildId, buildIndexedId } from "./utils/ids";
import { buildId } from "./utils/ids";
import { ZERO_ADDRESS } from "./utils/constants";

export function handleExecuted(event: ExecutedEvent): void {
let govern = loadOrCreateGovern(event.address);
let container = loadOrCreateContainer(event.params.memo);
let container = loadOrCreateContainer(
event.params.memo,
event.address.toHex()
);

handleContainerEventExecute(container, event);

Expand Down Expand Up @@ -71,7 +74,7 @@ export function handleWithdrawn(event: WithdrawnEvent): void {
export function handleFrozen(event: FrozenEvent): void {
let govern = loadOrCreateGovern(event.address);

let roles = govern.roles!;
let roles = govern.roles;

frozenRoles(roles, event.params.role);
}
Expand Down Expand Up @@ -113,5 +116,5 @@ export function loadOrCreateGovern(entity: Address): Govern {
govern.address = entity;
govern.roles = [];
}
return govern!;
return govern;
}
Loading

0 comments on commit 05d1def

Please sign in to comment.