/
register.go
53 lines (40 loc) · 1.12 KB
/
register.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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[:])
}