Skip to content

Commit 08397c5

Browse files
committed
chore: update contract address and abi
1 parent 6f1cfa8 commit 08397c5

File tree

3 files changed

+52
-14
lines changed

3 files changed

+52
-14
lines changed

abis/TruthPost.json

+46-5
Original file line numberDiff line numberDiff line change
@@ -851,11 +851,6 @@
851851
"internalType": "address payable",
852852
"name": "_contributor",
853853
"type": "address"
854-
},
855-
{
856-
"internalType": "enum ITruthPost.RulingOptions",
857-
"name": "_ruling",
858-
"type": "uint8"
859854
}
860855
],
861856
"name": "getTotalWithdrawableAmount",
@@ -864,6 +859,11 @@
864859
"internalType": "uint256",
865860
"name": "sum",
866861
"type": "uint256"
862+
},
863+
{
864+
"internalType": "uint256[][]",
865+
"name": "positions",
866+
"type": "uint256[][]"
867867
}
868868
],
869869
"stateMutability": "view",
@@ -1085,5 +1085,46 @@
10851085
"outputs": [],
10861086
"stateMutability": "nonpayable",
10871087
"type": "function"
1088+
},
1089+
{
1090+
"inputs": [
1091+
{
1092+
"internalType": "uint256",
1093+
"name": "_disputeID",
1094+
"type": "uint256"
1095+
},
1096+
{
1097+
"internalType": "address payable",
1098+
"name": "_contributor",
1099+
"type": "address"
1100+
}
1101+
],
1102+
"name": "withdrawFeesAndRewardsForAllRoundsAndAllRulings",
1103+
"outputs": [],
1104+
"stateMutability": "nonpayable",
1105+
"type": "function"
1106+
},
1107+
{
1108+
"inputs": [
1109+
{
1110+
"internalType": "uint256",
1111+
"name": "_disputeID",
1112+
"type": "uint256"
1113+
},
1114+
{
1115+
"internalType": "address payable",
1116+
"name": "_contributor",
1117+
"type": "address"
1118+
},
1119+
{
1120+
"internalType": "uint256[][]",
1121+
"name": "positions",
1122+
"type": "uint256[][]"
1123+
}
1124+
],
1125+
"name": "withdrawFeesAndRewardsForGivenPositions",
1126+
"outputs": [],
1127+
"stateMutability": "nonpayable",
1128+
"type": "function"
10881129
}
10891130
]

src/TruthPost.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export function handleWithdrawal(event: Withdrawal): void {
314314
}
315315

316316
const truthPost = TruthPost.bind(event.address);
317-
userEntity.totalWithdrawableAmount = truthPost.getTotalWithdrawableAmount(disputeID, event.params.contributor, event.params.ruling);
317+
userEntity.totalWithdrawableAmount = truthPost.getTotalWithdrawableAmount(disputeID, event.params.contributor).getSum();
318318

319319
if (userEntity.totalWithdrawableAmount.equals(BigInt.fromI32(0))) userEntity.withdrew = true;
320320
userEntity.save();
@@ -330,7 +330,6 @@ export function handleRuling(event: Ruling): void {
330330

331331
const contributors = disputeEntity.contributors;
332332
const contract = TruthPost.bind(event.address);
333-
const NUMBER_OF_RULING_OPTIONS = contract.NUMBER_OF_RULING_OPTIONS();
334333

335334
const contributorsSet = new Set<string>();
336335
for (let i = 0; i < contributors.length; i++) {
@@ -341,11 +340,9 @@ export function handleRuling(event: Ruling): void {
341340

342341
const user = User.load(contributors[i]);
343342
if (user) {
344-
for (let j = 0; j <= NUMBER_OF_RULING_OPTIONS.toI32(); j++) {
345-
user.totalWithdrawableAmount = user.totalWithdrawableAmount.plus(
346-
contract.getTotalWithdrawableAmount(disputeID, Address.fromString(contributors[i]), j)
347-
);
348-
}
343+
user.totalWithdrawableAmount = user.totalWithdrawableAmount.plus(
344+
contract.getTotalWithdrawableAmount(disputeID, Address.fromString(contributors[i])).getSum()
345+
);
349346
user.save();
350347
}
351348
}

subgraph.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ dataSources:
66
name: TruthPost
77
network: goerli
88
source:
9-
address: "0xAA51402316075798040c2322D0361383577707ba"
9+
address: "0x4d4c347f102fe8c01c94d003b9e9a03f5fe67d67"
1010
abi: TruthPost
11-
startBlock: 8767469
11+
startBlock: 8907143
1212
mapping:
1313
kind: ethereum/events
1414
apiVersion: 0.0.6

0 commit comments

Comments
 (0)