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

feat: foreign investments #1473

Merged
merged 104 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
e79f3fe
feat: init pallet-foreign-investments
wischli Jul 17, 2023
aa2b6ad
wip: SwapNotificationHandler, ForeignInvestment traits
wischli Jul 17, 2023
79edb72
docs: some comments
wischli Jul 17, 2023
ee609c3
wip: storage updates, hooks
wischli Jul 18, 2023
76d0251
feat: handle invest increase transitions
wischli Jul 19, 2023
0855e0b
feat: handle invest decrease transitions
wischli Jul 19, 2023
339f8a1
feat: handle invest swap order transitions
wischli Jul 19, 2023
1b282f4
feat: handle same currencies, cleanup
wischli Jul 20, 2023
8da787f
feat: add redemption states
wischli Jul 20, 2023
4828d12
feat: handle concurrent swap orders
wischli Jul 26, 2023
7c08913
fix: apply_invest_state_transition + docs improvements
wischli Jul 27, 2023
fb16e0e
feat: redeem transitions (but collecting)
wischli Jul 28, 2023
2cce2aa
feat: redeem storage updates, init more hooks
wischli Aug 10, 2023
8cfa18d
feat: collect, update connectors +
wischli Aug 11, 2023
958a70f
refactor: return amounts of do_collect_{invest, redeem}
wischli Aug 11, 2023
94ff978
refactor: add payout currency to CollectRedeem msg
wischli Aug 11, 2023
72fc5db
wip: add ForeignInvestments to dev runtime
wischli Aug 11, 2023
5dcf3e6
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Aug 11, 2023
69de4bb
wip: collect, hooks, transition events, refactoring
wischli Aug 16, 2023
70c2e9f
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Aug 16, 2023
e5b0110
chore: remove some TODOs
wischli Aug 17, 2023
845c1b5
feat: add FulfilledOrderHook to Orderbook
wischli Aug 17, 2023
2678851
fix: use remaining collectable redemption amount
wischli Aug 17, 2023
48024e3
Revert "fix: use remaining collectable redemption amount"
wischli Aug 17, 2023
0b2fdf7
refactor: remove collect_amount from InnerRedeemState
wischli Aug 17, 2023
d896e00
fix: collect redemption
wischli Aug 17, 2023
f246ea8
refactor: move swap currency check
wischli Aug 17, 2023
cff15fe
feat: epoch executions
wischli Aug 17, 2023
bd85c67
wip: 🧹
wischli Aug 17, 2023
b5fb73c
feat: add cancel invest/redeem order msgs
wischli Aug 18, 2023
8a2640a
feat: add collect_for extrinsics
wischli Aug 18, 2023
c178729
feat: add simple poc stable conversion
wischli Aug 18, 2023
af301f3
refactor: add safety investing/redeeming checks
wischli Aug 18, 2023
c3b634e
refactor: remove TokenSwaps storage
wischli Aug 18, 2023
d9d0246
feat: add orderbook to altair runtime
wischli Aug 18, 2023
fa31b2a
refactor: cleanup boilerplate files
wischli Aug 18, 2023
b431213
fix: swap direction check
wischli Aug 18, 2023
99789f1
refactor: FI extrinsics
wischli Aug 18, 2023
7342690
feat: improve error handling
wischli Aug 18, 2023
f8351cf
fix: clippy
wischli Aug 18, 2023
6f7abb1
fix: unit tests
wischli Aug 18, 2023
6d5351e
fix: compile runtime integrations
wischli Aug 18, 2023
fb0437c
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Aug 18, 2023
d1d50be
refactor: fix simple currency conversion
wischli Aug 20, 2023
04748a9
docs: add errors
wischli Aug 20, 2023
92c2b2f
tests: fix decrease_invest same currencies
wischli Aug 21, 2023
50ee08c
Delete swap_delta.md
wischli Aug 21, 2023
f226e64
refactor: return currency -> foreign currency
wischli Aug 21, 2023
3dc5100
fix: integration tests
wischli Aug 22, 2023
ec7259d
fix: treasury should pay Executed* msg tx fees
wischli Aug 22, 2023
94d3149
feat: add non-foreign cancel_invest_order
wischli Aug 23, 2023
7caecc1
refactor: remove liquidity pools clutter
wischli Aug 23, 2023
3606df9
wip: split up liquidity pools tests
wischli Aug 23, 2023
a3effb8
tests: fix split imports
wischli Aug 23, 2023
96b5fbd
tests: add decrease underflow, require collect
wischli Aug 24, 2023
9d3d041
feat: impl requires_collect
wischli Aug 24, 2023
7a18f6e
wip: redemption currency checks, payment/payout checks
wischli Aug 24, 2023
bdf467c
wip
wischli Aug 24, 2023
4237130
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Aug 24, 2023
a99ccad
feat: add order pair existence check
wischli Aug 24, 2023
660b1a8
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Aug 25, 2023
f5dd6f3
wip: attempt to fix altair compilation
wischli Aug 25, 2023
d242cd5
fix: make altair compilable
wischli Aug 25, 2023
2beb562
feat: collect hooks
wischli Aug 25, 2023
89841d4
feat: implicitly collect on swap fulfillment
wischli Aug 25, 2023
033e2d9
fix: collect
wischli Aug 26, 2023
a4edd16
fix: order-book benchmarks
wischli Aug 26, 2023
1cbf215
wip: improvements, fixes
wischli Aug 29, 2023
4abe81c
wip: apply correct amount conversion to InvestState
wischli Aug 29, 2023
4b136a9
fix: invest token denominations mismatching currencies
wischli Aug 29, 2023
a309737
fix: apply foreign denominations to collect redeem, handle swap orders
wischli Aug 29, 2023
3101386
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Aug 29, 2023
a69338f
refactor: rm CollectableRedemption states
wischli Aug 29, 2023
ac55c51
fix: clippy
wischli Aug 29, 2023
d46a363
fix: increment redeeming amount
wischli Aug 29, 2023
653e4b8
wip: complex collect flows
wischli Aug 30, 2023
578103e
fix: inc invest for ActiveSwapIntoForeignCurrency
wischli Aug 31, 2023
ff07d88
fix: domain based evm account conversion
wischli Aug 31, 2023
f9094d9
fix: rm domain account conversion for receiver
wischli Sep 1, 2023
ebf4552
tests: fix existing integration foreign inv
wischli Sep 1, 2023
04e787c
tests: extend checks for existing
wischli Sep 1, 2023
4674b2d
refactor: simplify redeem states
wischli Sep 4, 2023
abab7d1
feat: update messages
wischli Sep 6, 2023
be60d64
feat: add remaining amounts to Executed* msgs
wischli Sep 7, 2023
f7ef147
fix: rm remaining from CollectedAmount
wischli Sep 7, 2023
87cdb1a
refactor: use Tokens in FI int tests
wischli Sep 8, 2023
b10fe79
fix: concurrent swaps, misc
wischli Sep 12, 2023
92bc877
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Sep 12, 2023
c203b4f
feat: add orderbook + fi to cfg runtime
wischli Sep 12, 2023
c91f17d
tests: fix LP messages
wischli Sep 12, 2023
5d4de16
fix: integration tests
wischli Sep 12, 2023
d09ca6d
docs: add missing
wischli Sep 12, 2023
53039e5
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Sep 13, 2023
453a111
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Sep 13, 2023
5b1ca4a
refactor: apply suggestions from code review
wischli Sep 13, 2023
0434402
refactor: more explicit currency converter
wischli Sep 13, 2023
d28fd0d
fix: implicit collect on swap fulfillment
wischli Sep 14, 2023
28e1146
refactor: improvements
wischli Sep 15, 2023
65c285b
feat: stump queue altair, centrifuge; inbound queue algol
wischli Sep 15, 2023
ffea07f
refactor: stricter fulfill invest swap order
wischli Sep 15, 2023
1da1c19
Merge remote-tracking branch 'origin/main' into feat/wf-foreign-inves…
wischli Sep 15, 2023
1818981
refactor: apply AllowInvestmentCurrency
wischli Sep 15, 2023
0402327
chore: bump dev spec_version
wischli Sep 15, 2023
b4877bb
chore: bump altair spec version to 1034
wischli Sep 15, 2023
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
24 changes: 24 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ members = [
"pallets/crowdloan-reward",
"pallets/ethereum-transaction",
"pallets/fees",
"pallets/foreign-investments",
"pallets/interest-accrual",
"pallets/investments",
"pallets/keystore",
Expand Down
4 changes: 2 additions & 2 deletions libs/test-utils/src/mocks/accountant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ macro_rules! impl_mock_accountant {
pub payment_currency: $currency_id,
}

impl<Tokens> cfg_traits::InvestmentAccountant<$account_id> for $name<Tokens>
impl<Tokens> cfg_traits::investments::InvestmentAccountant<$account_id> for $name<Tokens>
where
Tokens: frame_support::traits::tokens::fungibles::Mutate<$account_id>
+ frame_support::traits::tokens::fungibles::Transfer<$account_id>
Expand Down Expand Up @@ -166,7 +166,7 @@ macro_rules! impl_mock_accountant {
}
}

impl cfg_traits::InvestmentProperties<$account_id> for InvestmentInfo {
impl cfg_traits::investments::InvestmentProperties<$account_id> for InvestmentInfo {
type Currency = $currency_id;
type Id = $investment_id;

Expand Down
16 changes: 15 additions & 1 deletion libs/test-utils/src/mocks/order_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use pallet::*;

#[frame_support::pallet]
pub mod pallet {
use cfg_traits::{
use cfg_traits::investments::{
Investment, InvestmentAccountant, InvestmentProperties, OrderManager, TrancheCurrency,
};
use cfg_types::orders::{FulfillmentWithPrice, TotalOrder};
Expand Down Expand Up @@ -277,6 +277,20 @@ pub mod pallet {
.unwrap_or_default()
.amount)
}

fn investment_requires_collect(
_investor: &T::AccountId,
_investment_id: Self::InvestmentId,
) -> bool {
unimplemented!("not needed here, could also default to false")
}

fn redemption_requires_collect(
_investor: &T::AccountId,
_investment_id: Self::InvestmentId,
) -> bool {
unimplemented!("not needed here, could also default to false")
}
}

impl<T: Config> OrderManager for Pallet<T>
Expand Down
Loading