@@ -22,14 +22,13 @@ import (
22
22
23
23
// GetParams returns the total set of evm parameters.
24
24
func (k Keeper ) GetParams (ctx sdk.Context ) (params types.Params ) {
25
- evmDenom := k .GetEVMDenom (ctx )
26
- allowUnprotectedTx := k .GetAllowUnprotectedTxs (ctx )
27
- enableCreate := k .GetEnableCreate (ctx )
28
- enableCall := k .GetEnableCall (ctx )
29
- chainCfg := k .GetChainConfig (ctx )
30
- extraEIPs := k .GetExtraEIPs (ctx )
31
-
32
- return types .NewParams (evmDenom , allowUnprotectedTx , enableCreate , enableCall , chainCfg , extraEIPs )
25
+ store := ctx .KVStore (k .storeKey )
26
+ bz := store .Get (types .KeyPrefixParams )
27
+ if len (bz ) == 0 {
28
+ return k .GetLegacyParams (ctx )
29
+ }
30
+ k .cdc .MustUnmarshal (bz , & params )
31
+ return
33
32
}
34
33
35
34
// SetParams sets the EVM params each in their individual key for better get performance
@@ -38,13 +37,13 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
38
37
return err
39
38
}
40
39
41
- k .setExtraEIPs (ctx , params .ExtraEIPs )
42
- k .setChainConfig (ctx , params .ChainConfig )
43
- k .setEvmDenom (ctx , params .EvmDenom )
44
- k .setEnableCall (ctx , params .EnableCall )
45
- k .setEnableCreate (ctx , params .EnableCreate )
46
- k .setAllowUnprotectedTxs (ctx , params .AllowUnprotectedTxs )
40
+ store := ctx .KVStore (k .storeKey )
41
+ bz , err := k .cdc .Marshal (& params )
42
+ if err != nil {
43
+ return err
44
+ }
47
45
46
+ store .Set (types .KeyPrefixParams , bz )
48
47
return nil
49
48
}
50
49
@@ -54,117 +53,3 @@ func (k Keeper) GetLegacyParams(ctx sdk.Context) types.Params {
54
53
k .ss .GetParamSetIfExists (ctx , & params )
55
54
return params
56
55
}
57
-
58
- // GetExtraEIPs returns the extra EIPs enabled on the chain.
59
- func (k Keeper ) GetExtraEIPs (ctx sdk.Context ) types.ExtraEIPs {
60
- var extraEIPs types.ExtraEIPs
61
- store := ctx .KVStore (k .storeKey )
62
- bz := store .Get (types .ParamStoreKeyExtraEIPs )
63
- if len (bz ) == 0 {
64
- return k .GetLegacyParams (ctx ).ExtraEIPs
65
- }
66
- k .cdc .MustUnmarshal (bz , & extraEIPs )
67
- return extraEIPs
68
- }
69
-
70
- // GetChainConfig returns the chain configuration parameter.
71
- func (k Keeper ) GetChainConfig (ctx sdk.Context ) types.ChainConfig {
72
- var chainCfg types.ChainConfig
73
- store := ctx .KVStore (k .storeKey )
74
- bz := store .Get (types .ParamStoreKeyChainConfig )
75
- if len (bz ) == 0 {
76
- return k .GetLegacyParams (ctx ).ChainConfig
77
- }
78
- k .cdc .MustUnmarshal (bz , & chainCfg )
79
- return chainCfg
80
- }
81
-
82
- // GetEVMDenom returns the EVM denom.
83
- func (k Keeper ) GetEVMDenom (ctx sdk.Context ) string {
84
- store := ctx .KVStore (k .storeKey )
85
- bz := store .Get (types .ParamStoreKeyEVMDenom )
86
- if len (bz ) == 0 {
87
- return k .GetLegacyParams (ctx ).EvmDenom
88
- }
89
- return string (bz )
90
- }
91
-
92
- // GetEnableCall returns true if the EVM Call operation is enabled.
93
- func (k Keeper ) GetEnableCall (ctx sdk.Context ) bool {
94
- store := ctx .KVStore (k .storeKey )
95
- exist := store .Has (types .ParamStoreKeyEnableCall )
96
- if ! exist {
97
- exist = k .GetLegacyParams (ctx ).EnableCall
98
- }
99
- return exist
100
- }
101
-
102
- // GetEnableCreate returns true if the EVM Create contract operation is enabled.
103
- func (k Keeper ) GetEnableCreate (ctx sdk.Context ) bool {
104
- store := ctx .KVStore (k .storeKey )
105
- exist := store .Has (types .ParamStoreKeyEnableCreate )
106
- if ! exist {
107
- exist = k .GetLegacyParams (ctx ).EnableCreate
108
- }
109
- return exist
110
- }
111
-
112
- // GetAllowUnprotectedTxs returns true if unprotected txs (i.e non-replay protected as per EIP-155) are supported by the chain.
113
- func (k Keeper ) GetAllowUnprotectedTxs (ctx sdk.Context ) bool {
114
- store := ctx .KVStore (k .storeKey )
115
- exist := store .Has (types .ParamStoreKeyAllowUnprotectedTxs )
116
- if ! exist {
117
- exist = k .GetLegacyParams (ctx ).AllowUnprotectedTxs
118
- }
119
- return exist
120
- }
121
-
122
- // setChainConfig sets the ChainConfig in the store
123
- func (k Keeper ) setChainConfig (ctx sdk.Context , chainCfg types.ChainConfig ) {
124
- store := ctx .KVStore (k .storeKey )
125
- chainCfgBz := k .cdc .MustMarshal (& chainCfg )
126
- store .Set (types .ParamStoreKeyChainConfig , chainCfgBz )
127
- }
128
-
129
- // setExtraEIPs sets the ExtraEIPs in the store
130
- func (k Keeper ) setExtraEIPs (ctx sdk.Context , extraEIPs types.ExtraEIPs ) {
131
- extraEIPsBz := k .cdc .MustMarshal (& extraEIPs )
132
- store := ctx .KVStore (k .storeKey )
133
- store .Set (types .ParamStoreKeyExtraEIPs , extraEIPsBz )
134
- }
135
-
136
- // setEvmDenom sets the EVMDenom param in the store
137
- func (k Keeper ) setEvmDenom (ctx sdk.Context , evmDenom string ) {
138
- store := ctx .KVStore (k .storeKey )
139
- store .Set (types .ParamStoreKeyEVMDenom , []byte (evmDenom ))
140
- }
141
-
142
- // setAllowUnprotectedTxs sets the AllowUnprotectedTxs param in the store
143
- func (k Keeper ) setAllowUnprotectedTxs (ctx sdk.Context , enable bool ) {
144
- store := ctx .KVStore (k .storeKey )
145
- if enable {
146
- store .Set (types .ParamStoreKeyAllowUnprotectedTxs , []byte {0x01 })
147
- return
148
- }
149
- store .Delete (types .ParamStoreKeyAllowUnprotectedTxs )
150
- }
151
-
152
- // setEnableCreate sets the EnableCreate param in the store
153
- func (k Keeper ) setEnableCreate (ctx sdk.Context , enable bool ) {
154
- store := ctx .KVStore (k .storeKey )
155
- if enable {
156
- store .Set (types .ParamStoreKeyEnableCreate , []byte {0x01 })
157
- return
158
- }
159
- store .Delete (types .ParamStoreKeyEnableCreate )
160
- }
161
-
162
- // setEnableCall sets the EnableCall param in the store
163
- func (k Keeper ) setEnableCall (ctx sdk.Context , enable bool ) {
164
- store := ctx .KVStore (k .storeKey )
165
- if enable {
166
- store .Set (types .ParamStoreKeyEnableCall , []byte {0x01 })
167
- return
168
- }
169
- store .Delete (types .ParamStoreKeyEnableCall )
170
- }
0 commit comments