Skip to content

Commit

Permalink
Add request commitment to pallet-asset-gateway events (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege committed Jun 26, 2024
1 parent 2d6dabf commit e20c893
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions evm/src/modules/TokenGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ contract TokenGateway is BaseIsmpModule {

// User has received some assets
event AssetReceived(
bytes32 commitment, address indexed from, address indexed beneficiary, uint256 amount, bytes32 indexed assetId
bytes32 commitment, bytes32 indexed from, address indexed beneficiary, uint256 amount, bytes32 indexed assetId
);

// User has sent some assets
Expand Down Expand Up @@ -532,7 +532,7 @@ contract TokenGateway is BaseIsmpModule {
emit AssetReceived({
commitment: commitment,
beneficiary: bytes32ToAddress(body.to),
from: bytes32ToAddress(body.from),
from: body.from,
amount: body.amount,
assetId: body.assetId
});
Expand Down Expand Up @@ -563,7 +563,7 @@ contract TokenGateway is BaseIsmpModule {
emit AssetReceived({
commitment: commitment,
beneficiary: bytes32ToAddress(body.to),
from: bytes32ToAddress(body.from),
from: body.from,
amount: body.amount,
assetId: body.assetId
});
Expand Down
5 changes: 4 additions & 1 deletion modules/ismp/pallets/asset-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ pub mod pallet {
amount: <T::Assets as fungibles::Inspect<T::AccountId>>::Balance,
/// Destination chain
dest: StateMachine,
/// Request commitment
commitment: H256,
},

/// An asset has been received and transferred to the beneficiary's account on the
Expand Down Expand Up @@ -253,7 +255,7 @@ where

let metadata =
FeeMetadata { payer: multi_account.substrate_account.clone(), fee: Default::default() };
dispatcher
let commitment = dispatcher
.dispatch_request(DispatchRequest::Post(dispatch_post), metadata)
.map_err(|_| Error::<T>::DispatchPostError)?;

Expand All @@ -262,6 +264,7 @@ where
to: multi_account.evm_account,
dest: multi_account.dest_state_machine,
amount,
commitment,
});

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion parachain/runtimes/gargantua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("gargantua"),
impl_name: create_runtime_str!("gargantua"),
authoring_version: 1,
spec_version: 300,
spec_version: 310,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit e20c893

Please sign in to comment.