Skip to content

Commit e9263a1

Browse files
committed
chore: revert stakeset handling in this subgraph
1 parent 1b6b112 commit e9263a1

File tree

7 files changed

+7
-43
lines changed

7 files changed

+7
-43
lines changed

subgraph/core-neo/subgraph.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ dataSources:
149149
language: wasm/assemblyscript
150150
entities:
151151
- JurorTokensPerCourt
152-
- StakeSet
153152
abis:
154153
- name: SortitionModule
155154
file: ../../contracts/deployments/arbitrum/SortitionModuleNeo.json

subgraph/core-university/src/SortitionModule.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
1-
import { SortitionModule, StakeLocked, StakeSet as StakeSetEvent } from "../generated/SortitionModule/SortitionModule";
2-
import { StakeSet as StakeSetEntity } from "../generated/schema";
1+
import { SortitionModule, StakeLocked, StakeSet } from "../generated/SortitionModule/SortitionModule";
32

43
import { updateJurorDelayedStake, updateJurorStake } from "./entities/JurorTokensPerCourt";
54
import { ensureUser } from "./entities/User";
65
import { ZERO } from "./utils";
76

8-
export function handleStakeSet(event: StakeSetEvent): void {
7+
export function handleStakeSet(event: StakeSet): void {
98
const jurorAddress = event.params._address.toHexString();
9+
ensureUser(jurorAddress);
1010
const courtID = event.params._courtID.toString();
1111

1212
updateJurorStake(jurorAddress, courtID.toString(), SortitionModule.bind(event.address), event.block.timestamp);
1313
//stake is updated instantly so no delayed amount, set delay amount to zero
1414
updateJurorDelayedStake(jurorAddress, courtID, ZERO);
15-
16-
const stakeSet = new StakeSetEntity(event.transaction.hash.toHex() + "-" + event.logIndex.toString());
17-
const juror = ensureUser(jurorAddress);
18-
stakeSet.juror = juror.id;
19-
stakeSet.courtID = event.params._courtID;
20-
stakeSet.stake = event.params._amount;
21-
stakeSet.newTotalStake = juror.totalStake;
22-
stakeSet.blocknumber = event.block.number;
23-
stakeSet.timestamp = event.block.timestamp;
24-
stakeSet.logIndex = event.logIndex;
25-
stakeSet.save();
2615
}
2716

2817
export function handleStakeLocked(event: StakeLocked): void {

subgraph/core-university/subgraph.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ dataSources:
149149
language: wasm/assemblyscript
150150
entities:
151151
- JurorTokensPerCourt
152-
- StakeSet
153152
abis:
154153
- name: SortitionModule
155154
file: ../../contracts/deployments/arbitrumSepoliaDevnet/SortitionModuleUniversity.json

subgraph/core/schema.graphql

-11
Original file line numberDiff line numberDiff line change
@@ -354,17 +354,6 @@ type ClassicContribution implements Contribution @entity {
354354
rewardWithdrawn: Boolean!
355355
}
356356

357-
type StakeSet @entity(immutable: true) {
358-
id: ID! # event.transaction.hash.toHex() + - + event.logIndex.toString()
359-
juror: User!
360-
courtID: BigInt!
361-
stake: BigInt!
362-
newTotalStake: BigInt!
363-
blocknumber: BigInt!
364-
timestamp: BigInt!
365-
logIndex: BigInt!
366-
}
367-
368357
type _Schema_
369358
@fulltext(
370359
name: "evidenceSearch"

subgraph/core/src/SortitionModule.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import {
44
StakeDelayedAlreadyTransferredWithdrawn,
55
StakeDelayedNotTransferred,
66
StakeLocked,
7-
StakeSet as StakeSetEvent,
7+
StakeSet,
88
} from "../generated/SortitionModule/SortitionModule";
9-
import { StakeSet as StakeSetEntity } from "../generated/schema";
109

1110
import { updateJurorDelayedStake, updateJurorStake } from "./entities/JurorTokensPerCourt";
1211
import { ensureUser } from "./entities/User";
@@ -24,24 +23,14 @@ export function handleStakeDelayedNotTransferred(event: StakeDelayedNotTransferr
2423
updateJurorDelayedStake(event.params._address.toHexString(), event.params._courtID.toString(), event.params._amount);
2524
}
2625

27-
export function handleStakeSet(event: StakeSetEvent): void {
26+
export function handleStakeSet(event: StakeSet): void {
2827
const jurorAddress = event.params._address.toHexString();
28+
ensureUser(jurorAddress);
2929
const courtID = event.params._courtID.toString();
3030

3131
updateJurorStake(jurorAddress, courtID.toString(), SortitionModule.bind(event.address), event.block.timestamp);
3232
//stake is updated instantly so no delayed amount, set delay amount to zero
3333
updateJurorDelayedStake(jurorAddress, courtID, ZERO);
34-
35-
const stakeSet = new StakeSetEntity(event.transaction.hash.toHex() + "-" + event.logIndex.toString());
36-
const juror = ensureUser(jurorAddress);
37-
stakeSet.juror = juror.id;
38-
stakeSet.courtID = event.params._courtID;
39-
stakeSet.stake = event.params._amount;
40-
stakeSet.newTotalStake = juror.totalStake;
41-
stakeSet.blocknumber = event.block.number;
42-
stakeSet.timestamp = event.block.timestamp;
43-
stakeSet.logIndex = event.logIndex;
44-
stakeSet.save();
4534
}
4635

4736
export function handleStakeLocked(event: StakeLocked): void {}

subgraph/core/subgraph.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ dataSources:
149149
language: wasm/assemblyscript
150150
entities:
151151
- JurorTokensPerCourt
152-
- StakeSet
153152
abis:
154153
- name: SortitionModule
155154
file: ../../contracts/deployments/arbitrumSepoliaDevnet/SortitionModule.json

subgraph/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kleros/kleros-v2-subgraph",
3-
"version": "0.12.0",
3+
"version": "0.11.0",
44
"drtVersion": "0.11.0",
55
"license": "MIT",
66
"scripts": {

0 commit comments

Comments
 (0)