-
Notifications
You must be signed in to change notification settings - Fork 2
/
txOmni.go
59 lines (55 loc) · 1.44 KB
/
txOmni.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
54
55
56
57
58
package lbtcTransaction
type OmniStruct struct {
TxType int
PropertyId uint32
Amount uint64
Ecosystem byte
Memo string
Address string
}
func (os OmniStruct) getPayload() []byte {
payload := []byte{}
switch os.TxType {
case SimpleSend:
payload = createPayloadSimpleSend(os.PropertyId, os.Amount)
break
case SendAll:
payload = createPayloadSendAll(os.Ecosystem)
break
case DExAccept:
payload = createPayloadDExAccept(os.PropertyId, os.Amount)
break
case MetaDExCancelEcosystem:
payload = createPayloadMetaDExCancelEcosystem(os.Ecosystem)
break
case CloseCrowdsale:
payload = createPayloadCloseCrowdsale(os.PropertyId)
break
case Grant:
payload = createPayloadGrant(os.PropertyId, os.Amount, os.Memo)
break
case Revoke:
payload = createPayloadRevoke(os.PropertyId, os.Amount, os.Memo)
break
case ChangeIssuer:
payload = createPayloadChangeIssuer(os.PropertyId)
break
case EnableFreezing:
payload = createPayloadEnableFreezing(os.PropertyId)
break
case DisableFreezing:
payload = createPayloadDisableFreezing(os.PropertyId)
break
case FreezeTokens:
payload = createPayloadFreezeTokens(os.PropertyId, os.Amount, os.Address)
break
case UnfreezeTokens:
payload = createPayloadUnfreezeTokens(os.PropertyId, os.Amount, os.Address)
break
default:
return nil
}
payload = append(OmniPrefix[:], payload...)
payload = append([]byte{OpReturn, byte(len(payload))}, payload...)
return payload
}