Skip to content

feat: Add minOutShares to weETH (DEV-1121) - #223

Merged
lucas-manuel merged 8 commits into
devfrom
DEV-1121-add-minout
Jan 29, 2026
Merged

lucas-manuel merged 8 commits into
devfrom
DEV-1121-add-minout

Conversation

@supercontracts

@supercontracts supercontracts commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced weETH deposits with configurable slippage protection, requiring specification of minimum acceptable shares output.
  • Tests

    • Expanded test suite to validate slippage protection and associated deposit scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@octane-security-app

Copy link
Copy Markdown

Summary by Octane

New Contracts

No new contracts were added.

Updated Contracts

  • MainnetController.sol: A minimum shares output parameter was added to the depositToWeETH function for enhanced control over deposit outcomes.
  • WeETHLib.sol: Added functions to calculate shares for a given amount and set minimum shares on deposits to manage slippage.

🔗 Commit Hash: 7423165

@coderabbitai

coderabbitai Bot commented Jan 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Walkthrough

A new minSharesOut parameter is added to the weETH deposit flow in MainnetController and WeETHLib.deposit to enforce slippage protection. The deposit function now validates that the shares received meet the minimum threshold, reverting with "MC/slippage-too-high" if exceeded. Tests are updated to accommodate the new parameter and validate slippage behavior.

Changes

Cohort / File(s) Summary
Slippage Check Implementation
src/MainnetController.sol, src/libraries/WeETHLib.sol
Added minSharesOut parameter to depositToWeETH and WeETHLib.deposit functions. WeETHLib.deposit now enforces a require check ensuring shares >= minSharesOut for slippage protection. New sharesForAmount view function added to ILiquidityPoolLike interface.
Test Coverage
test/mainnet-fork/weETH.t.sol
Updated all depositToWeETH calls to include minSharesOut parameter (0 or computed value). Added internal helper _getMinSharesOut returning 99% of liquidityPool share amount. Introduced test_depositToWeETH_slippageTooHigh test to validate slippage revert condition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • lucas-manuel

Poem

🐰 A slippage guard hops into view,
weETH shares now checked through and through,
With minSharesOut to protect the way,
No sneaky slips shall come our day! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'feat: Add minOutShares to weETH (DEV-1121)' follows the required format (starts with 'feat:'), is concise and descriptive, accurately reflects the main changes (adding a minOutShares/minSharesOut parameter for slippage control), and includes the JIRA key.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch DEV-1121-add-minout

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • DEV-1121: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jan 28, 2026
@octane-security-app

Copy link
Copy Markdown

Overview

Warnings found: 1                                                                                

🔗 Commit Hash: 7423165
🛡️ Octane Dashboard: All vulnerabilities

@supercontracts supercontracts changed the title [DEV 1121] add minOutShares to weETH feat: Add minOutShares to weETH [DEV 1121] Jan 28, 2026
@supercontracts supercontracts changed the title feat: Add minOutShares to weETH [DEV 1121] feat: Add minOutShares to weETH (DEV 1121) Jan 28, 2026
Comment thread src/libraries/WeETHLib.sol Outdated
function amountForShare(uint256 shareAmount) external view returns (uint256);
function deposit() external;
function requestWithdraw(address receiver,uint256 amount) external returns (uint256 requestId);
function sharesForAmount(uint256 amount) external view returns (uint256);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this

Comment thread test/mainnet-fork/weETH.t.sol Outdated
}

function _getMinSharesOut(uint256 amount) internal view returns (uint256) {
return liquidityPool.sharesForAmount(amount) * 99 / 100;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should define ILiquidityPoolLike in the test file if it has a different interface

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defined a different interface

Comment thread test/mainnet-fork/weETH.t.sol Outdated

vm.prank(relayer);
vm.expectRevert("MC/slippage-too-high");
mainnetController.depositToWeETH(1_000e18, 1_000e18);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try minSharesOut + 1 here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used

Comment thread test/mainnet-fork/weETH.t.sol Outdated
mainnetController.depositToWeETH(1_000e18, 0);
}

function test_depositToWeETH_slippageTooHigh() external {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slippageTooHighBoundary

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

@supercontracts supercontracts changed the title feat: Add minOutShares to weETH (DEV 1121) feat: Add minOutShares to weETH (DEV-1121) Jan 28, 2026
deluca-mike
deluca-mike previously approved these changes Jan 28, 2026
@github-actions

Copy link
Copy Markdown

Coverage after merging DEV-1121-add-minout into dev will be

99.40%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
deploy
   ControllerDeploy.sol100%100%100%100%
   ForeignControllerInit.sol100%100%100%100%
   MainnetControllerInit.sol97.37%93.33%100%100%152, 90
src
   ALMProxy.sol100%100%100%100%
   ALMProxyFreezable.sol100%100%100%100%
   ForeignController.sol94.90%84.62%95.65%97.22%128–129, 129, 129, 316–317, 573
   MainnetController.sol99.18%100%98.36%99.24%593–594
   OTCBuffer.sol100%100%100%100%
   RateLimitHelpers.sol100%100%100%100%
   RateLimits.sol100%100%100%100%
   WEETHModule.sol92.86%75%100%100%26, 38
src/libraries
   AaveLib.sol100%100%100%100%
   ApproveLib.sol100%100%100%100%
   CCTPLib.sol100%100%100%100%
   CurveLib.sol100%100%100%100%
   ERC4626Lib.sol96%75%100%100%108
   LayerZeroLib.sol100%100%100%100%
   PSMLib.sol100%100%100%100%
   UniswapV4Lib.sol99.32%95.65%100%100%282
   WEETHLib.sol100%100%100%100%

@lucas-manuel
lucas-manuel merged commit e8315ca into dev Jan 29, 2026
4 checks passed
@lucas-manuel
lucas-manuel deleted the DEV-1121-add-minout branch January 29, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants