github.com/algorand/go-algorand-sdk@v1.24.0/types/asset.go (about)

     1  package types
     2  
     3  // AssetNameMaxLen is the max length in bytes for the asset name
     4  const AssetNameMaxLen = 32
     5  
     6  // AssetUnitNameMaxLen is the max length in bytes for the asset unit name
     7  const AssetUnitNameMaxLen = 8
     8  
     9  // AssetURLMaxLen is the max length in bytes for the asset url
    10  const AssetURLMaxLen = 96
    11  
    12  // AssetMetadataHashLen is the length of the AssetMetadataHash in bytes
    13  const AssetMetadataHashLen = 32
    14  
    15  // AssetMaxNumberOfDecimals is the maximum value of the Decimals field
    16  const AssetMaxNumberOfDecimals = 19
    17  
    18  // AssetIndex is the unique integer index of an asset that can be used to look
    19  // up the creator of the asset, whose balance record contains the AssetParams
    20  type AssetIndex uint64
    21  
    22  // AssetParams describes the parameters of an asset.
    23  type AssetParams struct {
    24  	_struct struct{} `codec:",omitempty,omitemptyarray"`
    25  
    26  	// Total specifies the total number of units of this asset
    27  	// created.
    28  	Total uint64 `codec:"t"`
    29  
    30  	// Decimals specifies the number of digits to display after the decimal
    31  	// place when displaying this asset. A value of 0 represents an asset
    32  	// that is not divisible, a value of 1 represents an asset divisible
    33  	// into tenths, and so on. This value must be between 0 and 19
    34  	// (inclusive).
    35  	Decimals uint32 `codec:"dc"`
    36  
    37  	// DefaultFrozen specifies whether slots for this asset
    38  	// in user accounts are frozen by default or not.
    39  	DefaultFrozen bool `codec:"df"`
    40  
    41  	// UnitName specifies a hint for the name of a unit of
    42  	// this asset.
    43  	UnitName string `codec:"un"`
    44  
    45  	// AssetName specifies a hint for the name of the asset.
    46  	AssetName string `codec:"an"`
    47  
    48  	// URL specifies a URL where more information about the asset can be
    49  	// retrieved
    50  	URL string `codec:"au"`
    51  
    52  	// MetadataHash specifies a commitment to some unspecified asset
    53  	// metadata. The format of this metadata is up to the application.
    54  	MetadataHash [AssetMetadataHashLen]byte `codec:"am"`
    55  
    56  	// Manager specifies an account that is allowed to change the
    57  	// non-zero addresses in this AssetParams.
    58  	Manager Address `codec:"m"`
    59  
    60  	// Reserve specifies an account whose holdings of this asset
    61  	// should be reported as "not minted".
    62  	Reserve Address `codec:"r"`
    63  
    64  	// Freeze specifies an account that is allowed to change the
    65  	// frozen state of holdings of this asset.
    66  	Freeze Address `codec:"f"`
    67  
    68  	// Clawback specifies an account that is allowed to take units
    69  	// of this asset from any account.
    70  	Clawback Address `codec:"c"`
    71  }
    72  
    73  var zeroAP = AssetParams{}
    74  
    75  // IsZero returns true if the AssetParams struct is completely empty.
    76  // The AssetParams zero object is used in destroying an asset.
    77  func (ap AssetParams) IsZero() bool {
    78  	return ap == zeroAP
    79  }