neo-go/pkg/core/transaction/register.go
Roman Khimov 8b3080b972 io: rename Read/WriteBytes to Read/WriteB
go vet is not happy about them:
  pkg/io/binaryReader.go:92:21: method ReadByte() byte should have signature ReadByte() (byte, error)
  pkg/io/binaryWriter.go:75:21: method WriteByte(u8 byte) should have signature WriteByte(byte) error
2019-12-12 20:19:50 +03:00

53 lines
1.1 KiB
Go

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
// Amount registered.
// Unlimited mode -0.00000001.
Amount util.Fixed8
// Decimals.
Precision uint8
// Public key of the owner.
Owner keys.PublicKey
Admin util.Uint160
}
// DecodeBinary implements Serializable interface.
func (tx *RegisterTX) DecodeBinary(br *io.BinReader) {
tx.AssetType = AssetType(br.ReadB())
tx.Name = br.ReadString()
tx.Amount.DecodeBinary(br)
tx.Precision = uint8(br.ReadB())
tx.Owner.DecodeBinary(br)
br.ReadBytes(tx.Admin[:])
}
// EncodeBinary implements Serializable interface.
func (tx *RegisterTX) EncodeBinary(bw *io.BinWriter) {
bw.WriteB(byte(tx.AssetType))
bw.WriteString(tx.Name)
tx.Amount.EncodeBinary(bw)
bw.WriteB(byte(tx.Precision))
bw.WriteBytes(tx.Owner.Bytes())
bw.WriteBytes(tx.Admin[:])
}