forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.go
38 lines (33 loc) · 951 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
33
34
35
36
37
38
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"`
DestChainID int64 `json:"destChainID"`
EventName string `json:"eventName"`
}
// SaveBlockOpts is required to store a new block
type SaveBlockOpts struct {
Height uint64
Hash common.Hash
ChainID *big.Int
DestChainID *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,
destChainID *big.Int,
) (*Block, error)
}