Skip to content

feat: route h2o trade to hdx subpool#1340

Open
dmoka wants to merge 39 commits intomasterfrom
fix/route-h2o-trade-to-hdx-subpool
Open

feat: route h2o trade to hdx subpool#1340
dmoka wants to merge 39 commits intomasterfrom
fix/route-h2o-trade-to-hdx-subpool

Conversation

@dmoka
Copy link
Contributor

@dmoka dmoka commented Jan 23, 2026

implements #1336

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

Crate versions that have not been updated:

  • hydradx-runtime: v392.0.0

Crate versions that have been updated:

  • runtime-integration-tests: v1.67.0 -> v1.68.0
  • pallet-circuit-breaker: v1.4.0 -> v1.5.0
  • pallet-dca: v1.14.0 -> v1.15.0
  • pallet-liquidation: v2.2.0 -> v2.3.0
  • pallet-omnipool: v5.4.1 -> v5.5.0
  • pallet-omnipool-liquidity-mining: v3.1.0 -> v3.2.0
  • pallet-otc: v2.2.0 -> v2.3.0
  • pallet-otc-settlements: v1.2.0 -> v1.3.0
  • hydradx-adapters: v1.11.0 -> v1.12.0

Runtime version has not been increased.

@enthusiastmartin enthusiastmartin changed the base branch from master to feat/omnipool-fee January 23, 2026 12:04
@dmoka dmoka requested a review from mrq1911 January 23, 2026 14:46
Copy link
Contributor

@martinfridrich martinfridrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have test where we trade H2O for HDX?

Base automatically changed from feat/omnipool-fee to master January 30, 2026 08:38
@dmoka
Copy link
Contributor Author

dmoka commented Jan 30, 2026

Do we have test where we trade H2O for HDX?

good catch, added both integration and unit tests.

We dont do any special handling here, it is a sort of "extra" work as we route from HDX to HDX pool, but the result would be the same we would skip rerouting for such trades. We choose this for code simplicity.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Quick benchmark at commit 29a8757 has been executed successfully.
View results

// Snapshot contains the storage of EVM, AssetRegistry, Timestamp, Omnipool and Tokens pallets
hydra_live_ext(PATH_TO_SNAPSHOT).execute_with(|| {
// Arrange
deposit_hdx_to_protocol_account();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this is here in this PR ?

Comment on lines +1727 to +1728
let hub_reserve_delta = *state_changes.asset.delta_hub_reserve;
state_changes.asset.delta_hub_reserve = BalanceUpdate::Increase(Balance::zero());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one additonal check i would add here

because here - we basically loose the information that the hub reserve actually Increases.

i would ensure that the delta_hub_reserve is actually Increase variant. and fail if not.

Comment on lines +1854 to +1855
let hub_reserve_delta = *state_changes.asset.delta_hub_reserve;
state_changes.asset.delta_hub_reserve = BalanceUpdate::Increase(Balance::zero());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here - ensure that it is increase.


//We need to split in multiple sells to avoid max in ratio error
for _ in 1..=3 {
for _ in 1..=2 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants