github.com/ava-labs/avalanchego@v1.11.11/vms/secp256k1fx/transfer_input.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package secp256k1fx 5 6 import ( 7 "errors" 8 9 "github.com/ava-labs/avalanchego/snow" 10 ) 11 12 var ErrNoValueInput = errors.New("input has no value") 13 14 type TransferInput struct { 15 Amt uint64 `serialize:"true" json:"amount"` 16 Input `serialize:"true"` 17 } 18 19 func (*TransferInput) InitCtx(*snow.Context) {} 20 21 // Amount returns the quantity of the asset this input produces 22 func (in *TransferInput) Amount() uint64 { 23 return in.Amt 24 } 25 26 // Verify this input is syntactically valid 27 func (in *TransferInput) Verify() error { 28 switch { 29 case in == nil: 30 return ErrNilInput 31 case in.Amt == 0: 32 return ErrNoValueInput 33 default: 34 return in.Input.Verify() 35 } 36 }