Draft
Conversation
xlc
reviewed
Aug 1, 2022
Member
xlc
left a comment
There was a problem hiding this comment.
I am thinking if we want to implement this in aggregated-dex so it can also rebalance pools with stable asset pools.
modules/dex/src/lib.rs
Outdated
| .push(pair.second()); | ||
| }); | ||
| for (currency_id, trading_tokens) in trading_pair_values_map { | ||
| let _ = TradingPairNodes::<T>::try_mutate(currency_id, |maybe_trading_tokens| -> DispatchResult { |
Member
There was a problem hiding this comment.
I don't think you can mutate storages in offchain worker? at least the storages won't be saved. you need to use offchain worker db for that
Contributor
Author
There was a problem hiding this comment.
TradingPairNodes type is CurrencyId->[CurrencyId], I think this datastructure is too complicate for offchain db. Current I'm moving this storage mutate part to on_idle.
Contributor
Author
There was a problem hiding this comment.
remove TradingPairNodes, and direct calculate without on chain storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #2137
set_rebalance_swap_infoset the threshold and supply amount of token. if target swapped amount is less than threshold, no rebalance happened. We're using treasury account to do rebalance swap, so the treasury account should have balance for specified token.CurrencyId-> values:[CurrencyId]fromDEX::TradingPairStatuseswhich help decide the rebalance swap path in the case of pure DEX. i.e. if trading pair has [A,B],[A,C],[B,C], then datastructure is: A-[B,C], B-[C], and (A,B,C) can be rebalance path, the final trading path is Dex(A,B,C) + Dex(C,A).RebalanceSwapPaths, it's only used by offchain worker, not used by normal aggregated dex swap.or 3USD pool: Taiga(AUSD,USDC)+Taiga(USDC,USDT)+Taiga(USDT,AUSD).