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
7 changed files
with
101 additions
and
789 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
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,28 +1,26 @@ | ||
// 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_core::{RuntimeDebug, H160}; | ||
use sp_std::prelude::*; | ||
|
||
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, 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, | ||
/// Total fee paid in Ether on Ethereum, should cover all the cost | ||
pub fee: u128, | ||
/// The inner payload generated from the source application. | ||
pub payload: Vec<u8>, | ||
} | ||
|
@@ -41,9 +39,8 @@ 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()), | ||
fee: event.fee, | ||
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
Oops, something went wrong.