use codec::{Decode, Encode};
use ethabi::Token;
use frame_support::traits::ProcessMessage;
use scale_info::TypeInfo;
use sp_core::H256;
use sp_runtime::RuntimeDebug;
use sp_std::prelude::*;
use super::Pallet;
use snowbridge_core::ChannelId;
pub use snowbridge_outbound_queue_merkle_tree::MerkleProof;
pub type ProcessMessageOriginOf<T> = <Pallet<T> as ProcessMessage>::Origin;
pub const LOG_TARGET: &str = "snowbridge-outbound-queue";
#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)]
pub struct CommittedMessage {
pub channel_id: ChannelId,
#[codec(compact)]
pub nonce: u64,
pub command: u8,
pub params: Vec<u8>,
#[codec(compact)]
pub max_dispatch_gas: u64,
#[codec(compact)]
pub max_fee_per_gas: u128,
#[codec(compact)]
pub reward: u128,
pub id: H256,
}
impl From<CommittedMessage> for Token {
fn from(x: CommittedMessage) -> Token {
Token::Tuple(vec![
Token::FixedBytes(Vec::from(x.channel_id.as_ref())),
Token::Uint(x.nonce.into()),
Token::Uint(x.command.into()),
Token::Bytes(x.params.to_vec()),
Token::Uint(x.max_dispatch_gas.into()),
Token::Uint(x.max_fee_per_gas.into()),
Token::Uint(x.reward.into()),
Token::FixedBytes(Vec::from(x.id.as_ref())),
])
}
}