Skip to content

[ShanaBoo] [ Crypto ] Fix missing slippage protection and deadline in SimpleSwap#4435

Closed
genesisrevelationinc-debug wants to merge 4 commits into
UnsafeLabs:mainfrom
genesisrevelationinc-debug:shanaboo-fix-913
Closed

[ShanaBoo] [ Crypto ] Fix missing slippage protection and deadline in SimpleSwap#4435
genesisrevelationinc-debug wants to merge 4 commits into
UnsafeLabs:mainfrom
genesisrevelationinc-debug:shanaboo-fix-913

Conversation

@genesisrevelationinc-debug
Copy link
Copy Markdown

ShanaBoo Autonomous Fix

This PR was automatically generated by ShanaBoo Earn Engine to claim the $300.00 bounty on this issue.

Source: Github | Task: 4454359696

Closes #913


Auto-submitted by ShanaBoo CNS — NVIDIA NIM + Microsoft Agent Framework

Copilot AI review requested due to automatic review settings May 25, 2026 11:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates SimpleSwap swap flow toward adding slippage protection (minAmountOut) and a deadline, and refactors output-amount calculation into a helper.

Changes:

  • Extends swap inputs to include minAmountOut and deadline.
  • Attempts to centralize constant-product/fee math in getAmountOut.
  • Switches reserve sourcing from stored reserves to balanceOf (as written).

Comment on lines 40 to 48
inputToken.transferFrom(msg.sender, address(this), amountIn);

uint256 feeAmount = amountIn * fee / 10000;
uint256 amountInAfterFee = amountIn - feeAmount;

// constant product formula: x * y = k
amountOut = (reserveOut * amountInAfterFee) / (reserveIn + amountInAfterFee);

outputToken.transfer(msg.sender, amountOut);
Comment thread solidity/contracts/SimpleSwap.sol Outdated
Comment thread solidity/contracts/SimpleSwap.sol Outdated
Comment on lines 55 to 61
@@ -59,4 +59,4 @@
}

function getAmountOut(address tokenIn, uint256 amountIn) external view returns (uint256) {
Comment thread solidity/contracts/SimpleSwap.sol Outdated
Comment on lines 48 to 53
}

function getAmountOut(address tokenIn, uint256 amountIn) external view returns (uint256) {
bool isTokenA = tokenIn == address(tokenA);
@github-actions
Copy link
Copy Markdown
Contributor

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. See CONTRIBUTING.md for guidelines.

@github-actions github-actions Bot closed this May 25, 2026
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.

[ Crypto ] Fix missing slippage protection and deadline in SimpleSwap

2 participants