1- import { TokenAndETHShift } from "../../generated/KlerosCore/KlerosCore" ;
1+ import { JurorRewardPenalty } from "../../generated/KlerosCore/KlerosCore" ;
22import { Penalty } from "../../generated/schema" ;
33import { ONE } from "../utils" ;
44
5- export function updatePenalty ( event : TokenAndETHShift ) : void {
5+ export function updatePenalty ( event : JurorRewardPenalty ) : void {
66 const disputeID = event . params . _disputeID . toString ( ) ;
77 const roundIndex = event . params . _roundID . toString ( ) ;
88 const roundID = `${ disputeID } -${ roundIndex } ` ;
99 const jurorAddress = event . params . _account . toHexString ( ) ;
1010 const penaltyID = `${ roundID } -${ jurorAddress } ` ;
1111 const penalty = Penalty . load ( penaltyID ) ;
1212 if ( penalty ) {
13- penalty . amount = penalty . amount . plus ( event . params . _pnkAmount ) ;
14- const totalCoherency = penalty . degreeOfCoherency . times ( penalty . numberDraws ) ;
13+ penalty . amount = penalty . amount . plus ( event . params . _amountPnk ) ;
14+ const totalCoherency = penalty . degreeOfCoherencyPnk . times ( penalty . numberDraws ) ;
1515 penalty . numberDraws = penalty . numberDraws . plus ( ONE ) ;
16- penalty . degreeOfCoherency = totalCoherency . plus ( penalty . degreeOfCoherency ) . div ( penalty . numberDraws ) ;
16+ penalty . degreeOfCoherencyPnk = totalCoherency . plus ( penalty . degreeOfCoherencyPnk ) . div ( penalty . numberDraws ) ;
17+ // TODO: handle _degreeOfCoherencyFee
1718 penalty . save ( ) ;
1819 } else {
1920 createPenalty ( event ) ;
2021 }
2122}
2223
23- export function createPenalty ( event : TokenAndETHShift ) : void {
24+ export function createPenalty ( event : JurorRewardPenalty ) : void {
2425 const disputeID = event . params . _disputeID . toString ( ) ;
2526 const roundIndex = event . params . _roundID . toString ( ) ;
2627 const roundID = `${ disputeID } -${ roundIndex } ` ;
@@ -31,7 +32,8 @@ export function createPenalty(event: TokenAndETHShift): void {
3132 penalty . round = roundID ;
3233 penalty . juror = jurorAddress ;
3334 penalty . numberDraws = ONE ;
34- penalty . amount = event . params . _pnkAmount ;
35- penalty . degreeOfCoherency = event . params . _degreeOfCoherency ;
35+ penalty . amount = event . params . _amountPnk ;
36+ penalty . degreeOfCoherencyPnk = event . params . _degreeOfCoherencyPnk ;
37+ penalty . degreeOfCoherencyFee = event . params . _degreeOfCoherencyFee ;
3638 penalty . save ( ) ;
3739}
0 commit comments