mirror of
https://github.com/luxfi/utxo.git
synced 2026-07-27 03:39:23 +00:00
39 lines
733 B
Go
39 lines
733 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package utxo
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/vm/components/verify"
|
|
)
|
|
|
|
var (
|
|
errNilAssetID = errors.New("nil asset ID is not valid")
|
|
errEmptyAssetID = errors.New("empty asset ID is not valid")
|
|
|
|
_ verify.Verifiable = (*Asset)(nil)
|
|
)
|
|
|
|
type Asset struct {
|
|
ID ids.ID `serialize:"true" json:"assetID"`
|
|
}
|
|
|
|
// AssetID returns the ID of the contained asset
|
|
func (asset *Asset) AssetID() ids.ID {
|
|
return asset.ID
|
|
}
|
|
|
|
func (asset *Asset) Verify() error {
|
|
switch {
|
|
case asset == nil:
|
|
return errNilAssetID
|
|
case asset.ID == ids.Empty:
|
|
return errEmptyAssetID
|
|
default:
|
|
return nil
|
|
}
|
|
}
|