Skip to content

Commit

Permalink
Merge pull request #101 from propeller-heads/router/dc/min-amount-check
Browse files Browse the repository at this point in the history
feat: Check min amount out is not zero
  • Loading branch information
dianacarvalho1 authored Mar 5, 2025
2 parents 9eb10e6 + 09208b3 commit 9943831
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 33 deletions.
5 changes: 5 additions & 0 deletions foundry/src/TychoRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ error TychoRouter__AmountInDiffersFromConsumed(
);
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
error TychoRouter__InvalidDataLength();
error TychoRouter__UndefinedMinAmountOut();

contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
IAllowanceTransfer public immutable permit2;
Expand Down Expand Up @@ -243,6 +244,10 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
if (receiver == address(0)) {
revert TychoRouter__AddressZero();
}
if (minAmountOut == 0) {
revert TychoRouter__UndefinedMinAmountOut();
}

// Assume funds are already in the router.
if (wrapEth) {
_wrapETH(amountIn);
Expand Down
Loading

0 comments on commit 9943831

Please sign in to comment.