Skip to content

Commit

Permalink
feat: pallet-gear-eth-bridge (#4015)
Browse files Browse the repository at this point in the history
  • Loading branch information
breathx authored Aug 6, 2024
1 parent 11be2cb commit e31c409
Show file tree
Hide file tree
Showing 29 changed files with 2,975 additions and 9 deletions.
1 change: 1 addition & 0 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(clippy::unnecessary_cast)]
#![allow(missing_docs)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
Expand Down
84 changes: 84 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ members = [
"examples/waiting-proxy",
"examples/wat",
"galloc",
"gbuiltins/bls381",
"gbuiltins/staking",
"gbuiltins/*",
"gcli",
"gclient",
"gcore",
Expand Down Expand Up @@ -211,6 +210,7 @@ common = { package = "gear-common", path = "common", default-features = false }
core-processor = { package = "gear-core-processor", path = "core-processor", default-features = false }
galloc = { path = "galloc" }
gbuiltin-bls381 = { path = "gbuiltins/bls381", default-features = false }
gbuiltin-eth-bridge = { path = "gbuiltins/eth-bridge", default-features = false }
gbuiltin-staking = { path = "gbuiltins/staking" }
gcore = { path = "gcore" }
gcli = { path = "gcli" }
Expand Down Expand Up @@ -258,6 +258,9 @@ actor-system-error = { path = "utils/actor-system-error" }
calc-stack-height = { path = "utils/calc-stack-height" }
pallet-gear = { path = "pallets/gear", default-features = false }
pallet-gear-debug = { path = "pallets/gear-debug", default-features = false }
pallet-gear-eth-bridge = { path = "pallets/gear-eth-bridge", default-features = false }
pallet-gear-eth-bridge-rpc = { path = "pallets/gear-eth-bridge/rpc", default-features = false }
pallet-gear-eth-bridge-rpc-runtime-api = { path = "pallets/gear-eth-bridge/rpc/runtime-api", default-features = false }
pallet-gear-gas = { path = "pallets/gas", default-features = false }
pallet-gear-messenger = { path = "pallets/gear-messenger", default-features = false }
pallet-gear-payment = { path = "pallets/payment", default-features = false }
Expand Down Expand Up @@ -303,6 +306,7 @@ sandbox-wasmer-types = { package = "wasmer-types", version = "4.3.4" }
sandbox-wasmi = { package = "wasmi", git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext", features = ["virtual_memory"] }

# Substrate deps
binary-merkle-tree = { version = "4.0.0-dev", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0", default-features = false }
frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0", default-features = false }
frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0" }
frame-election-provider-support = { version = "4.0.0-dev", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0", default-features = false }
Expand Down
12 changes: 12 additions & 0 deletions gbuiltins/eth-bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "gbuiltin-eth-bridge"
description = "Entities for working with Gear builtin actor providing `pallet-gear-eth-bridge` interface"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }
gprimitives.workspace = true
38 changes: 38 additions & 0 deletions gbuiltins/eth-bridge/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This file is part of Gear.

// Copyright (C) 2024 Gear Technologies Inc.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![no_std]

extern crate alloc;

use alloc::vec::Vec;
use gprimitives::{H160, H256, U256};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;

#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo)]
pub enum Request {
#[codec(index = 0)]
SendEthMessage { destination: H160, payload: Vec<u8> },
}

#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo)]
pub enum Response {
#[codec(index = 0)]
EthMessageQueued { nonce: U256, hash: H256 },
}
Loading

0 comments on commit e31c409

Please sign in to comment.