diff --git a/Cargo.lock b/Cargo.lock index b94ff7c5ef..d23e3270be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1507,6 +1507,7 @@ dependencies = [ "pallet-anchors", "pallet-aura", "pallet-authorship", + "pallet-axelar-router", "pallet-balances", "pallet-base-fee", "pallet-block-rewards", diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index a113cbd6b2..6ab60f38e4 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -83,6 +83,7 @@ orml-xtokens = { workspace = true } pallet-anchors = { workspace = true } pallet-aura = { workspace = true } pallet-authorship = { workspace = true } +pallet-axelar-router = { workspace = true } pallet-balances = { workspace = true } pallet-base-fee = { workspace = true } pallet-block-rewards = { workspace = true } @@ -208,6 +209,7 @@ std = [ "pallet-anchors/std", "pallet-aura/std", "pallet-authorship/std", + "pallet-axelar-router/std", "pallet-balances/std", "pallet-base-fee/std", "pallet-block-rewards/std", @@ -294,6 +296,7 @@ runtime-benchmarks = [ "orml-tokens/runtime-benchmarks", "orml-xtokens/runtime-benchmarks", "pallet-anchors/runtime-benchmarks", + "pallet-axelar-router/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-block-rewards/runtime-benchmarks", "pallet-bridge/runtime-benchmarks", @@ -375,6 +378,7 @@ try-runtime = [ "pallet-anchors/try-runtime", "pallet-aura/try-runtime", "pallet-authorship/try-runtime", + "pallet-axelar-router/try-runtime", "pallet-balances/try-runtime", "pallet-base-fee/try-runtime", "pallet-block-rewards/try-runtime", diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 0d97bad678..57fdacaa1a 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -116,6 +116,7 @@ use runtime_common::{ }, permissions::{IsUnfrozenTrancheInvestor, PoolAdminCheck}, rewards::SingleCurrencyMovement, + routing::{EvmAccountCodeChecker, RouterDispatcher, RouterId}, transfer_filter::{PreLpTransfer, PreNativeTransfer}, xcm::AccountIdToLocation, xcm_transactor, AllowanceDeposit, CurrencyED, @@ -1983,10 +1984,13 @@ impl pallet_ethereum::Config for Runtime { impl pallet_ethereum_transaction::Config for Runtime {} -impl axelar_gateway_precompile::Config for Runtime { +impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureAccountOrRootOr; + type EvmAccountCodeChecker = EvmAccountCodeChecker; + type Middleware = RouterId; + type Receiver = LiquidityPoolsGateway; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type Transactor = EthereumTransaction; } /// Block type as expected by this runtime. @@ -2111,7 +2115,7 @@ construct_runtime!( BaseFee: pallet_base_fee::{Pallet, Call, Config, Storage, Event} = 162, Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 163, EthereumTransaction: pallet_ethereum_transaction::{Pallet, Storage} = 164, - LiquidityPoolsAxelarGateway: axelar_gateway_precompile::{Pallet, Call, Storage, Event} = 165, + AxelarRouter: pallet_axelar_router::{Pallet, Call, Storage, Event} = 165, // Synced pallets across all runtimes - Range: 180-240 // WHY: * integrations like fireblocks will need to know the index in the enum diff --git a/runtime/common/src/evm/precompile.rs b/runtime/common/src/evm/precompile.rs index df6df7617e..99b563f113 100644 --- a/runtime/common/src/evm/precompile.rs +++ b/runtime/common/src/evm/precompile.rs @@ -76,7 +76,7 @@ pub type RuntimePrecompilesAt = ( // Centrifuge specific precompiles: PrecompileAt< AddressU64, - axelar_gateway_precompile::Pallet, + pallet_axelar_router::Pallet, CallableByContract, >, ); diff --git a/runtime/common/src/routing.rs b/runtime/common/src/routing.rs index 9ff357075b..5c31f25f77 100644 --- a/runtime/common/src/routing.rs +++ b/runtime/common/src/routing.rs @@ -21,8 +21,14 @@ pub enum RouterId { Axelar(AxelarId), } +impl From for RouterId { + fn from(axelar_id: AxelarId) -> Self { + RouterId::Axelar(axelar_id) + } +} + impl From for Domain { - fn from(router_id: RouterId) -> Domain { + fn from(router_id: RouterId) -> Self { match router_id { RouterId::Axelar(AxelarId::Evm(chain_id)) => Domain::EVM(chain_id), } @@ -39,7 +45,7 @@ impl RouterSupport for RouterId { } /// This type choose the correct router implementation given a router id -struct RouterDispatcher(PhantomData); +pub struct RouterDispatcher(PhantomData); impl MessageSender for RouterDispatcher where Routers: pallet_axelar_router::Config, @@ -60,7 +66,7 @@ where } } -struct EvmAccountCodeChecker(PhantomData); +pub struct EvmAccountCodeChecker(PhantomData); impl PreConditions<(H160, H256)> for EvmAccountCodeChecker { type Result = bool;