Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit ba77111

Browse files
committed
chore: map transaction executions in subgraph
1 parent fddd9b7 commit ba77111

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
- chore: map governance functions in subgraph ([360d007](https://github.com/kleros/governor-web/commit/360d007))
77
- chore: map list submissions in subgraph ([8cbbe41](https://github.com/kleros/governor-web/commit/8cbbe41))
88
- chore: map the withdrawal and execution of submissions in subgraph ([f74acb7](https://github.com/kleros/governor-web/commit/f74acb7))
9+
- chore: map withdrawals and rulings in subgraph ([fddd9b7](https://github.com/kleros/governor-web/commit/fddd9b7))
910
- chore: set up project and architecture ([d28fb74](https://github.com/kleros/governor-web/commit/d28fb74))

subgraph/src/mapping.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ChangeWinnerMultiplierCall,
1212
ChangeWithdrawTimeoutCall,
1313
ExecuteSubmissionsCall,
14+
ExecuteTransactionListCall,
1415
FundAppealCall,
1516
Governor,
1617
Ruling,
@@ -437,3 +438,23 @@ export function ruling(event: Ruling): void {
437438

438439
newSession(contract, event.block.timestamp);
439440
}
441+
442+
export function executeTransactionList(call: ExecuteTransactionListCall): void {
443+
let governor = Governor.bind(call.to);
444+
445+
let submission = Submission.load(call.inputs._listID.toHexString());
446+
for (let i = 0; i < submission.transactionsLength.toI32(); i++) {
447+
let transaction = Transaction.load(
448+
concatByteArrays(
449+
crypto.keccak256(ByteArray.fromHexString(submission.id)),
450+
ByteArray.fromUTF8(i.toString())
451+
).toHexString()
452+
);
453+
let _transaction = governor.getTransactionInfo(
454+
call.inputs._listID,
455+
BigInt.fromI32(i)
456+
);
457+
transaction.executed = _transaction.value3;
458+
transaction.save();
459+
}
460+
}

subgraph/subgraph.template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ dataSources:
4949
handler: fundAppeal
5050
- function: withdrawFeesAndRewards(address,uint256,uint256,uint256)
5151
handler: withdrawFeesAndRewards
52+
- function: executeTransactionList(uint256,uint256,uint256)
53+
handler: executeTransactionList
5254
eventHandlers:
5355
- event: Ruling(indexed address,indexed uint256,uint256)
5456
handler: ruling

0 commit comments

Comments
 (0)