Repository navigation
fix(sbtc-pool-v3): rescale get-share-price so it resolves fee accrual (ajv.3.4, F-11) - #138
Open
unixwhisperer wants to merge 1 commit into
Conversation
… accrual (ajv.3.4) sbtc-pool-v3 mints 1e8 shares per sat but scaled its built-in price by only 1e8, so get-share-price and get-collateral-snapshot.share-price read 1 at launch and ignored any gain short of +100% (F-11 shape, same as the live sbtc-pool-v2). Both now scale by PRICE-PRECISION (1e16): launch reads 1e8, as the header always documented, and a 1-sat fee on a 44,990-sat pool moves it. Share mint/burn math is untouched. stx-pool-v3 has no share-price read-only, so it is unaffected.
|
@unixwhisperer is attempting to deploy a commit to the matt glory's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
What
flashstack-sbtc-pool-v3(undeployed) had the F-11 resolution gap that #123 pinned on the livesbtc-pool-v2. Deposit mints 1e8 shares per sat, butget-share-priceandget-collateral-snapshot.share-pricewere scaled by only 1e8. So they read1at launch, not the documented1e8, ignored any gain short of +100%, and read0below launch value. Matt OK'd the rescale on 2026-10-19, ahead of the §6e testnet run.Change
PRICE-PRECISION= 1e16 (SHARE-PRECISION * 1e8) and uses it in both price expressions, in the canonical file and the drift-checkedcontracts/test/copy.1e8, and a 1-sat fee on a 44,990-sat pool moves the price.VIRTUAL-SHARES/VIRTUAL-ASSETS, deposit, withdraw and flash-loan are untouched.flashstack-stx-pool-v3has no share-price function, so it's unaffected.Tests
tests/sbtc-pool-v3-share-price-resolution.test.ts: launch reads 1e8 on both functions; the price moves on a 1-sat gain; deposit and withdraw amounts are identical to v2's (44,990 sats → 4,499,000,000,000 shares → 44,990 sats back).SHARE-PRECISIONback into either expression turns it red.Docs
FINDINGS_REGISTER F-11 now marks sbtc-pool-v3 as fixed. THREAT_MODEL row 12, CLARITY_AUDIT_V2_POOLS and the TESTNET_STAGING pre-mainnet bullet are updated, so the §6e plan runs against the rescaled source.
Note for #133: this adds 3 tests and 1 file (357 → 360, 40 → 41) and 8 lines to sbtc-pool-v3 (368 → 376, Tier 2 1,159 → 1,167). Whichever of the two merges second needs those figures refreshed.
Closes Flashstack-ajv.3.4.
🤖 Generated with Claude Code