-
Notifications
You must be signed in to change notification settings - Fork 13
/
interfaces.go
105 lines (85 loc) · 3.1 KB
/
interfaces.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package ethglue
import (
"context"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
)
type ETHDiallerIF interface {
Dial(rawUrl string) (ethClient ETHClientIF, err error)
DialContext(ctx context.Context, rawUrl string) (ETHClientIF, error)
}
type ETHClientIF interface {
bind.ContractBackend
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
}
type FakeETHDialler struct {
DialContextStub func(ctx context.Context, rawUrl string) (ETHClientIF, error)
DialContextCalls int
DialStub func(rawUrl string) (ethClient ETHClientIF, err error)
DialCalls int
}
func (me *FakeETHDialler) Dial(rawUrl string) (ethClient ETHClientIF, err error) {
me.DialCalls++
if me.DialStub == nil {
return nil, nil
}
return me.DialStub(rawUrl)
}
func (me *FakeETHDialler) DialContext(ctx context.Context, rawUrl string) (ETHClientIF, error) {
me.DialContextCalls++
if me.DialContextStub == nil {
return nil, nil
}
return me.DialContextStub(ctx, rawUrl)
}
type FakeETHClient struct {
HeaderByNumberStub func(ctx context.Context, number *big.Int) (*types.Header, error)
HeaderByNumberCalls int
SubscribeFilterLogsStub func(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
SubscribeFilterLogsCalls int
}
func (me *FakeETHClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) {
me.HeaderByNumberCalls++
if me.HeaderByNumberStub == nil {
return nil, nil
}
return me.HeaderByNumberStub(ctx, number)
}
func (me *FakeETHClient) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) {
panic("implement me")
}
func (me *FakeETHClient) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
panic("implement me")
}
func (me *FakeETHClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) {
panic("implement me")
}
func (me *FakeETHClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) {
panic("implement me")
}
func (me *FakeETHClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) {
panic("implement me")
}
func (me *FakeETHClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error) {
panic("implement me")
}
func (me *FakeETHClient) SendTransaction(ctx context.Context, tx *types.Transaction) error {
panic("implement me")
}
func (me *FakeETHClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error) {
panic("implement me")
}
func (me *FakeETHClient) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
me.SubscribeFilterLogsCalls++
if me.SubscribeFilterLogsStub == nil {
return nil, nil
}
return me.SubscribeFilterLogsStub(ctx, query, ch)
}
func (me *FakeETHClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
panic("implement me")
}