Skip to content

Added min liquidity threshold - #317

Open
Divljo31 wants to merge 1 commit into
masterfrom
feat/min-liquidity
Open

Added min liquidity threshold#317
Divljo31 wants to merge 1 commit into
masterfrom
feat/min-liquidity

Conversation

@Divljo31

@Divljo31 Divljo31 commented May 4, 2026

Copy link
Copy Markdown
Member

Adds a liquidity gate to TradeRouter.getSpotPrice so it returns undefined when assetIn is too thinly capitalized to be meaningfully priced. Depth is measured as maxSinglePoolBalance(assetIn) × spot[assetIn → first reachable reference stable] valued in 18-decimal units, with HOLLAR (222), USDT (10), USDC (21) as the reference set (HOLLAR first). Threshold is 10,000 HOLLAR-equivalent.

The pools with less than 10k hollar value
image

Changes:

  • getSpotPrice rewritten to compute spot, then check depth via new private depthInUsd helper.
  • Spot computation factored into computeSpotPrice so it's reusable from the depth path.
  • assetMetrics helper extracts max balance and decimals across pools in one pass.
  • Test fixtures: added 2↔222 (thick) and 3↔2 (thin) XYK pools; new spec asserts getSpotPrice(3, 222) is suppressed; existing graph/router specs updated for the new edges.

Issue #312

@changeset-bot

changeset-bot Bot commented May 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 22ed352

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@galacticcouncil/sdk-next Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Divljo31
Divljo31 temporarily deployed to upgrade-ui-master May 4, 2026 21:25 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

🧚 Live preview: galacticcouncil/hydration-ui#3789

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.

1 participant