/
dtos.go
101 lines (89 loc) · 3.67 KB
/
dtos.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package outport
import (
"time"
"github.com/ElrondNetwork/elrond-go-core/data"
)
// TokenMetaData is the api metaData struct for tokens
type TokenMetaData struct {
Nonce uint64 `json:"nonce"`
Name string `json:"name"`
Creator string `json:"creator"`
Royalties uint32 `json:"royalties"`
Hash []byte `json:"hash"`
URIs [][]byte `json:"uris"`
Attributes []byte `json:"attributes"`
}
// AccountTokenData holds the data needed for indexing a token of an altered account
type AccountTokenData struct {
Nonce uint64 `json:"nonce"`
Identifier string `json:"identifier"`
Balance string `json:"balance"`
Properties string `json:"properties"`
MetaData *TokenMetaData `json:"metadata,omitempty"`
AdditionalData *AdditionalAccountTokenData `json:"additionalData,omitempty"`
}
// AlteredAccount holds the data needed of an altered account in a block
type AlteredAccount struct {
Nonce uint64 `json:"nonce"`
Address string `json:"address"`
Balance string `json:"balance,omitempty"`
Tokens []*AccountTokenData `json:"tokens"`
AdditionalData *AdditionalAccountData `json:"additionalData,omitempty"`
}
// AdditionalAccountData holds the additional data for an altered account
type AdditionalAccountData struct {
IsSender bool `json:"isSender,omitempty"`
BalanceChanged bool `json:"balanceChanged,omitempty"`
CurrentOwner string `json:"currentOwner,omitempty"`
UserName string `json:"userName,omitempty"`
DeveloperRewards string `json:"developerRewards,omitempty"`
}
// AdditionalAccountTokenData holds the additional data for indexing a token of an altered account
type AdditionalAccountTokenData struct {
IsNFTCreate bool `json:"isNFTCreate,omitempty"`
}
// ArgsSaveBlockData will contain all information that are needed to save block data
type ArgsSaveBlockData struct {
HeaderHash []byte
Body data.BodyHandler
Header data.HeaderHandler
SignersIndexes []uint64
NotarizedHeadersHashes []string
HeaderGasConsumption HeaderGasConsumption
TransactionsPool *Pool
AlteredAccounts map[string]*AlteredAccount
NumberOfShards uint32
IsImportDB bool
}
// HeaderGasConsumption holds the data needed to save the gas consumption of a header
type HeaderGasConsumption struct {
GasProvided uint64
GasRefunded uint64
GasPenalized uint64
MaxGasPerBlock uint64
}
// Pool will hold all types of transaction
type Pool struct {
Txs map[string]data.TransactionHandlerWithGasUsedAndFee
Scrs map[string]data.TransactionHandlerWithGasUsedAndFee
Rewards map[string]data.TransactionHandlerWithGasUsedAndFee
Invalid map[string]data.TransactionHandlerWithGasUsedAndFee
Receipts map[string]data.TransactionHandlerWithGasUsedAndFee
Logs []*data.LogData
ScheduledExecutedSCRSHashesPrevBlock []string
ScheduledExecutedInvalidTxsHashesPrevBlock []string
}
// ValidatorRatingInfo is a structure containing validator rating information
type ValidatorRatingInfo struct {
PublicKey string
Rating float32
}
// RoundInfo is a structure containing block signers and shard id
type RoundInfo struct {
Index uint64
SignersIndexes []uint64
BlockWasProposed bool
ShardId uint32
Epoch uint32
Timestamp time.Duration
}