Skip to content

fix(subgraph): subgraph-event-fix #1948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions subgraph/core/src/SortitionModule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
SortitionModule,
StakeDelayedAlreadyTransferred,
StakeDelayedAlreadyTransferredDeposited,
StakeDelayedAlreadyTransferredWithdrawn,
StakeDelayedNotTransferred,
Expand All @@ -11,6 +12,11 @@ import { updateJurorDelayedStake, updateJurorStake } from "./entities/JurorToken
import { ensureUser } from "./entities/User";
import { ZERO } from "./utils";

// FIX: temporarily adding this handler for old event name "StakeDelayedAlreadyTransferred", delete when deploying new fresh-address contract.
export function handleStakeDelayedAlreadyTransferred(event: StakeDelayedAlreadyTransferred): void {
updateJurorDelayedStake(event.params._address.toHexString(), event.params._courtID.toString(), event.params._amount);
}

export function handleStakeDelayedAlreadyTransferredDeposited(event: StakeDelayedAlreadyTransferredDeposited): void {
updateJurorDelayedStake(event.params._address.toHexString(), event.params._courtID.toString(), event.params._amount);
}
Expand Down
48 changes: 30 additions & 18 deletions subgraph/core/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ dataSources:
name: KlerosCore
network: arbitrum-sepolia
source:
address: "0xE8442307d36e9bf6aB27F1A009F95CE8E11C3479"
address: "0xA54e7A16d7460e38a8F324eF46782FB520d58CE8"
abi: KlerosCore
startBlock: 95250346
startBlock: 3638878
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -28,11 +28,12 @@ dataSources:
- Counter
abis:
- name: SortitionModule
file: ../../contracts/deployments/arbitrumSepolia/SortitionModule.json
file: ../../contracts/deployments/arbitrumSepoliaDevnet/SortitionModule.json
- name: DisputeKitClassic
file: ../../contracts/deployments/arbitrumSepolia/DisputeKitClassic.json
file: ../../contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
- name: KlerosCore
file: ../../contracts/deployments/arbitrumSepolia/KlerosCore.json
# FIX: temporarily point to the abi with event addition.
file: ./temp-abis/KlerosCore.json
eventHandlers:
- event: AppealDecision(indexed uint256,indexed address)
handler: handleAppealDecision
Expand All @@ -45,6 +46,9 @@ dataSources:
handler: handleNewPeriod
- event: CourtCreated(indexed uint96,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[])
handler: handleCourtCreated
# FIX: This is support for old signature
- event: CourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[])
handler: handleCourtCreated
- event: CourtModified(indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4])
handler: handleCourtModified
- event: DisputeKitCreated(indexed uint256,indexed address)
Expand All @@ -64,9 +68,9 @@ dataSources:
name: PolicyRegistry
network: arbitrum-sepolia
source:
address: "0x2668c46A14af8997417138B064ca1bEB70769585"
address: "0x2AC2EdFD336732bc6963f1AD03ED98B22dB949da"
abi: PolicyRegistry
startBlock: 95247698
startBlock: 3084568
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -75,7 +79,7 @@ dataSources:
- Court
abis:
- name: PolicyRegistry
file: ../../contracts/deployments/arbitrumSepolia/PolicyRegistry.json
file: ../../contracts/deployments/arbitrumSepoliaDevnet/PolicyRegistry.json
eventHandlers:
- event: PolicyUpdate(indexed uint256,string,string)
handler: handlePolicyUpdate
Expand All @@ -84,9 +88,9 @@ dataSources:
name: DisputeKitClassic
network: arbitrum-sepolia
source:
address: "0x0c38f115D001d3b5bBec5e8D44f78C7B61A27D94"
address: "0x9426F127116C3652A262AE1eA48391AC8F44D35b"
abi: DisputeKitClassic
startBlock: 95247789
startBlock: 3638835
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -98,9 +102,10 @@ dataSources:
- ClassicContribution
abis:
- name: DisputeKitClassic
file: ../../contracts/deployments/arbitrumSepolia/DisputeKitClassic.json
file: ../../contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
- name: KlerosCore
file: ../../contracts/deployments/arbitrumSepolia/KlerosCore.json
# FIX: temporarily point to abi with event addition
file: ./temp-abis/KlerosCore.json
eventHandlers:
- event: DisputeCreation(indexed uint256,uint256,bytes)
handler: handleDisputeCreation
Expand All @@ -119,9 +124,9 @@ dataSources:
name: EvidenceModule
network: arbitrum-sepolia
source:
address: "0xA88A9a25cE7f1d8b3941dA3b322Ba91D009E1397"
address: "0x57fd453FB0d16f8ca174E7386102D7170E17Be09"
abi: EvidenceModule
startBlock: 95247733
startBlock: 3638735
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -131,7 +136,7 @@ dataSources:
- ClassicEvidence
abis:
- name: EvidenceModule
file: ../../contracts/deployments/arbitrumSepolia/EvidenceModule.json
file: ../../contracts/deployments/arbitrumSepoliaDevnet/EvidenceModule.json
eventHandlers:
- event: Evidence(indexed uint256,indexed address,string)
handler: handleEvidenceEvent
Expand All @@ -140,9 +145,9 @@ dataSources:
name: SortitionModule
network: arbitrum-sepolia
source:
address: "0xbAA5068F0bD1417046250A3eDe2B1F27e31383BD"
address: "0x19cb28BAB40C3585955798f5EEabd71Eec14471C"
abi: SortitionModule
startBlock: 95250316
startBlock: 3638850
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -151,10 +156,14 @@ dataSources:
- JurorTokensPerCourt
abis:
- name: SortitionModule
file: ../../contracts/deployments/arbitrumSepolia/SortitionModule.json
# FIX: temporarily point to abi with event addition
file: ./temp-abis/SortitionModule.json
eventHandlers:
- event: StakeDelayedAlreadyTransferredDeposited(indexed address,uint256,uint256)
handler: handleStakeDelayedAlreadyTransferredDeposited
# FIX: temporarily indexing old event name
- event: StakeDelayedAlreadyTransferred(indexed address,uint256,uint256)
handler: handleStakeDelayedAlreadyTransferred
- event: StakeDelayedAlreadyTransferredWithdrawn(indexed address,indexed uint96,uint256)
handler: handleStakeDelayedAlreadyTransferredWithdrawn
- event: StakeDelayedNotTransferred(indexed address,uint256,uint256)
Expand All @@ -163,4 +172,7 @@ dataSources:
handler: handleStakeLocked
- event: StakeSet(indexed address,uint256,uint256,uint256)
handler: handleStakeSet
# FIX: old stake set signature
- event: StakeSet(indexed address,uint256,uint256)
handler: handleStakeSet
file: ./src/SortitionModule.ts
Loading