forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.go
32 lines (27 loc) · 838 Bytes
/
block.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
package relayer
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
)
// Block is a database model representing simple header types
// to keep track of our most recently processed block number and hash.
type Block struct {
ID int `json:"id"`
Height uint64 `json:"blockHeight" gorm:"column:block_height"`
Hash string `json:"hash"`
ChainID int64 `json:"chainID"`
EventName string `json:"eventName"`
}
// SaveBlockOpts is required to store a new block
type SaveBlockOpts struct {
Height uint64
Hash common.Hash
ChainID *big.Int
EventName string
}
// BlockRepository defines methods necessary for interacting with
// the block store.
type BlockRepository interface {
Save(opts SaveBlockOpts) error
GetLatestBlockProcessedForEvent(eventName string, chainID *big.Int) (*Block, error)
}