Acala icon indicating copy to clipboard operation
Acala copied to clipboard

Dex offchain rebalance swap

Open zqhxuyuan opened this issue 2 years ago • 0 comments

closes: https://github.com/AcalaNetwork/Acala/issues/2137

  • set_rebalance_swap_info set 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.
  • offchain worker construct key:CurrencyId-> values:[CurrencyId] from DEX::TradingPairStatuses which 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).
  • [x] add specified aggregated swap path: RebalanceSwapPaths, it's only used by offchain worker, not used by normal aggregated dex swap.
  • [x] integration test for Taiga(KSM,LKSM) + Dex(LKSM, KSM) ~~or 3USD pool: Taiga(AUSD,USDC)+Taiga(USDC,USDT)+Taiga(USDT,AUSD)~~.

zqhxuyuan avatar Jun 20 '22 16:06 zqhxuyuan