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

WIP: Liquidity Pools v2 #1909

Merged
merged 24 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e95db39
feat: LPv2 message reorder (#1892)
wischli Jul 12, 2024
426ae56
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Jul 12, 2024
fec46b1
ignore failing tests (#1910)
lemunozm Jul 15, 2024
5f0f06a
LPv2: ForeignInvestments changes (#1895)
lemunozm Jul 15, 2024
8066e95
fix clippy
lemunozm Jul 16, 2024
dd9f57d
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Jul 16, 2024
6f46ba2
fix tests after merge
lemunozm Jul 16, 2024
ceda10d
fix foreign investment tests (#1918)
lemunozm Jul 17, 2024
103b27e
ignore failing tests (#1919)
lemunozm Jul 17, 2024
63d7f05
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Jul 17, 2024
e7eb61c
fix previous merge
lemunozm Jul 18, 2024
976eebe
LP v2: fix integration tests (#1915)
wischli Jul 18, 2024
69af655
LPv2: Batch Message serialization (#1920)
lemunozm Jul 22, 2024
25bfde7
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Jul 24, 2024
020cf59
feat: add domain hook storage (#1928)
wischli Jul 25, 2024
ecd8821
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Jul 29, 2024
5a63633
fix cargo fmt
lemunozm Jul 29, 2024
81d193b
Feat/lp v2 gateway queue (#1930)
cdamian Jul 30, 2024
d2118cb
lp-v2: fix message fields (#1933)
wischli Jul 31, 2024
a38c4f9
refactor: cleanup my leftovers (#1935)
wischli Jul 31, 2024
a76c15f
LPv2: Bump-up foreign investment. Fix failing investment ITs (#1934)
lemunozm Aug 1, 2024
02a4af3
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Aug 1, 2024
e9a47a5
Merge remote-tracking branch 'origin/main' into feat/lp-v2
lemunozm Aug 1, 2024
0764a1d
chore: bump spec version to v0.14.0
wischli Aug 1, 2024
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
54 changes: 30 additions & 24 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ members = [
"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",
"pallets/oracle-feed",
Expand All @@ -35,7 +36,6 @@ members = [
"pallets/restricted-tokens",
"pallets/restricted-xtokens",
"pallets/rewards",
"pallets/swaps",
"pallets/token-mux",
"pallets/transfer-allowlist",
"runtime/altair",
Expand All @@ -53,7 +53,7 @@ license = "LGPL-3.0"
homepage = "https://centrifuge.io/"
repository = "https://github.com/centrifuge/centrifuge-chain"
documentation = "https://reference.centrifuge.io/centrifuge_chain/index.html"
version = "0.13.0"
version = "0.14.0"

[workspace.dependencies]
hex-literal = { version = "0.4.1" }
Expand Down Expand Up @@ -237,6 +237,7 @@ pallet-investments = { path = "pallets/investments", default-features = false }
pallet-keystore = { path = "pallets/keystore", default-features = false }
pallet-liquidity-pools = { path = "pallets/liquidity-pools", default-features = false }
pallet-liquidity-pools-gateway = { path = "pallets/liquidity-pools-gateway", default-features = false }
pallet-liquidity-pools-gateway-queue = { path = "pallets/liquidity-pools-gateway/queue", default-features = false }
pallet-liquidity-rewards = { path = "pallets/liquidity-rewards", default-features = false }
pallet-loans = { path = "pallets/loans", default-features = false }
pallet-oracle-feed = { path = "pallets/oracle-feed", default-features = false }
Expand All @@ -249,7 +250,6 @@ pallet-pool-system = { path = "pallets/pool-system", default-features = false }
pallet-restricted-tokens = { path = "pallets/restricted-tokens", default-features = false }
pallet-restricted-xtokens = { path = "pallets/restricted-xtokens", default-features = false }
pallet-rewards = { path = "pallets/rewards", default-features = false }
pallet-swaps = { path = "pallets/swaps", default-features = false }
pallet-token-mux = { path = "pallets/token-mux", default-features = false }
pallet-transfer-allowlist = { path = "pallets/transfer-allowlist", default-features = false }

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ On top of the [Substrate FRAME](https://docs.substrate.io/reference/frame-pallet
- [**liquidity-pools**](https://github.com/centrifuge/centrifuge-chain/tree/main/pallets/liquidity-pools) ([docs](https://reference.centrifuge.io/pallet_liquidity_pools/index.html)): Provides the toolset to enable foreign investments on foreign domains.

- [**liquidity-pools-gateway**](https://github.com/centrifuge/centrifuge-chain/tree/main/pallets/liquidity-pools-gateway) ([docs](https://reference.centrifuge.io/pallet_liquidity_pools_gateway/index.html)): The main handler of incoming and outgoing Liquidity Pools messages.
-
- [**liquidity-pools-gateway-queue**](https://github.com/centrifuge/centrifuge-chain/tree/main/pallets/liquidity-pools-gateway/queue) ([docs](https://reference.centrifuge.io/pallet_liquidity_pools_gateway_queue/index.html)): The queue used by the Liquidity Pools Gateway for processing inbound/outbound messages.

- [**liquidity-pools-gateway-routers**](https://github.com/centrifuge/centrifuge-chain/tree/main/pallets/liquidity-pools-gateway/routers) ([docs](https://reference.centrifuge.io/liquidity_pools_gateway_routers/index.html)): This crate contains the `DomainRouters` used by the Liquidity Pools Gateway pallet.

Expand Down
80 changes: 10 additions & 70 deletions libs/mocks/src/foreign_investment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ pub mod pallet {
register_call!(move |(a, b, c, d)| f(a, b, c, d));
}

pub fn mock_decrease_foreign_investment(
f: impl Fn(&T::AccountId, T::InvestmentId, T::Amount, T::CurrencyId) -> DispatchResult
+ 'static,
pub fn mock_cancel_foreign_investment(
f: impl Fn(&T::AccountId, T::InvestmentId, T::CurrencyId) -> DispatchResult + 'static,
) {
register_call!(move |(a, b, c, d)| f(a, b, c, d));
register_call!(move |(a, b, c)| f(a, b, c));
}

pub fn mock_increase_foreign_redemption(
Expand All @@ -45,48 +44,21 @@ pub mod pallet {
register_call!(move |(a, b, c, d)| f(a, b, c, d));
}

pub fn mock_decrease_foreign_redemption(
pub fn mock_cancel_foreign_redemption(
f: impl Fn(
&T::AccountId,
T::InvestmentId,
T::TrancheAmount,
T::CurrencyId,
) -> DispatchResult
) -> Result<T::TrancheAmount, DispatchError>
+ 'static,
) {
register_call!(move |(a, b, c, d)| f(a, b, c, d));
}

pub fn mock_collect_foreign_investment(
f: impl Fn(&T::AccountId, T::InvestmentId, T::CurrencyId) -> DispatchResult + 'static,
) {
register_call!(move |(a, b, c)| f(a, b, c));
}

pub fn mock_collect_foreign_redemption(
f: impl Fn(&T::AccountId, T::InvestmentId, T::CurrencyId) -> DispatchResult + 'static,
) {
register_call!(move |(a, b, c)| f(a, b, c));
}

pub fn mock_investment(
f: impl Fn(&T::AccountId, T::InvestmentId) -> Result<T::Amount, DispatchError> + 'static,
) {
register_call!(move |(a, b)| f(a, b));
}

pub fn mock_redemption(
f: impl Fn(&T::AccountId, T::InvestmentId) -> Result<T::TrancheAmount, DispatchError>
+ 'static,
) {
register_call!(move |(a, b)| f(a, b));
}
}

impl<T: Config> ForeignInvestment<T::AccountId> for Pallet<T> {
type Amount = T::Amount;
type CurrencyId = T::CurrencyId;
type Error = DispatchError;
type InvestmentId = T::InvestmentId;
type TrancheAmount = T::TrancheAmount;

Expand All @@ -99,13 +71,12 @@ pub mod pallet {
execute_call!((a, b, c, d))
}

fn decrease_foreign_investment(
fn cancel_foreign_investment(
a: &T::AccountId,
b: Self::InvestmentId,
c: Self::Amount,
d: Self::CurrencyId,
c: Self::CurrencyId,
) -> DispatchResult {
execute_call!((a, b, c, d))
execute_call!((a, b, c))
}

fn increase_foreign_redemption(
Expand All @@ -117,43 +88,12 @@ pub mod pallet {
execute_call!((a, b, c, d))
}

fn decrease_foreign_redemption(
a: &T::AccountId,
b: Self::InvestmentId,
c: Self::TrancheAmount,
d: Self::CurrencyId,
) -> DispatchResult {
execute_call!((a, b, c, d))
}

fn collect_foreign_investment(
a: &T::AccountId,
b: Self::InvestmentId,
c: Self::CurrencyId,
) -> DispatchResult {
execute_call!((a, b, c))
}

fn collect_foreign_redemption(
fn cancel_foreign_redemption(
a: &T::AccountId,
b: Self::InvestmentId,
c: Self::CurrencyId,
) -> DispatchResult {
) -> Result<T::TrancheAmount, DispatchError> {
execute_call!((a, b, c))
}

fn investment(
a: &T::AccountId,
b: Self::InvestmentId,
) -> Result<Self::Amount, DispatchError> {
execute_call!((a, b))
}

fn redemption(
a: &T::AccountId,
b: Self::InvestmentId,
) -> Result<Self::TrancheAmount, DispatchError> {
execute_call!((a, b))
}
}
}
Loading
Loading