-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.go
71 lines (64 loc) · 1.96 KB
/
account.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
package scenmodel
import "bytes"
// Account is a json object representing an account.
type Account struct {
Address JSONBytesFromString
Shard JSONUint64
IsSmartContract bool
Comment string
Nonce JSONUint64
Balance JSONBigInt
Username JSONBytesFromString
Storage []*StorageKeyValuePair
Code JSONBytesFromString
CodeMetadata JSONBytesFromString
Owner JSONBytesFromString
AsyncCallData string
ESDTData []*ESDTData
Update bool
DeveloperReward JSONBigInt
}
// StorageKeyValuePair is a json key value pair in the storage map.
type StorageKeyValuePair struct {
Key JSONBytesFromString
Value JSONBytesFromTree
}
// CheckAccount is a json object representing checks for an account.
type CheckAccount struct {
Address JSONBytesFromString
Comment string
Nonce JSONCheckUint64
Balance JSONCheckBigInt
Username JSONCheckBytes
ExplicitStorage bool
IgnoreStorage bool
MoreStorageAllowed bool
CheckStorage []*CheckStorageKeyValuePair
Code JSONCheckBytes
CodeMetadata JSONCheckBytes
Owner JSONCheckBytes
AsyncCallData JSONCheckBytes
CheckESDTData []*CheckESDTData
IgnoreESDT bool
MoreESDTTokensAllowed bool
DeveloperReward JSONCheckBigInt
}
// CheckStorageKeyValuePair checks a single entry in storage.
type CheckStorageKeyValuePair struct {
Key JSONBytesFromString
CheckValue JSONCheckBytes
}
// CheckAccounts encodes rules to check mock accounts.
type CheckAccounts struct {
Accounts []*CheckAccount
MoreAccountsAllowed bool
}
// FindCheckAccount searches a check account list by address.
func FindCheckAccount(accounts []*CheckAccount, address []byte) *CheckAccount {
for _, acct := range accounts {
if bytes.Equal(acct.Address.Value, address) {
return acct
}
}
return nil
}