20
20
#![ cfg_attr( not( feature = "std" ) , no_std) ]
21
21
22
22
use bitflags:: bitflags;
23
- use codec:: { Decode , Encode } ;
23
+ use codec:: { Decode , Encode , MaxEncodedLen } ;
24
24
use scale_info:: TypeInfo ;
25
25
use sp_runtime:: {
26
26
traits:: { Saturating , Zero } ,
@@ -39,7 +39,7 @@ use sp_weights::Weight;
39
39
/// It has been extended to include `events` at the end of the struct while not bumping the
40
40
/// `ContractsApi` version. Therefore when SCALE decoding a `ContractResult` its trailing data
41
41
/// should be ignored to avoid any potential compatibility issues.
42
- #[ derive( Eq , PartialEq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
42
+ #[ derive( Clone , Eq , PartialEq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
43
43
pub struct ContractResult < R , Balance , EventRecord > {
44
44
/// How much weight was consumed during execution.
45
45
pub gas_consumed : Weight ,
@@ -99,7 +99,7 @@ pub type CodeUploadResult<CodeHash, Balance> =
99
99
pub type GetStorageResult = Result < Option < Vec < u8 > > , ContractAccessError > ;
100
100
101
101
/// The possible errors that can happen querying the storage of a contract.
102
- #[ derive( Eq , PartialEq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
102
+ #[ derive( Copy , Clone , Eq , PartialEq , Encode , Decode , MaxEncodedLen , RuntimeDebug , TypeInfo ) ]
103
103
pub enum ContractAccessError {
104
104
/// The given address doesn't point to a contract.
105
105
DoesntExist ,
@@ -119,7 +119,7 @@ bitflags! {
119
119
}
120
120
121
121
/// Output of a contract call or instantiation which ran to completion.
122
- #[ derive( PartialEq , Eq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
122
+ #[ derive( Clone , PartialEq , Eq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
123
123
pub struct ExecReturnValue {
124
124
/// Flags passed along by `seal_return`. Empty when `seal_return` was never called.
125
125
pub flags : ReturnFlags ,
@@ -135,7 +135,7 @@ impl ExecReturnValue {
135
135
}
136
136
137
137
/// The result of a successful contract instantiation.
138
- #[ derive( PartialEq , Eq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
138
+ #[ derive( Clone , PartialEq , Eq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
139
139
pub struct InstantiateReturnValue < AccountId > {
140
140
/// The output of the called constructor.
141
141
pub result : ExecReturnValue ,
@@ -144,7 +144,7 @@ pub struct InstantiateReturnValue<AccountId> {
144
144
}
145
145
146
146
/// The result of successfully uploading a contract.
147
- #[ derive( PartialEq , Eq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
147
+ #[ derive( Clone , PartialEq , Eq , Encode , Decode , MaxEncodedLen , RuntimeDebug , TypeInfo ) ]
148
148
pub struct CodeUploadReturnValue < CodeHash , Balance > {
149
149
/// The key under which the new code is stored.
150
150
pub code_hash : CodeHash ,
@@ -153,7 +153,7 @@ pub struct CodeUploadReturnValue<CodeHash, Balance> {
153
153
}
154
154
155
155
/// Reference to an existing code hash or a new wasm module.
156
- #[ derive( Eq , PartialEq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
156
+ #[ derive( Clone , Eq , PartialEq , Encode , Decode , RuntimeDebug , TypeInfo ) ]
157
157
pub enum Code < Hash > {
158
158
/// A wasm module as raw bytes.
159
159
Upload ( Vec < u8 > ) ,
@@ -162,7 +162,9 @@ pub enum Code<Hash> {
162
162
}
163
163
164
164
/// The amount of balance that was either charged or refunded in order to pay for storage.
165
- #[ derive( Eq , PartialEq , Ord , PartialOrd , Encode , Decode , RuntimeDebug , Clone , TypeInfo ) ]
165
+ #[ derive(
166
+ Clone , Eq , PartialEq , Ord , PartialOrd , Encode , Decode , MaxEncodedLen , RuntimeDebug , TypeInfo ,
167
+ ) ]
166
168
pub enum StorageDeposit < Balance > {
167
169
/// The transaction reduced storage consumption.
168
170
///
0 commit comments