neo-go/pkg/core/transaction/register.go

55 lines
1.1 KiB
Go
Raw Normal View History

package transaction
import (
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
"github.com/CityOfZion/neo-go/pkg/io"
"github.com/CityOfZion/neo-go/pkg/util"
)
// RegisterTX represents a register transaction.
// NOTE: This is deprecated.
type RegisterTX struct {
// The type of the asset being registered.
AssetType AssetType
// Name of the asset being registered.
Name string
2019-10-22 14:56:03 +00:00
// Amount registered.
// Unlimited mode -0.00000001.
Amount util.Fixed8
2019-10-22 14:56:03 +00:00
// Decimals.
Precision uint8
2019-10-22 14:56:03 +00:00
// Public key of the owner.
Owner *keys.PublicKey
Admin util.Uint160
}
// DecodeBinary implements Serializable interface.
func (tx *RegisterTX) DecodeBinary(br *io.BinReader) {
br.ReadLE(&tx.AssetType)
tx.Name = br.ReadString()
br.ReadLE(&tx.Amount)
br.ReadLE(&tx.Precision)
tx.Owner = &keys.PublicKey{}
tx.Owner.DecodeBinary(br)
br.ReadLE(&tx.Admin)
}
// EncodeBinary implements Serializable interface.
func (tx *RegisterTX) EncodeBinary(bw *io.BinWriter) {
bw.WriteLE(tx.AssetType)
bw.WriteString(tx.Name)
bw.WriteLE(tx.Amount)
bw.WriteLE(tx.Precision)
bw.WriteBytes(tx.Owner.Bytes())
bw.WriteLE(tx.Admin)
}