forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
use snowbridge_core::{inbound::Log, ChannelId}; | ||
use snowbridge_core::inbound::Log; | ||
|
||
use sp_core::{RuntimeDebug, H160, H256}; | ||
use sp_std::prelude::*; | ||
|
@@ -9,20 +9,24 @@ use alloy_primitives::B256; | |
use alloy_sol_types::{sol, SolEvent}; | ||
|
||
sol! { | ||
event OutboundMessageAccepted(bytes32 indexed channel_id, uint64 nonce, bytes32 indexed message_id, bytes payload); | ||
event OutboundMessageAccepted(uint64 indexed nonce, bytes32 indexed message_id, uint32 indexed para_id, bytes32 reward_address, uint128 fee, bytes payload); | ||
} | ||
|
||
/// An inbound message that has had its outer envelope decoded. | ||
#[derive(Clone, RuntimeDebug)] | ||
pub struct Envelope { | ||
/// The address of the outbound queue on Ethereum that emitted this message as an event log | ||
pub gateway: H160, | ||
/// The message Channel | ||
pub channel_id: ChannelId, | ||
/// A nonce for enforcing replay protection and ordering. | ||
pub nonce: u64, | ||
/// An id for tracing the message on its route (has no role in bridge consensus) | ||
pub message_id: H256, | ||
/// Destination ParaId | ||
pub para_id: u32, | ||
/// The reward address | ||
pub reward_address: [u8; 32], | ||
/// Total fee paid on source chain | ||
pub fee: u128, | ||
/// The inner payload generated from the source application. | ||
pub payload: Vec<u8>, | ||
} | ||
|
@@ -41,9 +45,11 @@ impl TryFrom<&Log> for Envelope { | |
|
||
Ok(Self { | ||
gateway: log.address, | ||
channel_id: ChannelId::from(event.channel_id.as_ref()), | ||
nonce: event.nonce, | ||
message_id: H256::from(event.message_id.as_ref()), | ||
reward_address: event.reward_address.clone().into(), | ||
fee: event.fee, | ||
para_id: event.para_id, | ||
payload: event.payload, | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.