Skip to content

Commit 877bd68

Browse files
committed
fix(subgraph): correctly handle feeToken
1 parent d270bdd commit 877bd68

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

subgraph/src/KlerosCore.ts

+2-12
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { updateArbitrableCases } from "./entities/Arbitrable";
2828
import { Court, Dispute, FeeToken } from "../generated/schema";
2929
import { BigInt } from "@graphprotocol/graph-ts";
3030
import { updatePenalty } from "./entities/Penalty";
31+
import { ensureFeeToken } from "./entities/FeeToken";
3132

3233
function getPeriodName(index: i32): string {
3334
const periodArray = ["evidence", "commit", "vote", "appeal", "execution"];
@@ -169,16 +170,5 @@ export function handleTokenAndETHShift(event: TokenAndETHShiftEvent): void {
169170
}
170171

171172
export function handleAcceptedFeeToken(event: AcceptedFeeToken): void {
172-
let feeToken = new FeeToken(event.params._token.toHexString());
173-
const contract = KlerosCore.bind(event.address);
174-
175-
let currencyRate = contract.currencyRates(event.params._token);
176-
177-
feeToken.accepted = currencyRate.value0;
178-
feeToken.rateInEth = currencyRate.value1;
179-
feeToken.rateDecimals = currencyRate.value2;
180-
feeToken.totalPaid = ZERO;
181-
feeToken.totalPaidInETH = ZERO;
182-
183-
feeToken.save();
173+
ensureFeeToken(event.params._token, event.address);
184174
}

0 commit comments

Comments
 (0)