forked from eoscanada/eos-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
164 lines (140 loc) · 6.86 KB
/
types.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package system
import (
eos "github.com/eoscanada/eos-go"
"github.com/eoscanada/eos-go/ecc"
)
// UpdateAuth represents the hard-coded `updateauth` action.
//
// If you change the `active` permission, `owner` is the required parent.
//
// If you change the `owner` permission, there should be no parent.
type UpdateAuth struct {
Account eos.AccountName `json:"account"`
Permission eos.PermissionName `json:"permission"`
Parent eos.PermissionName `json:"parent"`
Data eos.Authority `json:"data"`
Delay uint32 `json:"delay"` // this represents what exactly?
}
// SetPriv sets privileged account status. Used in the bios boot mechanism.
type SetPriv struct {
Account eos.AccountName `json:"account"`
IsPriv bool `json:"is_priv"`
}
// SetCode represents the hard-coded `setcode` action.
type SetCode struct {
Account eos.AccountName `json:"account"`
VMType byte `json:"vmtype"`
VMVersion byte `json:"vmversion"`
Code eos.HexBytes `json:"bytes"`
}
// SetABI represents the hard-coded `setabi` action.
type SetABI struct {
Account eos.AccountName `json:"account"`
ABI eos.ABI `json:"abi"`
}
// SetProds is present in `eosio.bios` contract. Used only at boot time.
type SetProds struct {
Version uint32 `json:"version"`
Producers []ProducerKey `json:"producers"`
}
type ProducerKey struct {
ProducerName eos.AccountName `json:"producer_name"`
BlockSigningKey ecc.PublicKey `json:"block_signing_key"`
}
// EOSIOParameters are all the params that can be set on the system contract.
type EOSIOParameters struct {
BasePerTransactionNetUsage uint32 `json:"base_per_transaction_net_usage" yaml:"base_per_transaction_net_usage"`
BasePerTransactionCPUUsage uint32 `json:"base_per_transaction_cpu_usage" yaml:"base_per_transaction_cpu_usage"`
BasePerActionCPUUsage uint32 `json:"base_per_action_cpu_usage" yaml:"base_per_action_cpu_usage"`
BaseSetcodeCPUUsage uint32 `json:"base_setcode_cpu_usage" yaml:"base_setcode_cpu_usage"`
PerSignatureCPUUsage uint32 `json:"per_signature_cpu_usage" yaml:"per_signature_cpu_usage"`
PerLockNetUsage uint32 `json:"per_lock_net_usage" yaml:"per_lock_net_usage"`
ContextFreeDiscountCPUUsageNum uint64 `json:"context_free_discount_cpu_usage_num" yaml:"context_free_discount_cpu_usage_num"`
ContextFreeDiscountCPUUsageDen uint64 `json:"context_free_discount_cpu_usage_den" yaml:"context_free_discount_cpu_usage_den"`
MaxTransactionCPUUsage uint32 `json:"max_transaction_cpu_usage" yaml:"max_transaction_cpu_usage"`
MaxTransactionNetUsage uint32 `json:"max_transaction_net_usage" yaml:"max_transaction_net_usage"`
MaxBlockCPUUsage uint64 `json:"max_block_cpu_usage" yaml:"max_block_cpu_usage"`
TargetBlockCPUUsagePct uint32 `json:"target_block_cpu_usage_pct" yaml:"target_block_cpu_usage_pct"` //< the target percent (1% == 100, 100%= 10,000) of maximum cpu usage; exceeding this triggers congestion handling
MaxBblockNetUsage uint64 `json:"max_block_net_usage" yaml:"max_block_net_usage"` //< the maxiumum net usage in instructions for a block
TargetBlockNetUsagePct uint32 `json:"target_block_net_usage_pct" yaml:"target_block_net_usage_pct"` //< the target percent (1% == 100, 100%= 10,000) of maximum net usage; exceeding this triggers congestion handling
MaxTransactionLifetime uint32 `json:"max_transaction_lifetime" yaml:"max_transaction_lifetime"`
MaxTransactionExecTime uint32 `json:"max_transaction_exec_time" yaml:"max_transaction_exec_time"`
MaxAuthorityDepth uint16 `json:"max_authority_depth" yaml:"max_authority_depth"`
MaxInlineDepth uint16 `json:"max_inline_depth" yaml:"max_inline_depth"`
MaxInlineActionSize uint32 `json:"max_inline_action_size" yaml:"max_inline_action_size"`
MaxGeneratedTransactionCount uint32 `json:"max_generated_transaction_count" yaml:"max_generated_transaction_count"`
// FIXME: does not appear in the `abi` for `eosio.system`.
// MaxStorageSize uint64 `json:"max_storage_size" yaml:"max_storage_size"`
PercentOfMaxInflationRate uint32 `json:"percent_of_max_inflation_rate" yaml:"percent_of_max_inflation_rate"`
StorageReserveRatio uint32 `json:"storage_reserve_ratio" yaml:"storage_reserve_ratio"`
}
type EOSIOGlobalState struct {
EOSIOParameters
TotalStorageBytesReserved uint64 `json:"total_storage_bytes_reserved"`
TotalStorageStake uint64 `json:"total_storage_stake"`
PaymentPerBlock uint64 `json:"payment_per_block"`
}
type DelegatedBandwidth struct {
From eos.AccountName `json:"from"`
To eos.AccountName `json:"to"`
NetWeight eos.Asset `json:"net_weight"`
CPUWeight eos.Asset `json:"cpu_weight"`
StorageStake eos.Asset `json:"storage_stake"`
StorageBytes uint64 `json:"storage_bytes"`
}
type TotalResources struct {
}
// DelegateBW represents the `eosio.system::delegatebw` action.
type DelegateBW struct {
From eos.AccountName `json:"from"`
Receiver eos.AccountName `json:"receiver"`
StakeNet eos.Asset `json:"stake_net"`
StakeCPU eos.Asset `json:"stake_cpu"`
StakeStorage eos.Asset `json:"stake_storage"`
}
// UndelegateBW represents the `eosio.system::undelegatebw` action.
type UndelegateBW struct {
From eos.AccountName `json:"from"`
Receiver eos.AccountName `json:"receiver"`
UnstakeNet eos.Asset `json:"unstake_net"`
UnstakeCPU eos.Asset `json:"unstake_cpu"`
UnstakeBytes uint64 `json:"unstake_bytes"`
}
// Refund represents the `eosio.system::refund` action
type Refund struct {
Owner eos.AccountName `json:"owner"`
}
// RegProducer represents the `eosio.system::regproducer` action
type RegProducer struct {
Producer eos.AccountName `json:"producer"`
ProducerKey []byte `json:"producer_key"`
Prefs EOSIOParameters `json:"eosio_parameters"`
}
// UnregProducer represents the `eosio.system::unregprod` action
type UnregProducer struct {
Producer eos.AccountName `json:"producer"`
}
// RegProxy represents the `eosio.system::regproxy` action
type RegProxy struct {
Proxy eos.AccountName `json:"proxy"`
}
// UnregProxy represents the `eosio.system::unregproxy` action
type UnregProxy struct {
Proxy eos.AccountName `json:"proxy"`
}
// VoteProducer represents the `eosio.system::voteproducer` action
type VoteProducer struct {
Voter eos.AccountName `json:"voter"`
Proxy eos.AccountName `json:"proxy"`
Producers []eos.AccountName `json:"producers"`
}
// ClaimRewards repreents the `eosio.system::claimrewards` action
type ClaimRewards struct {
Owner eos.AccountName `json:"owner"`
}
// Nonce represents the `eosio.system::nonce` action. It is used to
// add variability in a transaction, so you can send the same many
// times in the same block, without it having the same Tx hash.
type Nonce struct {
Value string `json:"value"`
}