2018-03-17 11:53:21 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
2019-08-27 13:29:42 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
|
2019-09-16 09:18:13 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
2018-03-17 11:53:21 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/util"
|
|
|
|
)
|
|
|
|
|
2018-03-21 16:11:04 +00:00
|
|
|
// RegisterTX represents a register transaction.
|
2018-03-25 10:45:54 +00:00
|
|
|
// NOTE: This is deprecated.
|
2018-03-17 11:53:21 +00:00
|
|
|
type RegisterTX struct {
|
|
|
|
// The type of the asset being registered.
|
|
|
|
AssetType AssetType
|
|
|
|
|
|
|
|
// Name of the asset being registered.
|
2018-03-25 10:45:54 +00:00
|
|
|
Name string
|
2018-03-17 11:53:21 +00:00
|
|
|
|
2019-10-22 14:56:03 +00:00
|
|
|
// Amount registered.
|
|
|
|
// Unlimited mode -0.00000001.
|
2018-03-17 11:53:21 +00:00
|
|
|
Amount util.Fixed8
|
|
|
|
|
2019-10-22 14:56:03 +00:00
|
|
|
// Decimals.
|
2018-03-17 11:53:21 +00:00
|
|
|
Precision uint8
|
|
|
|
|
2019-10-22 14:56:03 +00:00
|
|
|
// Public key of the owner.
|
2019-12-09 15:33:04 +00:00
|
|
|
Owner keys.PublicKey
|
2018-03-21 16:11:04 +00:00
|
|
|
|
2018-03-17 11:53:21 +00:00
|
|
|
Admin util.Uint160
|
|
|
|
}
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// DecodeBinary implements Serializable interface.
|
|
|
|
func (tx *RegisterTX) DecodeBinary(br *io.BinReader) {
|
2019-08-28 16:27:06 +00:00
|
|
|
br.ReadLE(&tx.AssetType)
|
2018-03-25 10:45:54 +00:00
|
|
|
|
2019-08-28 16:27:06 +00:00
|
|
|
tx.Name = br.ReadString()
|
2018-03-25 10:45:54 +00:00
|
|
|
|
2019-08-28 16:27:06 +00:00
|
|
|
br.ReadLE(&tx.Amount)
|
|
|
|
br.ReadLE(&tx.Precision)
|
2018-03-17 11:53:21 +00:00
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
tx.Owner.DecodeBinary(br)
|
2018-03-17 11:53:21 +00:00
|
|
|
|
2019-12-06 15:37:46 +00:00
|
|
|
br.ReadBytes(tx.Admin[:])
|
2018-03-17 11:53:21 +00:00
|
|
|
}
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// EncodeBinary implements Serializable interface.
|
|
|
|
func (tx *RegisterTX) EncodeBinary(bw *io.BinWriter) {
|
2019-08-28 16:27:06 +00:00
|
|
|
bw.WriteLE(tx.AssetType)
|
|
|
|
bw.WriteString(tx.Name)
|
|
|
|
bw.WriteLE(tx.Amount)
|
|
|
|
bw.WriteLE(tx.Precision)
|
2019-11-22 10:34:06 +00:00
|
|
|
bw.WriteBytes(tx.Owner.Bytes())
|
2019-12-06 15:22:21 +00:00
|
|
|
bw.WriteBytes(tx.Admin[:])
|
2018-03-17 11:53:21 +00:00
|
|
|
}
|