Skip to content

Commit

Permalink
Fix 0-GoldWithdraw edge case (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
eelanagaraj authored Apr 24, 2021
1 parent 83e5048 commit dcc32ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion analyzer/txtracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ func (tr *Tracer) TxOpsFromLogs(tx *types.Transaction, receipt *types.Receipt, t
case "GoldWithdrawn":
// withdraw() [GoldWithdrawn + transfer] => lockPending->main
event := eventRaw.(*contracts.LockedGoldGoldWithdrawn)
transfers = append(transfers, *NewWithdrawGold(event.Account, lockedGoldAddr, event.Value, tobinTax))
// Edge case: withdrawing 0 CELO means there isn't a matching transfer;
// Only store balance-changing (>0) GoldLocked logs.
if event.Value.Cmp(big.NewInt(0)) > 0 {
transfers = append(transfers, *NewWithdrawGold(event.Account, lockedGoldAddr, event.Value, tobinTax))
}

case "AccountSlashed":
// slash() [AccountSlashed + transfer] => account:lockNonVoting -> beneficiary:lockNonVoting + governance:main
Expand Down

0 comments on commit dcc32ea

Please sign in to comment.