Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for bidirectional routers #1958

Merged
merged 23 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 28 additions & 62 deletions Cargo.lock

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

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"libs/utils",
"pallets/anchors",
"pallets/anchors-v2",
"pallets/axelar-router",
"pallets/bridge",
"pallets/block-rewards",
"pallets/collator-allowlist",
Expand All @@ -21,8 +22,6 @@ members = [
"pallets/keystore",
"pallets/liquidity-pools",
"pallets/liquidity-pools-gateway",
"pallets/liquidity-pools-gateway/axelar-gateway-precompile",
"pallets/liquidity-pools-gateway/routers",
"pallets/liquidity-pools-gateway/queue",
"pallets/liquidity-rewards",
"pallets/loans",
Expand Down Expand Up @@ -221,10 +220,9 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", b
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }

# Centrifuge pallets
axelar-gateway-precompile = { path = "pallets/liquidity-pools-gateway/axelar-gateway-precompile", default-features = false }
liquidity-pools-gateway-routers = { path = "pallets/liquidity-pools-gateway/routers", default-features = false }
pallet-anchors = { path = "pallets/anchors", default-features = false }
pallet-anchors-v2 = { path = "pallets/anchors-v2", default-features = false }
pallet-axelar-router = { path = "pallets/axelar-router", default-features = false }
pallet-block-rewards = { path = "pallets/block-rewards", default-features = false }
pallet-bridge = { path = "pallets/bridge", default-features = false }
pallet-collator-allowlist = { path = "pallets/collator-allowlist", default-features = false }
Expand Down
37 changes: 37 additions & 0 deletions libs/mocks/src/ethereum_transactor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use cfg_traits::ethereum::EthereumTransactor;
use frame_support::pallet_prelude::*;
use mock_builder::{execute_call, register_call};
use sp_core::{H160, U256};

#[pallet::config]
pub trait Config: frame_system::Config {}

#[pallet::pallet]
pub struct Pallet<T>(_);

#[pallet::storage]
type CallIds<T: Config> = StorageMap<_, _, String, mock_builder::CallId>;

impl<T: Config> Pallet<T> {
pub fn mock_call(
func: impl Fn(H160, H160, &[u8], U256, U256, U256) -> DispatchResultWithPostInfo + 'static,
) {
register_call!(move |(a, b, c, d, e, f)| func(a, b, c, d, e, f));
}
}

impl<T: Config> EthereumTransactor for Pallet<T> {
fn call(
a: H160,
b: H160,
c: &[u8],
d: U256,
e: U256,
f: U256,
) -> DispatchResultWithPostInfo {
execute_call!((a, b, c, d, e, f))
}
}
}
4 changes: 2 additions & 2 deletions libs/mocks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ pub mod change_guard;
pub mod converter;
pub mod currency_conversion;
pub mod data;
pub mod ethereum_transactor;
pub mod fees;
pub mod foreign_investment;
pub mod foreign_investment_hooks;
pub mod investment;
pub mod liquidity_pools;
pub mod liquidity_pools_gateway;
pub mod liquidity_pools_gateway_queue;
pub mod liquidity_pools_gateway_routers;
pub mod pay_fee;
pub mod permissions;
pub mod pools;
pub mod pre_conditions;
pub mod rewards;
pub mod router_message;
pub mod status_notification;
pub mod time;
pub mod token_swaps;
Expand All @@ -30,7 +31,6 @@ pub use investment::pallet as pallet_mock_investment;
pub use liquidity_pools::pallet as pallet_mock_liquidity_pools;
pub use liquidity_pools_gateway::pallet as pallet_mock_liquidity_pools_gateway;
pub use liquidity_pools_gateway_queue::pallet as pallet_mock_liquidity_pools_gateway_queue;
pub use liquidity_pools_gateway_routers::{pallet as pallet_mock_routers, RouterMock};
pub use pay_fee::pallet as pallet_mock_pay_fee;
pub use permissions::pallet as pallet_mock_permissions;
pub use pools::pallet as pallet_mock_pools;
Expand Down
Loading
Loading