-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer_output.go
39 lines (29 loc) · 905 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
// (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{}
)
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 }
func (out *TransferOutput) Verify() error {
switch {
case out == nil:
return errNilOutput
case out.Amt == 0:
return errNoValueOutput
default:
return out.OutputOwners.Verify()
}
}
func (out *TransferOutput) VerifyState() error { return out.Verify() }
func (out *TransferOutput) Owners() interface{} { return &out.OutputOwners }