forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.go
30 lines (25 loc) · 748 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
package eventindexer
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"`
}
// SaveBlockOpts is required to store a new block
type SaveBlockOpts struct {
Height uint64
Hash common.Hash
ChainID *big.Int
}
// BlockRepository defines methods necessary for interacting with
// the block store.
type BlockRepository interface {
Save(opts SaveBlockOpts) error
GetLatestBlockProcessed(chainID *big.Int) (*Block, error)
}