Conversation
|
@Xhaka00 is attempting to deploy a commit to the Collins' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Xhaka00 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
collinsezedike
left a comment
There was a problem hiding this comment.
@Xhaka00 thank you for the contribution. Pricing the slippage floor from a fresh on-chain vault-state read at build time, with a safe fallback to an omitted floor when the read fails, correctly addresses the stale-share-price reverts in #817. Two CI items and the template need attention.
Commit Messages fails on two headers over the 72-character limit (75 and 73). The six commits are also split one-per-file (fix(web): refresh vault state for slippage floors (<filename>)); please squash them into a single logical commit with a header within the limit.
Lint & Typecheck fails on prettier --check; run npx prettier --write on VaultPanel.tsx and useVaultState.ts.
The PR body needs the required template. Please read CONTRIBUTING.md, specifically the Submitting Changes section, and fill out the ## Summary and ## Test plan sections.
|
Merge conflict with Pushed merge commit Conflicting file(s) resolved:
The pull request is mergeable again — CI will re-run on the new head. @collinsezedike ready for review and merge when you have a moment. |
collinsezedike
left a comment
There was a problem hiding this comment.
Thank you @Xhaka00 for the update. The slippage-floor computation itself is correct: the input guards, the formula, and the vault-state source all check out.
Two things need addressing. VaultPanel.tsx reverts the risk-disclosure deduplication from #814 (main commit a27675d), reintroducing the local useState and hand-rolled accept logic that the merged useRiskDisclosure hook replaced. That is unrelated to #817 and looks like it came from an out-of-date base. Please rebase on the latest main and drop that change so the deduplication stays in place.
In useVaultActions.ts, a failed vault-state fetch leaves the floor undefined, which the contract treats as zero, so a transient failure of the rate-limited endpoint submits the deposit or withdraw with no slippage protection at all. Since preventing that exposure is the point of #817, please handle the fetch failure rather than proceeding without a floor.
Commit Messages also fails on two headers over 72 characters (75 and 73), and Lint & Typecheck fails on prettier --check for two files. Please reword those commit headers and run npx prettier --write.
1419a6a to
ebe1442
Compare
4c48205 to
794c7fe
Compare
Overview
Deposit/withdraw slippage floors were derived from cached
position.deposited / position.shares(30sstaleTime). After yield accrual that share price lags on-chain vault state, somin_shares_out/min_usdc_outcould be set too high and revert withSlippageExceeded/MinAmountOutNotMet. This change prices floors from a fresh vault-state read (totalAssets/totalShares) at transaction build time inuseVaultActions.Related Issue
Closes #817
Changes
[MODIFY]
apps/web/src/hooks/useVaultState.tsfetchFreshVaultState()for an uncached vault-state API read.computeMinSharesOut/computeMinUsdcOuthelpers using live totals +DEFAULT_SLIPPAGE_BPS.[MODIFY]
apps/web/src/hooks/useVaultActions.tsbuildDeposit/buildWithdraw, when no explicit floor is passed, fetch fresh vault state and compute the slippage floor fromtotalAssets/totalShares.[MODIFY]
apps/web/src/components/dashboard/VaultPanel.tsxuseVaultActions.[MODIFY/ADD] tests for panel deferral, action-hook fresh-state flooring, and helper math.
Verification Results
fetchFreshVaultStatein deposit/withdraw pathundefined; actions ignore position cacheCloses #817