fix: allow first-time HODLMM deposit bins#583
Open
macbotmini-eng wants to merge 1 commit into
Open
Conversation
✅ Validation PassedSkill: All checks passed. This submission is ready for review. |
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.
Summary
Fixes the first-time HODLMM deposit path for
bitflow-hodlmm-deposit.The skill documentation says first-time deposits into valid protocol bins are supported, but the live Bitflow user-bin endpoint currently returns HTTP 404 when the wallet has no existing pool bins. That observed response should mean "no existing wallet position yet," not "the pool is unusable," after the separate pool and bin metadata checks pass.
API surface check
Live spec checked: https://bff.bitflowapis.finance/api/app/openapi.json
BFF API1.0.0, OpenAPI3.1.0./api/app/v1/pools/{pool_id}is documented asGet Pool By Id: pool metadata by pool id./api/app/v1/poolsis documented as pool listing/filtering metadata./api/app/v1/users/{user_address}/positions/{pool_id}/binsis documented asGet User Pool Bins: bin information for a specific user and pool, withfresh=truesupport and user-position cache/fallback headers.200and422responses; it does not document404as a pool-existence signal.That split is the behavior this PR codifies: pool validity comes from pool/bin metadata checks, while the user-bin endpoint is wallet-specific position state. A missing user-position row for a wallet with no existing bins is not enough to reject a first-time deposit when the pool metadata and protocol-bin data are valid.
Quote-side cross-check: https://bff.bitflowapis.finance/api/quotes/openapi.json documents
/api/quotes/v1/bins/{pool_id}as pool bin reserves, prices, and liquidity information, which is the protocol-bin side of the same separation.Change
HTTP 404 ... has no pool binsuser-position response as an empty wallet-bin set.Validation
Pre-proof route validation, before the #559 route consumed the funded sBTC:
bun run skills/bitflow-hodlmm-deposit/bitflow-hodlmm-deposit.ts status --wallet SP2G6TM8JCRNK6WSPQE8S86FP2W3A4FEVGZCCCQT8 --pool-id dlmm_1 --amount-x 4300 --amount-y 0success700hasExistingPosition: falsedenywallet sends <= 4300 sBTCCurrent live reruns with the same
4300amount now correctly block on insufficient sBTC because that balance was used by the #559 proof route. The important behavior from this PR remains verified: the specific first-timehas no pool binsAPI response no longer stops planning before pool/bin metadata, token balance, and postcondition checks run.Additional checks:
bitflow-hodlmm-depositwith 0 errors and 0 warnings.bun run scripts/validate-frontmatter.tsbitflow-hodlmm-depositpassed with 0 errors and 0 warningsdca,stacking-delegation, andzest-yield-managergit diff --checkWhy this matters
This is required for composed routes like #559 where the first route proof starts from idle sBTC and creates the wallet's first HODLMM position in an existing pool/bin.