mirror of https://github.com/poanetwork/gecko.git
36 lines
692 B
Go
36 lines
692 B
Go
|
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
|
||
|
// See the file LICENSE for licensing terms.
|
||
|
|
||
|
package avm
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
|
||
|
"github.com/ava-labs/gecko/ids"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
errNilAssetID = errors.New("nil asset ID is not valid")
|
||
|
errEmptyAssetID = errors.New("empty asset ID is not valid")
|
||
|
)
|
||
|
|
||
|
// Asset ...
|
||
|
type Asset struct {
|
||
|
ID ids.ID `serialize:"true"`
|
||
|
}
|
||
|
|
||
|
// AssetID returns the ID of the contained asset
|
||
|
func (asset *Asset) AssetID() ids.ID { return asset.ID }
|
||
|
|
||
|
// Verify implements the verify.Verifiable interface
|
||
|
func (asset *Asset) Verify() error {
|
||
|
switch {
|
||
|
case asset == nil:
|
||
|
return errNilAssetID
|
||
|
case asset.ID.IsZero():
|
||
|
return errEmptyAssetID
|
||
|
default:
|
||
|
return nil
|
||
|
}
|
||
|
}
|