forked from palomachain/paloma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
71 lines (57 loc) · 1.42 KB
/
types.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
package xchain
import (
"context"
"github.com/VolumeFi/whoops"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"
)
type (
Type = string
ReferenceID = string
)
type RequiredInterfaceToSupport interface {
Bridge
}
//go:generate mockery --name=Bridge
type Bridge interface {
Info
Jobber
WalletUpdater
}
type Info interface {
XChainType() Type
XChainReferenceIDs(context.Context) []ReferenceID
}
type CobraTXJobAdder interface {
Args() cobra.Command
Flags() any
Parse(*cobra.Command, []string) (any, error)
}
type JobRequirements struct {
EnforceMEVRelay bool
}
type JobConfiguration struct {
Definition []byte
Payload []byte
SenderAddress sdk.AccAddress
ContractAddress sdk.AccAddress
RefID ReferenceID
Requirements JobRequirements
}
type Jobber interface {
VerifyJob(ctx context.Context, definition []byte, payload []byte, refID ReferenceID) (err error)
ExecuteJob(ctx context.Context, jcfg *JobConfiguration) (msgID uint64, err error)
}
//go:generate mockery --name=FundCollecter
type FundCollecter interface {
CollectJobFundEvents(ctx sdk.Context) error
}
type WalletUpdater interface {
// every chain that we support should implement this. Using this, we can
// ask all chains to send wallet updates to paloma.
// TriggerWalletUpdate(sdk.Context) error
}
// errors
const (
ErrIncorrectJobType = whoops.Errorf("incorrect job type: got %T, expected %T")
)