Skip to content

Commit

Permalink
fix: correct the proven_time type
Browse files Browse the repository at this point in the history
  • Loading branch information
bendanzhentan committed Mar 14, 2024
1 parent c418aa7 commit 788cfac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"math/big"
"time"

"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
Expand Down Expand Up @@ -242,7 +243,7 @@ func (b *Processor) FinalizeMessage(ctx context.Context, wi *WithdrawalInitiated
return nil
}

func (b *Processor) GetProvenTime(wi *WithdrawalInitiatedLog) (*big.Int, error) {
func (b *Processor) GetProvenTime(wi *WithdrawalInitiatedLog) (*time.Time, error) {
optimismPortal, err := bindings.NewOptimismPortalCaller(b.cfg.L1Contracts.OptimismPortalProxy, b.L1Client)
if err != nil {
return nil, err
Expand All @@ -268,7 +269,10 @@ func (b *Processor) GetProvenTime(wi *WithdrawalInitiatedLog) (*big.Int, error)
return nil, fmt.Errorf("optimismPortal.ProvenWithdrawals err: %v, wi: %v", err, wi)
}

return provenWithdrawal.Timestamp, nil
unixTimestamp := provenWithdrawal.Timestamp.Int64()
t := time.Unix(unixTimestamp, 0)
b.log.Info("GetProvenTime", "time", t.String(), "unixTimestamp", unixTimestamp)
return &t, nil
}

func (b *Processor) hashWithdrawal(w *bindings.TypesWithdrawalTransaction) (string, error) {
Expand Down

0 comments on commit 788cfac

Please sign in to comment.