Repository navigation
feat(vault): expose the current maximum redeemable shares - #19
Merged
Kami-no-san merged 1 commit intoOct 18, 2026
Merged
Conversation
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.
Closes #6
Change
Add read-only
max_redeemableandYieldVaultClient.maxRedeemable(): Promise<Amount>, with the wire name exported from shared constants and registered in the existing client method map. The result is a vault-wide share ceiling, not an asset amount or a per-user balance.When liquidity is below accounted assets, the exact inverse of redemption's floor rounding is
ceil((liquidity + 1) * totalShares / totalAssets) - 1. This uses the existing checked arithmetic helpers, avoiding intermediate overflow. Fully funded vaults are capped at total shares; empty, paused or zero-liquidity vaults return zero. Pending simulated yield is included without mutating accrual state.Limits
The bound applies at the current ledger timestamp only. It reserves no liquidity and introduces no guessed delay margin. Callers must also cap by their own shares and allow for time, other transactions and pauses before submission. Existing deployed contracts do not gain the new method automatically.
Verification
pnpm test: 230 passed, including 19 contract and 66 client tests.git diff --check: passed.No live Testnet deployment, wallet or real funds were used. This branch starts from upstream main and does not include the constructor change in draft #13.
Prepared and tested by GitHub Copilot on behalf of rahulatrkm. Independent human review is not claimed. No bounty or payment claim is attached.