@@ -30,6 +30,7 @@ use num_traits::Zero;
30
30
31
31
use super :: Transaction ;
32
32
33
+ /// Represents a Deploy Transaction in the starknet network
33
34
#[ derive( Debug , Clone ) ]
34
35
pub struct Deploy {
35
36
pub hash_value : Felt252 ,
@@ -116,6 +117,7 @@ impl Deploy {
116
117
} )
117
118
}
118
119
120
+ /// Returns the class hash of the deployed contract
119
121
pub fn class_hash ( & self ) -> ClassHash {
120
122
self . contract_hash
121
123
}
@@ -133,7 +135,10 @@ impl Deploy {
133
135
CompiledClass :: Casm ( class) => Ok ( class. entry_points_by_type . constructor . is_empty ( ) ) ,
134
136
}
135
137
}
136
-
138
+ /// Deploys the contract in the starknet network and calls its constructor if it has one.
139
+ /// ## Parameters
140
+ /// - state: A state that implements the [`State`] and [`StateReader`] traits.
141
+ /// - block_context: The block's execution context.
137
142
pub fn apply < S : State + StateReader > (
138
143
& self ,
139
144
state : & mut S ,
@@ -150,6 +155,9 @@ impl Deploy {
150
155
self . invoke_constructor ( state, block_context)
151
156
}
152
157
}
158
+ /// Executes the contract without constructor
159
+ /// ## Parameters
160
+ /// - state: A state that implements the [`State`] and [`StateReader`] traits.
153
161
154
162
pub fn handle_empty_constructor < S : State + StateReader > (
155
163
& self ,
@@ -185,6 +193,10 @@ impl Deploy {
185
193
) )
186
194
}
187
195
196
+ /// Execute the contract using its constructor
197
+ /// ## Parameters
198
+ /// - state: A state that implements the [`State`] and [`StateReader`] traits.
199
+ /// - block_context: The block's execution context.
188
200
pub fn invoke_constructor < S : State + StateReader > (
189
201
& self ,
190
202
state : & mut S ,
@@ -239,6 +251,9 @@ impl Deploy {
239
251
240
252
/// Calculates actual fee used by the transaction using the execution
241
253
/// info returned by apply(), then updates the transaction execution info with the data of the fee.
254
+ /// ## Parameters
255
+ /// - state: A state that implements the [`State`] and [`StateReader`] traits.
256
+ /// - block_context: The block's execution context.
242
257
pub fn execute < S : State + StateReader > (
243
258
& self ,
244
259
state : & mut S ,
@@ -254,6 +269,8 @@ impl Deploy {
254
269
// ---------------
255
270
// Simulation
256
271
// ---------------
272
+
273
+ /// Creates a Deploy transaction for simulate a deploy
257
274
pub ( crate ) fn create_for_simulation (
258
275
& self ,
259
276
skip_validate : bool ,
0 commit comments