-
Notifications
You must be signed in to change notification settings - Fork 665
/
test_verifiable.go
53 lines (38 loc) · 969 Bytes
/
test_verifiable.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
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avax
import (
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/vms/components/verify"
)
var (
_ verify.State = (*TestState)(nil)
_ TransferableOut = (*TestTransferable)(nil)
_ Addressable = (*TestAddressable)(nil)
)
type TestState struct {
verify.IsState `json:"-"`
Err error
}
func (*TestState) InitCtx(*snow.Context) {}
func (v *TestState) Verify() error {
return v.Err
}
type TestTransferable struct {
TestState
Val uint64 `serialize:"true"`
}
func (*TestTransferable) InitCtx(*snow.Context) {}
func (t *TestTransferable) Amount() uint64 {
return t.Val
}
func (*TestTransferable) Cost() (uint64, error) {
return 0, nil
}
type TestAddressable struct {
TestTransferable `serialize:"true"`
Addrs [][]byte `serialize:"true"`
}
func (a *TestAddressable) Addresses() [][]byte {
return a.Addrs
}