Skip to content

Commit

Permalink
Merge pull request #278 from gnosisguild/subgraph-fix-update-adapter
Browse files Browse the repository at this point in the history
subgraph: fix update adapter
  • Loading branch information
jfschwarz authored Jun 21, 2024
2 parents be83fe5 + 1b4596d commit 883a0a3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ Address: `0x91B1bd7BCC5E623d5CE76b0152253499a9C819d1`

#### Subgraphs

- [Mainnet](https://api.studio.thegraph.com/query/23167/zodiac-roles-mainnet/v2.2.1)
- [Optimism](https://api.studio.thegraph.com/query/23167/zodiac-roles-optimism/v2.2.1)
- [Gnosis](https://api.studio.thegraph.com/query/23167/zodiac-roles-gnosis/v2.2.1)
- [Polygon](https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.2.1)
- [Arbitrum One](https://api.studio.thegraph.com/query/23167/zodiac-roles-arbitrum-one/v2.2.1)
- [Avalanche C-Chain](https://api.studio.thegraph.com/query/23167/zodiac-roles-avalanche/v2.2.1)
- [Base](https://api.studio.thegraph.com/query/23167/zodiac-roles-base/v2.2.1)
- [Sepolia](https://api.studio.thegraph.com/query/23167/zodiac-roles-sepolia/v2.2.1)
- [Mainnet](https://api.studio.thegraph.com/query/23167/zodiac-roles-mainnet/v2.2.2)
- [Optimism](https://api.studio.thegraph.com/query/23167/zodiac-roles-optimism/v2.2.2)
- [Gnosis](https://api.studio.thegraph.com/query/23167/zodiac-roles-gnosis/v2.2.2)
- [Polygon](https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.2.2)
- [Arbitrum One](https://api.studio.thegraph.com/query/23167/zodiac-roles-arbitrum-one/v2.2.2)
- [Avalanche C-Chain](https://api.studio.thegraph.com/query/23167/zodiac-roles-avalanche/v2.2.2)
- [Base](https://api.studio.thegraph.com/query/23167/zodiac-roles-base/v2.2.2)
- [Sepolia](https://api.studio.thegraph.com/query/23167/zodiac-roles-sepolia/v2.2.2)

### Development environment setup

Expand Down
2 changes: 1 addition & 1 deletion packages/deployments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zodiac-roles-deployments",
"version": "2.2.3",
"version": "2.2.4",
"license": "LGPL-3.0+",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
Expand Down
16 changes: 8 additions & 8 deletions packages/deployments/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@ export const chains = {
name: "mainnet",
prefix: "eth",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-mainnet/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-mainnet/v2.2.2",
},
[10]: {
name: "optimism",
prefix: "oeth",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-optimism/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-optimism/v2.2.2",
},
[100]: {
name: "gnosis",
prefix: "gno",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-gnosis/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-gnosis/v2.2.2",
},
[137]: {
name: "polygon",
prefix: "matic",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.2.2",
},
[42161]: {
name: "arbitrumOne",
prefix: "arb1",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-arbitrum-one/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-arbitrum-one/v2.2.2",
},
[43114]: {
name: "avalanche",
prefix: "avax",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-avalanche/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-avalanche/v2.2.2",
},
[8453]: {
name: "base",
prefix: "base",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-base/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-base/v2.2.2",
},
[11155111]: {
name: "sepolia",
prefix: "sep",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-sepolia/v2.2.1",
"https://api.studio.thegraph.com/query/23167/zodiac-roles-sepolia/v2.2.2",
},
} as const
7 changes: 7 additions & 0 deletions packages/deployments/src/fetchRolesMod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const QUERY = `
}
}
}
unwrapAdapters(where: {selector: "0x8d80ff0a", adapterAddress: "0x93b7fcbc63ed8a3a24b59e1c3e6649d50b7427c0"}) {
targetAddress
}
}
}
`
Expand Down Expand Up @@ -90,11 +93,15 @@ export interface RolesModifier {
avatar: `0x${string}`
target: `0x${string}`
roles: RoleSummary[]
multiSendAddresses: `0x${string}`[]
}

const mapGraphQl = (rolesModifier: any): RolesModifier => ({
...rolesModifier,
roles: rolesModifier.roles.map(mapGraphQlRole),
multiSendAddresses: rolesModifier.unwrapAdapters.map(
(adapter: any) => adapter.targetAddress
),
})

const mapGraphQlRole = (role: any): RoleSummary => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zodiac-roles-sdk",
"version": "2.12.5",
"version": "2.12.6",
"license": "LGPL-3.0+",
"main": "build/cjs/sdk/src/index.js",
"module": "build/esm/sdk/src/index.js",
Expand Down
2 changes: 0 additions & 2 deletions packages/subgraph/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export const getOrCreateAllowance = (allowanceKey: Bytes, rolesModifierId: strin
}

export const getOrCreateUnwrapAdapter = (
adapterAddress: Address,
targetAddress: Address,
selector: Bytes,
rolesModifierId: string,
Expand All @@ -147,7 +146,6 @@ export const getOrCreateUnwrapAdapter = (
// save adapter the first time we encounter it
if (!adapter) {
adapter = new UnwrapAdapter(id)
adapter.adapterAddress = adapterAddress
adapter.rolesModifier = rolesModifierId
adapter.targetAddress = targetAddress
adapter.selector = selector
Expand Down
9 changes: 3 additions & 6 deletions packages/subgraph/src/periphery.mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ export function handleSetUnwrapAdapter(event: SetUnwrapAdapter): void {
const rolesModifierAddress = event.address
const rolesModifierId = getRolesModifierId(rolesModifierAddress)

const adapter = getOrCreateUnwrapAdapter(
event.params.adapter,
event.params.to,
event.params.selector,
rolesModifierId,
)
const adapter = getOrCreateUnwrapAdapter(event.params.to, event.params.selector, rolesModifierId)
adapter.adapterAddress = event.params.adapter
adapter.save()

log.info("UnwrapAdapter {} has been set to {}", [adapter.id, adapter.adapterAddress.toHexString()])
}

0 comments on commit 883a0a3

Please sign in to comment.