Add TxCompressedData & V2 with some extra parsers for common

This commit is contained in:
arnaucube
2020-08-21 15:01:01 +02:00
parent 3f63cd7cd0
commit a28c81f4ae
12 changed files with 275 additions and 76 deletions

View File

@@ -1,6 +1,7 @@
package common
import (
"encoding/binary"
"time"
eth "github.com/ethereum/go-ethereum/common"
@@ -26,3 +27,10 @@ type TokenInfo struct {
// TokenID is the unique identifier of the token, as set in the smart contract
type TokenID uint32 // current implementation supports up to 2^32 tokens
// Bytes returns a byte array of length 4 representing the TokenID
func (t TokenID) Bytes() []byte {
var tokenIDBytes [4]byte
binary.LittleEndian.PutUint32(tokenIDBytes[:], uint32(t))
return tokenIDBytes[:]
}