gbuiltin_eth_bridge/lib.rs
1// This file is part of Gear.
2
3// Copyright (C) 2024-2025 Gear Technologies Inc.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19#![cfg_attr(not(feature = "std"), no_std)]
20
21extern crate alloc;
22
23use alloc::vec::Vec;
24use gprimitives::{H160, H256, U256};
25use parity_scale_codec::{Decode, Encode};
26use scale_info::TypeInfo;
27
28/// pallet-gear-eth-bridge builtin actor request types.
29#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo)]
30pub enum Request {
31 /// Send an Ethereum message to the specified `destination` address with the given `payload`.
32 #[codec(index = 0)]
33 SendEthMessage { destination: H160, payload: Vec<u8> },
34}
35
36/// pallet-gear-eth-bridge builtin actor response types.
37#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo)]
38pub enum Response {
39 /// Returned when an Ethereum message is successfully enqueued.
40 #[codec(index = 0)]
41 EthMessageQueued {
42 /// System block number when the message was enqueued.
43 block_number: u32,
44 /// Hash of the enqueued message.
45 hash: H256,
46 /// Nonce of the enqueued message.
47 nonce: U256,
48 /// ID of the queue where the message was enqueued.
49 queue_id: u64,
50 },
51}