Skip to content

Commit

Permalink
op-challenger: Include bonds when listing claims
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsutton committed May 23, 2024
1 parent 4a487b8 commit 1da9f66
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions op-challenger/cmd/list_claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strconv"
"time"

"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/op-challenger/flags"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts/metrics"
Expand Down Expand Up @@ -105,8 +106,8 @@ func listClaims(ctx context.Context, game contracts.FaultDisputeGameContract, ve
valueFormat = "%-66v"
}
now := time.Now()
lineFormat := "%3v %-7v %6v %5v %14v " + valueFormat + " %-42v %-19v %10v %v\n"
info := fmt.Sprintf(lineFormat, "Idx", "Move", "Parent", "Depth", "Index", "Value", "Claimant", "Time", "Clock Used", "Resolution")
lineFormat := "%3v %-7v %6v %5v %14v " + valueFormat + " %-42v %10v %-19v %10v %v\n"
info := fmt.Sprintf(lineFormat, "Idx", "Move", "Parent", "Depth", "Index", "Value", "Claimant", "Bond", "Time", "Clock Used", "Resolution")
for i, claim := range claims {
pos := claim.Position
parent := strconv.Itoa(claim.ParentContractIndex)
Expand Down Expand Up @@ -154,8 +155,12 @@ func listClaims(ctx context.Context, game contracts.FaultDisputeGameContract, ve
value = claim.Value.Hex()
}
timestamp := claim.Clock.Timestamp.Format(time.DateTime)
bond := fmt.Sprintf("%10.6f", bigint.WeiToETH(claim.Bond))
if verbose {
bond = bigint.WeiToETH(claim.Bond).String()
}
info = info + fmt.Sprintf(lineFormat,
i, move, parent, pos.Depth(), traceIdx, value, claim.Claimant, timestamp, elapsed, countered)
i, move, parent, pos.Depth(), traceIdx, value, claim.Claimant, bond, timestamp, elapsed, countered)
}
blockNumChallenger := "L2 Block: Unchallenged"
if metadata.L2BlockNumberChallenged {
Expand Down

0 comments on commit 1da9f66

Please sign in to comment.