-
Notifications
You must be signed in to change notification settings - Fork 652
/
transfer_output.go
43 lines (33 loc) · 974 Bytes
/
transfer_output.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
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package secp256k1fx
import (
"errors"
"github.com/ava-labs/avalanchego/vms/components/verify"
)
var (
errNoValueOutput = errors.New("output has no value")
_ verify.State = &OutputOwners{}
)
// TransferOutput ...
type TransferOutput struct {
Amt uint64 `serialize:"true" json:"amount"`
OutputOwners `serialize:"true"`
}
// Amount returns the quantity of the asset this output consumes
func (out *TransferOutput) Amount() uint64 { return out.Amt }
// Verify ...
func (out *TransferOutput) Verify() error {
switch {
case out == nil:
return errNilOutput
case out.Amt == 0:
return errNoValueOutput
default:
return out.OutputOwners.Verify()
}
}
// VerifyState ...
func (out *TransferOutput) VerifyState() error { return out.Verify() }
// Owners ...
func (out *TransferOutput) Owners() interface{} { return &out.OutputOwners }