Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion subgraph/core-neo/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ dataSources:
language: wasm/assemblyscript
entities:
- JurorTokensPerCourt
- StakeSet
abis:
- name: SortitionModule
file: ../../contracts/deployments/arbitrum/SortitionModuleNeo.json
Expand Down
17 changes: 3 additions & 14 deletions subgraph/core-university/src/SortitionModule.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import { SortitionModule, StakeLocked, StakeSet as StakeSetEvent } from "../generated/SortitionModule/SortitionModule";
import { StakeSet as StakeSetEntity } from "../generated/schema";
import { SortitionModule, StakeLocked, StakeSet } from "../generated/SortitionModule/SortitionModule";

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

export function handleStakeSet(event: StakeSetEvent): void {
export function handleStakeSet(event: StakeSet): void {
const jurorAddress = event.params._address.toHexString();
ensureUser(jurorAddress);
const courtID = event.params._courtID.toString();

updateJurorStake(jurorAddress, courtID.toString(), SortitionModule.bind(event.address), event.block.timestamp);
//stake is updated instantly so no delayed amount, set delay amount to zero
updateJurorDelayedStake(jurorAddress, courtID, ZERO);

const stakeSet = new StakeSetEntity(event.transaction.hash.toHex() + "-" + event.logIndex.toString());
const juror = ensureUser(jurorAddress);
stakeSet.juror = juror.id;
stakeSet.courtID = event.params._courtID;
stakeSet.stake = event.params._amount;
stakeSet.newTotalStake = juror.totalStake;
stakeSet.blocknumber = event.block.number;
stakeSet.timestamp = event.block.timestamp;
stakeSet.logIndex = event.logIndex;
stakeSet.save();
}

export function handleStakeLocked(event: StakeLocked): void {
Expand Down
1 change: 0 additions & 1 deletion subgraph/core-university/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ dataSources:
language: wasm/assemblyscript
entities:
- JurorTokensPerCourt
- StakeSet
abis:
- name: SortitionModule
file: ../../contracts/deployments/arbitrumSepoliaDevnet/SortitionModuleUniversity.json
Expand Down
11 changes: 0 additions & 11 deletions subgraph/core/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,6 @@ type ClassicContribution implements Contribution @entity {
rewardWithdrawn: Boolean!
}

type StakeSet @entity(immutable: true) {
id: ID! # event.transaction.hash.toHex() + - + event.logIndex.toString()
juror: User!
courtID: BigInt!
stake: BigInt!
newTotalStake: BigInt!
blocknumber: BigInt!
timestamp: BigInt!
logIndex: BigInt!
}

type _Schema_
@fulltext(
name: "evidenceSearch"
Expand Down
17 changes: 3 additions & 14 deletions subgraph/core/src/SortitionModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import {
StakeDelayedAlreadyTransferredWithdrawn,
StakeDelayedNotTransferred,
StakeLocked,
StakeSet as StakeSetEvent,
StakeSet,
} from "../generated/SortitionModule/SortitionModule";
import { StakeSet as StakeSetEntity } from "../generated/schema";

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

export function handleStakeSet(event: StakeSetEvent): void {
export function handleStakeSet(event: StakeSet): void {
const jurorAddress = event.params._address.toHexString();
ensureUser(jurorAddress);
const courtID = event.params._courtID.toString();

updateJurorStake(jurorAddress, courtID.toString(), SortitionModule.bind(event.address), event.block.timestamp);
//stake is updated instantly so no delayed amount, set delay amount to zero
updateJurorDelayedStake(jurorAddress, courtID, ZERO);

const stakeSet = new StakeSetEntity(event.transaction.hash.toHex() + "-" + event.logIndex.toString());
const juror = ensureUser(jurorAddress);
stakeSet.juror = juror.id;
stakeSet.courtID = event.params._courtID;
stakeSet.stake = event.params._amount;
stakeSet.newTotalStake = juror.totalStake;
stakeSet.blocknumber = event.block.number;
stakeSet.timestamp = event.block.timestamp;
stakeSet.logIndex = event.logIndex;
stakeSet.save();
}

export function handleStakeLocked(event: StakeLocked): void {}
1 change: 0 additions & 1 deletion subgraph/core/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ dataSources:
language: wasm/assemblyscript
entities:
- JurorTokensPerCourt
- StakeSet
abis:
- name: SortitionModule
file: ../../contracts/deployments/arbitrumSepoliaDevnet/SortitionModule.json
Expand Down
2 changes: 1 addition & 1 deletion subgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/kleros-v2-subgraph",
"version": "0.12.0",
"version": "0.11.0",
"drtVersion": "0.11.0",
"license": "MIT",
"scripts": {
Expand Down
Loading