Skip to content

fix(stacks-alpha-engine): a one sided HODLMM holding is not "deploy now" - #415

Open
cliqueengagements wants to merge 1 commit into
aibtcdev:mainfrom
cliqueengagements:fix/hodlmm-one-sided-tier
Open

cliqueengagements wants to merge 1 commit into
aibtcdev:mainfrom
cliqueengagements:fix/hodlmm-one-sided-tier

Conversation

@cliqueengagements

Copy link
Copy Markdown
Contributor

A wallet holding one side of a HODLMM pair is tiered deploy_now and given the pool full APY with a daily dollar figure. It should be swap_first, and that figure is not achievable.

The defect

dlmm-core-v-1-1 holds the X asset only at bins at or above the active bin, and Y only at or below it, so both assets are valid together only at the active bin. A deposit funded from one side lands outside it, which is outside the range where fees accrue. The reported income is not received.

Observed on a wallet holding only STX: four pools offered as ready to deploy, at 604%, 366%, 185% and 4.4% APY, each carrying a daily figure.

Second issue in the same branch

The size comes from Math.max(xUsd, yUsd), the larger side. A paired deposit can only be as large as the side that runs out first, so it is bounded by the smaller side, doubled.

Scope

18 insertions, 3 deletions, one branch of one function. No behaviour change for a wallet holding both sides, or holding neither. Most of the addition is the comment recording the bin invariant, so the next reader does not have to rediscover it.

One request on merge

If this is squashed or rebased, please keep the trailer:

Co-Authored-By: microbasilisk <272877828+microbasilisk@users.noreply.github.com>

A squash drops authorship unless the trailer is carried, and asking after the merge is too late to fix.

A wallet holding one side of a HODLMM pair is tiered `deploy_now` and given
the pool's full APY with a daily dollar figure. It should be `swap_first`,
and that figure is not achievable.

`dlmm-core-v-1-1` holds the X asset only at bins at or above the active bin,
and Y only at or below it, so both assets are valid together ONLY at the
active bin. A deposit funded from one side lands outside it, which is outside
the range where fees accrue, so the reported income is not received.

Second issue in the same branch: the size comes from `Math.max(xUsd, yUsd)`,
the larger side. A paired deposit can only be as large as the side that runs
out first, so it is bounded by the smaller side, doubled.

Observed on a wallet holding only STX: four pools offered as ready to deploy,
at 604%, 366%, 185% and 4.4% APY, each carrying a daily figure.

No behaviour change for a wallet holding both sides, or holding neither.

Co-Authored-By: microbasilisk <272877828+microbasilisk@users.noreply.github.com>
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