arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
hermez-node/common/token.go
common/token.goRaw
 1package common
 2
 3import (
 4	"time"
 5
 6	eth "github.com/ethereum/go-ethereum/common"
 7)
 8
 9// Token is a struct that represents an Ethereum token that is supported in Hermez network
10type Token struct {
11	TokenID     TokenID
12	EthAddr     eth.Address
13	Name        string
14	Symbol      string
15	Decimals    uint64
16	EthTxHash   eth.Hash // Ethereum TxHash in which this token was registered
17	EthBlockNum uint64   // Ethereum block number in which this token was registered
18}
19
20// TokenInfo provides the price of the token in USD
21type TokenInfo struct {
22	TokenID     uint32
23	Value       float64
24	LastUpdated time.Time
25}
26
27// TokenID is the unique identifier of the token, as set in the smart contract
28type TokenID uint32 // current implementation supports up to 2^32 tokens