Skip to content

Pro-rata losses to redeemers and remaining LPs#223

Merged
naddison36 merged 2 commits into
nicka/multi-basefrom
nicka/multi-base-loss
May 14, 2026
Merged

Pro-rata losses to redeemers and remaining LPs#223
naddison36 merged 2 commits into
nicka/multi-basefrom
nicka/multi-base-loss

Conversation

@naddison36
Copy link
Copy Markdown
Collaborator

@naddison36 naddison36 commented May 14, 2026

Summary

Improves loss socialization for LP withdrawal requests so queued redeemers and remaining LPs share post-request gains/losses pro-rata.

Key behavior changes:

  • LP redeem requests escrow shares in the ARM instead of burning them at request time.
  • Queued redeem shares remain in totalSupply() until claim.
  • reservedWithdrawLiquidity replaces the legacy asset-side cumulative queue counters.
  • withdrawsQueuedShares / withdrawsClaimedShares now drive FIFO claim gating.
  • claimable() now returns the cumulative claimable share frontier.
  • WithdrawalRequest.queued is now cumulative queued shares.
  • Claim payout remains capped at min(request.assets, convertToAssets(request.shares)).

Changes

  • Reworked AbstractARM withdrawal queue accounting around live reserved liquidity and share-denominated queue progress.
  • Updated totalAssets() / _availableAssets() to report gross economic assets instead of subtracting LP withdrawal obligations.
  • Updated allocation, reserve, swap-liquidity, and deposit solvency checks to read reservedWithdrawLiquidity.
  • Added migrateLegacyWithdrawQueue() to clear the reused legacy packed queue slot during upgrade, requiring no outstanding legacy queued withdrawals.
  • Updated unit, fork, smoke, and invariant tests for escrowed shares, gross assets, share queue counters, and reservation accounting.

Testing

  • forge fmt
  • forge build
  • git diff --check
  • forge test --match-path 'test/unit/OriginARM/*.sol'
  • forge test --match-path 'test/fork/**/*.sol'
  • forge test --match-path 'test/invariants/**/*.sol'
  • forge test --match-path 'test/smoke/*.sol'

@naddison36 naddison36 marked this pull request as ready for review May 14, 2026 06:31
@naddison36 naddison36 merged commit 772de07 into nicka/multi-base May 14, 2026
8 checks passed
@naddison36 naddison36 deleted the nicka/multi-base-loss branch May 14, 2026 08:14
naddison36 added a commit that referenced this pull request May 14, 2026
* WIP multi base assets

* - Move reusable multi-base asset config and swap accounting into AbstractARM
- Replace protocol-specific ARM redemption logic with generic asset adapters
- removed legacy max-cap sentinel handling
- Upgrade all ARMs to multi base assets
- Added wstETH to the Lido ARM
- Added weETH to EtherFi ARM

* Updated AI context

* Added wOETH to OETH ARM

* Updated ARM contract dependencies

* Updated Hardhat tasks

* Proxied the adapters

* Lido ARM upgrade checks

* Added Ethena upgrade guard

* Updated migration error

* More cleanup of legacy immutables

* fmt

* Update EtherFi ABI

* Update claimEthenaWithdrawals Hardhat task

* Fixed fork tests

* Fixed smoke tests

* Fix invariant tests

* Updated contract diagrams

* Renamed the ARM adapter-facing methods to requestBaseAssetRedeem and claimBaseAssetRedeem

* Used modifiers on adapters

* Pro-rata losses to redeemers and remaining LPs (#223)

* Pro-rata losses to redeemers and remaining LPs

* Calculate swap fee against cross price rather than par value (#224)
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