arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
hermez-node/txselector/utils.go
txselector/utils.goRaw
 1package txselector
 2
 3import (
 4	"encoding/binary"
 5
 6	ethCommon "github.com/ethereum/go-ethereum/common"
 7)
 8
 9func getAccountID(addr ethCommon.Address, tokenID uint32) [36]byte {
10	var tokenIDBytes [4]byte
11	binary.LittleEndian.PutUint32(tokenIDBytes[:], tokenID)
12	accountIDBytes := append(addr[:], tokenIDBytes[:]...)
13	var accountID [36]byte
14	copy(accountID[:], accountIDBytes[:36])
15	return accountID
16}