@@ -12,28 +12,28 @@ const CONTRACT_NAME: &str = "crates.io:cw-ibc-core";
12
12
const CONTRACT_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
13
13
14
14
impl < ' a > CwIbcCoreContext < ' a > {
15
- /// The `instantiate` function initializes the contract and sets default values for channel, client,
16
- /// and connection counters, as well as setting the contract owner.
17
- ///
18
- /// Arguments:
19
- ///
20
- /// * `deps`: A mutable reference to the dependencies of the contract, which includes access to the
21
- /// storage, API, and other contracts.
22
- /// * `_env`: _env is an object that represents the current blockchain environment, including
23
- /// information such as the block height, time, and chain ID. It is passed as a parameter to the
24
- /// instantiate function in the CosmWasm smart contract framework.
25
- /// * `info`: MessageInfo is a struct that contains information about the message being executed,
26
- /// such as the sender address, the amount of tokens sent with the message, and the message ID. It is
27
- /// passed as a parameter to the instantiate function in order to set the owner of the contract.
28
- /// * `_msg`: The `_msg` parameter is of type `InstantiateMsg` and represents the message sent by the
29
- /// user to instantiate the contract. It contains any custom data or parameters required for the
30
- /// contract initialization.
31
- ///
32
- /// Returns:
33
- ///
34
- /// A `Result<Response, ContractError>` is being returned. The `Response` contains an attribute
35
- /// "method" with the value "instantiate". If there are no errors, the `Result` will be `Ok`,
36
- /// otherwise it will be `Err(ContractError::Std)`.
15
+ /// The `instantiate` function initializes the contract and sets default values for channel, client,
16
+ /// and connection counters, as well as setting the contract owner.
17
+ ///
18
+ /// Arguments:
19
+ ///
20
+ /// * `deps`: A mutable reference to the dependencies of the contract, which includes access to the
21
+ /// storage, API, and other contracts.
22
+ /// * `_env`: _env is an object that represents the current blockchain environment, including
23
+ /// information such as the block height, time, and chain ID. It is passed as a parameter to the
24
+ /// instantiate function in the CosmWasm smart contract framework.
25
+ /// * `info`: MessageInfo is a struct that contains information about the message being executed,
26
+ /// such as the sender address, the amount of tokens sent with the message, and the message ID. It is
27
+ /// passed as a parameter to the instantiate function in order to set the owner of the contract.
28
+ /// * `_msg`: The `_msg` parameter is of type `InstantiateMsg` and represents the message sent by the
29
+ /// user to instantiate the contract. It contains any custom data or parameters required for the
30
+ /// contract initialization.
31
+ ///
32
+ /// Returns:
33
+ ///
34
+ /// A `Result<Response, ContractError>` is being returned. The `Response` contains an attribute
35
+ /// "method" with the value "instantiate". If there are no errors, the `Result` will be `Ok`,
36
+ /// otherwise it will be `Err(ContractError::Std)`.
37
37
pub fn instantiate (
38
38
& self ,
39
39
deps : DepsMut ,
@@ -53,9 +53,9 @@ impl<'a> CwIbcCoreContext<'a> {
53
53
}
54
54
55
55
/// This function handles the execution of various IBC-related messages in a contract.
56
- ///
56
+ ///
57
57
/// Arguments:
58
- ///
58
+ ///
59
59
/// * `deps`: `deps` is a `DepsMut` object, which provides access to the contract's dependencies
60
60
/// such as storage, querier, and API interfaces. It is used to interact with the blockchain and
61
61
/// other contracts.
@@ -68,9 +68,9 @@ impl<'a> CwIbcCoreContext<'a> {
68
68
/// * `msg`: The `msg` parameter in the `execute` function is of type `CoreExecuteMsg` and
69
69
/// represents the message that the contract should execute. The function matches the type of the
70
70
/// message and calls the appropriate function to handle it.
71
- ///
71
+ ///
72
72
/// Returns:
73
- ///
73
+ ///
74
74
/// a `Result<Response, ContractError>` where `Response` is a struct representing the response to a
75
75
/// contract execution and `ContractError` is an enum representing possible errors that can occur
76
76
/// during contract execution.
@@ -269,19 +269,19 @@ impl<'a> CwIbcCoreContext<'a> {
269
269
270
270
/// This function handles different types of replies based on their ID and executes the
271
271
/// corresponding function.
272
- ///
272
+ ///
273
273
/// Arguments:
274
- ///
274
+ ///
275
275
/// * `deps`: `deps` is a mutable reference to the dependencies of the contract, which includes
276
276
/// access to the storage, API, and other modules. It is of type `DepsMut`.
277
277
/// * `_env`: _env is an object of type `Env` which represents the environment in which the contract
278
278
/// is executing. It contains information such as the current block height, the current time, and
279
279
/// the address of the contract.
280
280
/// * `message`: The `message` parameter is of type `Reply` and contains information about the reply
281
281
/// being processed, including the ID of the reply and any associated data.
282
- ///
282
+ ///
283
283
/// Returns:
284
- ///
284
+ ///
285
285
/// a `Result<Response, ContractError>` where `Response` and `ContractError` are defined types.
286
286
pub fn reply (
287
287
& self ,
@@ -343,16 +343,16 @@ impl<'a> CwIbcCoreContext<'a> {
343
343
}
344
344
345
345
/// This function calculates the fee for a given expected gas amount and gas price.
346
- ///
346
+ ///
347
347
/// Arguments:
348
- ///
348
+ ///
349
349
/// * `expected_gas`: `expected_gas` is an input parameter of type `u64` which represents the
350
350
/// expected amount of gas required to execute a transaction on the blockchain. Gas is a unit of
351
351
/// measurement for the computational effort required to execute a transaction or contract on the
352
352
/// Ethereum network. The higher the gas limit, the more
353
- ///
353
+ ///
354
354
/// Returns:
355
- ///
355
+ ///
356
356
/// The function `calculate_fee` returns a `u128` value, which represents the calculated fee based
357
357
/// on the expected gas and the gas price.
358
358
pub fn calculate_fee ( & self , expected_gas : u64 ) -> u128 {
@@ -362,9 +362,9 @@ impl<'a> CwIbcCoreContext<'a> {
362
362
}
363
363
364
364
/// This function calculates the gas price in Rust programming language.
365
- ///
365
+ ///
366
366
/// Returns:
367
- ///
367
+ ///
368
368
/// an unsigned 128-bit integer, which represents the gas price calculated based on the default gas
369
369
/// numerator and gas adjustment numerator values.
370
370
pub fn gas_price ( & self ) -> u128 {
@@ -376,16 +376,16 @@ impl<'a> CwIbcCoreContext<'a> {
376
376
}
377
377
/// The function updates the balance of each coin in a vector by subtracting a fee and returns the
378
378
/// updated vector.
379
- ///
379
+ ///
380
380
/// Arguments:
381
- ///
381
+ ///
382
382
/// * `coins`: A vector of `Coin` structs representing the current balance of the user. Each `Coin`
383
383
/// struct contains an amount and a denomination.
384
384
/// * `fee`: The `fee` parameter is an unsigned 128-bit integer representing the amount of fee to be
385
385
/// deducted from each coin's balance.
386
- ///
386
+ ///
387
387
/// Returns:
388
- ///
388
+ ///
389
389
/// a `Result` type with a vector of `Coin` objects as the successful result or a `ContractError` if
390
390
/// there is an insufficient balance.
391
391
pub fn update_fee ( & self , coins : Vec < Coin > , fee : u128 ) -> Result < Vec < Coin > , ContractError > {
@@ -407,13 +407,13 @@ impl<'a> CwIbcCoreContext<'a> {
407
407
408
408
/// This function converts a hexadecimal string to a Rust type that implements the Message trait and
409
409
/// can be converted to another type using the TryFrom trait.
410
- ///
410
+ ///
411
411
/// Arguments:
412
- ///
412
+ ///
413
413
/// * `hex_str`: A hexadecimal string that represents the serialized bytes of a protobuf message.
414
- ///
414
+ ///
415
415
/// Returns:
416
- ///
416
+ ///
417
417
/// a `Result` with a generic type `T` which is the converted message from the raw bytes provided in
418
418
/// the `HexString`. If the conversion is successful, it returns an `Ok` variant with the converted
419
419
/// message. If there is an error during the conversion, it returns an `Err` variant with a
@@ -443,13 +443,13 @@ impl<'a> CwIbcCoreContext<'a> {
443
443
444
444
/// The function converts a hexadecimal string to a Signer object and returns an error if the
445
445
/// conversion fails.
446
- ///
446
+ ///
447
447
/// Arguments:
448
- ///
448
+ ///
449
449
/// * `str`: A hexadecimal string representing a signer address.
450
- ///
450
+ ///
451
451
/// Returns:
452
- ///
452
+ ///
453
453
/// This function returns a `Result` containing either a `Signer` or a `ContractError`.
454
454
pub fn to_signer ( str : & HexString ) -> Result < Signer , ContractError > {
455
455
let bytes = str. to_bytes ( ) . map_err ( |e| ContractError :: IbcDecodeError {
0 commit comments