From 5f5e9f3ff5a46d4feada518c85f59377224a04e5 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Fri, 22 Nov 2024 14:45:16 +0100 Subject: [PATCH 1/2] make sure the role's `lastUpdate` is updated when updating annotions --- packages/subgraph/src/poster.mapping.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/subgraph/src/poster.mapping.ts b/packages/subgraph/src/poster.mapping.ts index 7e544a226..098b7fdf7 100644 --- a/packages/subgraph/src/poster.mapping.ts +++ b/packages/subgraph/src/poster.mapping.ts @@ -1,6 +1,13 @@ import { Address, Bytes, json, JSONValueKind, log, store } from "@graphprotocol/graph-ts" import { NewPost } from "../generated/Poster/Poster" -import { getAnnotationId, getOrCreateAnnotation, getRoleId, getRolesModifier, getRolesModifierId } from "./helpers" +import { + getAnnotationId, + getOrCreateAnnotation, + getOrCreateRole, + getRoleId, + getRolesModifier, + getRolesModifierId, +} from "./helpers" export function handleNewPost(event: NewPost): void { // only listen for events with the tag keccak256("ROLES_PERMISSION_ANNOTATION") @@ -45,6 +52,8 @@ export function handleNewPost(event: NewPost): void { const roleId = getRoleId(rolesModifierId, roleKey) + let hasUpdates = false + const removeAnnotationsEntries = parsedPost.get("removeAnnotations") && parsedPost.get("removeAnnotations")!.kind == JSONValueKind.ARRAY ? parsedPost.get("removeAnnotations")!.toArray() @@ -63,6 +72,7 @@ export function handleNewPost(event: NewPost): void { const id = getAnnotationId(uri.toString(), roleId) store.remove("Annotation", id) log.info("Annotation #{} has been removed", [id]) + hasUpdates = true } for (let i = 0; i < addAnnotationsEntries.length; i++) { @@ -87,6 +97,13 @@ export function handleNewPost(event: NewPost): void { } const annotation = getOrCreateAnnotation(uriEntry.toString(), schema.toString(), roleId) log.info("Annotation #{} has been added", [annotation.id]) + hasUpdates = true } } + + if (hasUpdates) { + // update role's lastUpdate field + const role = getOrCreateRole(roleId, rolesModifierId, roleKey, event.block.number) + role.save() + } } From 6b734972f1fe404b8c83e9839ceb5d5a128dbbf6 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Fri, 22 Nov 2024 14:53:00 +0100 Subject: [PATCH 2/2] deploy subgraphs --- README.md | 22 +++++++++++----------- packages/deployments/package.json | 2 +- packages/deployments/src/chains.ts | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 615f0b76e..4819a73a4 100644 --- a/README.md +++ b/README.md @@ -88,17 +88,17 @@ Address: `0x91B1bd7BCC5E623d5CE76b0152253499a9C819d1` #### Subgraphs -- [Mainnet](https://api.studio.thegraph.com/query/23167/zodiac-roles-mainnet/v2.3.0) -- [Optimism](https://api.studio.thegraph.com/query/23167/zodiac-roles-optimism/v2.3.0) -- [Gnosis](https://api.studio.thegraph.com/query/23167/zodiac-roles-gnosis/v2.3.0) -- [Polygon](https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.3.0) -- [Polygon zkEVM](https://api.studio.thegraph.com/query/23167/zodiac-roles-zkevm/v2.3.0) -- [Arbitrum One](https://api.studio.thegraph.com/query/23167/zodiac-roles-arbitrum-one/v2.3.0) -- [Avalanche C-Chain](https://api.studio.thegraph.com/query/23167/zodiac-roles-avalanche/v2.3.0) -- [BSC](https://api.studio.thegraph.com/query/23167/zodiac-roles-bsc/v2.3.0) -- [Base](https://api.studio.thegraph.com/query/23167/zodiac-roles-base/v2.3.0) -- [Base Sepolia](https://api.studio.thegraph.com/query/23167/zodiac-roles-base-sepolia/v2.3.0) -- [Sepolia](https://api.studio.thegraph.com/query/23167/zodiac-roles-sepolia/v2.3.0) +- [Mainnet](https://api.studio.thegraph.com/query/23167/zodiac-roles-mainnet/v2.3.1) +- [Optimism](https://api.studio.thegraph.com/query/23167/zodiac-roles-optimism/v2.3.1) +- [Gnosis](https://api.studio.thegraph.com/query/23167/zodiac-roles-gnosis/v2.3.1) +- [Polygon](https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.3.1) +- [Polygon zkEVM](https://api.studio.thegraph.com/query/23167/zodiac-roles-zkevm/v2.3.1) +- [Arbitrum One](https://api.studio.thegraph.com/query/23167/zodiac-roles-arbitrum-one/v2.3.1) +- [Avalanche C-Chain](https://api.studio.thegraph.com/query/23167/zodiac-roles-avalanche/v2.3.1) +- [BSC](https://api.studio.thegraph.com/query/23167/zodiac-roles-bsc/v2.3.1) +- [Base](https://api.studio.thegraph.com/query/23167/zodiac-roles-base/v2.3.1) +- [Base Sepolia](https://api.studio.thegraph.com/query/23167/zodiac-roles-base-sepolia/v2.3.1) +- [Sepolia](https://api.studio.thegraph.com/query/23167/zodiac-roles-sepolia/v2.3.1) ### Development environment setup diff --git a/packages/deployments/package.json b/packages/deployments/package.json index 63024c40e..282bfa644 100644 --- a/packages/deployments/package.json +++ b/packages/deployments/package.json @@ -1,6 +1,6 @@ { "name": "zodiac-roles-deployments", - "version": "2.3.1", + "version": "2.3.2", "license": "LGPL-3.0+", "main": "build/cjs/index.js", "module": "build/esm/index.js", diff --git a/packages/deployments/src/chains.ts b/packages/deployments/src/chains.ts index 1deccedf0..b01a46e9f 100644 --- a/packages/deployments/src/chains.ts +++ b/packages/deployments/src/chains.ts @@ -3,66 +3,66 @@ export const chains = { name: "mainnet", prefix: "eth", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-mainnet/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-mainnet/v2.3.1", }, [10]: { name: "optimism", prefix: "oeth", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-optimism/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-optimism/v2.3.1", }, [100]: { name: "gnosis", prefix: "gno", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-gnosis/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-gnosis/v2.3.1", }, [137]: { name: "polygon", prefix: "matic", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-polygon/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-polygon/v2.3.1", }, [1101]: { name: "zkevm", prefix: "zkevm", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-zkevm/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-zkevm/v2.3.1", }, [42161]: { name: "arbitrumOne", prefix: "arb1", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-arbitrum-one/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-arbitrum-one/v2.3.1", }, [43114]: { name: "avalanche", prefix: "avax", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-avalanche/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-avalanche/v2.3.1", }, [56]: { name: "bsc", prefix: "bnb", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-bsc/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-bsc/v2.3.1", }, [8453]: { name: "base", prefix: "base", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-base/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-base/v2.3.1", }, [84532]: { name: "baseSepolia", prefix: "basesep", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-base-sepolia/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-base-sepolia/v2.3.1", }, [11155111]: { name: "sepolia", prefix: "sep", subgraph: - "https://api.studio.thegraph.com/query/93263/zodiac-roles-sepolia/v2.3.0", + "https://api.studio.thegraph.com/query/93263/zodiac-roles-sepolia/v2.3.1", }, } as const