feat: add PendlePTSlisBNBVaultAdapter for slisBNB unstake#70
Draft
Debugger022 wants to merge 3 commits into
Draft
feat: add PendlePTSlisBNBVaultAdapter for slisBNB unstake#70Debugger022 wants to merge 3 commits into
Debugger022 wants to merge 3 commits into
Conversation
Extends PendlePTVaultAdapter with a one-tx withdraw->redeem->Lista unstake entrypoint (requestWithdraw) and a permissionless claimUnstaked that forwards native BNB to the original owner. slisBNB, Lista StakeManager, and unbond period are child immutables; uuid->owner is tracked so funds return to the right user. Base adapter untouched.
- Gate claims on Lista's bot-advanced nextConfirmedRequestUUID, the real on-chain condition, instead of the elapsed unbond period. Add isClaimable() and correct the interface docs, which described a time-based gate that does not exist. - Handle requests the Lista bot claims on the adapter's behalf via claimWithdrawFor: the uuid leaves the adapter's request array and the BNB is pre-delivered, so claimUnstaked now forwards the amount snapshotted at request time rather than reverting and stranding funds. The snapshot avoids overpaying as slisBNB appreciates. - Record each request in a struct keyed by uuid so views read in O(1) without scanning Lista's live array. - Fix the storage gap (49 to 48 slots) to keep the child's reserved
- Exercise the requestWithdraw/claimUnstaked lifecycle against the real deployed Lista StakeManager and Pendle router on a BSC fork, so the adapter's on-chain assumptions are validated, not mocked. - Cover the orphan path where Lista's bot claims via claimWithdrawFor: the request-time BNB snapshot is forwarded to the owner exactly, never recomputed (which would overpay as slisBNB appreciates). - Run at a post-maturity block and reproduce the market registration and bot confirmation through getter-verified storage writes, since those states are unreachable on a fork by normal calls.
|
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.
Description
Adds
PendlePTSlisBNBVaultAdapter, a slisBNB-specialized adapter that inherits the universalPendlePTVaultAdapter— the base adapter is untouched (no re-audit, minimal diff).Problem
A user exiting a matured PT position via
redeemAtMaturityreceives slisBNB (the SY redeem token) and is left holding a liquid-staking token. To get native BNB 1:1 they must separately run Lista's async unstake (requestWithdraw→ wait unbond ~7d →claimWithdraw).Solution
requestWithdraw(pendleMarket, vTokenAmount, minSlisBnbOut)— one-txwithdraw → redeem → unstake. Redeems vTokens → PT 1:1 to slisBNB (to the adapter) → enqueues a Lista withdrawal request. ModifierswhenNotPaused nonReentrant onlyRegisteredMarket atOrAfterMaturity. Recordsuuid → msg.senderso funds return to the right user.claimUnstaked(uuid)— permissionless finalizer;nonReentrantonly (intentionally not pausable so funds are never trapped). Resolves the live Lista index fresh (Lista compacts via swap-pop), follows CEI (clears state before the external call), and forwards native BNB to the recorded owner.getUserUuids,getUnstakeRequest(exposesstartTime/claimableAtfor off-chain countdowns).Design
__gapfor upgrade safety. Initializer inherited from parent.Files
contracts/pendle-pt-fixed-rate-vault/PendlePTSlisBNBVaultAdapter.sol(new)contracts/pendle-pt-fixed-rate-vault/interfaces/IPendlePTSlisBNBVaultAdapter.sol(new)contracts/pendle-pt-fixed-rate-vault/interfaces/IListaStakeManager.sol(Lista interface)Verification
npx hardhat compile— passes.slither .— only informational findings, all consistent with the base adapter's established patterns (intentional balance-deltaunused-return;reentrancy-benignguarded bynonReentrant;UPPER_CASEimmutables).claimUnstakedflagged nothing — CEI +nonReentrant+sendValue-last hold.Tests (fork + mock-Lista full request→claim cycle) to follow in a separate change.
Status
Done
PendlePTSlisBNBVaultAdapter(requestWithdraw+claimUnstaked+ views)IPendlePTSlisBNBVaultAdapternpx hardhat compilepassesslither .reviewed — only informational findingsRemaining