forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat.go
39 lines (34 loc) · 1.09 KB
/
stat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package eventindexer
import (
"context"
"math/big"
)
var (
StatTypeProofTime = "proofTime"
StatTypeProofReward = "proofReward"
)
// Event represents a stored EVM event. The fields will be serialized
// into the Data field to be unmarshalled into a concrete struct
// dependant on the name of the event
type Stat struct {
ID int `json:"id"`
AverageProofTime string `json:"averageProofTime"`
AverageProofReward string `json:"averageProofReward"`
NumProofs uint64 `json:"numProofs"`
NumBlocksAssigned uint64 `json:"numBlocksAssigned"`
FeeTokenAddress string `json:"feeTokenAddress"`
StatType string `json:"statType"`
}
// SaveStatOpts
type SaveStatOpts struct {
ProofTime *big.Int
ProofReward *big.Int
FeeTokenAddress *string
StatType string
}
// StatRepository is used to interact with stats in the store
type StatRepository interface {
Save(ctx context.Context, opts SaveStatOpts) (*Stat, error)
Find(ctx context.Context, statType string, feeTokenAddress *string) (*Stat, error)
FindAll(ctx context.Context) ([]*Stat, error)
}