github.com/MetalBlockchain/metalgo@v1.11.9/vms/avm/txs/create_asset_tx.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package txs 5 6 import ( 7 "github.com/MetalBlockchain/metalgo/snow" 8 "github.com/MetalBlockchain/metalgo/vms/secp256k1fx" 9 ) 10 11 var ( 12 _ UnsignedTx = (*CreateAssetTx)(nil) 13 _ secp256k1fx.UnsignedTx = (*CreateAssetTx)(nil) 14 ) 15 16 // CreateAssetTx is a transaction that creates a new asset. 17 type CreateAssetTx struct { 18 BaseTx `serialize:"true"` 19 Name string `serialize:"true" json:"name"` 20 Symbol string `serialize:"true" json:"symbol"` 21 Denomination byte `serialize:"true" json:"denomination"` 22 States []*InitialState `serialize:"true" json:"initialStates"` 23 } 24 25 func (t *CreateAssetTx) InitCtx(ctx *snow.Context) { 26 for _, state := range t.States { 27 state.InitCtx(ctx) 28 } 29 t.BaseTx.InitCtx(ctx) 30 } 31 32 // InitialStates track which virtual machines, and the initial state of these 33 // machines, this asset uses. The returned array should not be modified. 34 func (t *CreateAssetTx) InitialStates() []*InitialState { 35 return t.States 36 } 37 38 func (t *CreateAssetTx) Visit(v Visitor) error { 39 return v.CreateAssetTx(t) 40 }