Skip to content

Commit

Permalink
fix: check deadline/amountOut for no-swap cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Jul 30, 2024
1 parent 4cc42b3 commit 17ccc4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion contracts/rfq/FastBridgeRouterV2.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import {DefaultRouter} from "../router/DefaultRouter.sol";
import {DefaultRouter, DeadlineExceeded, InsufficientOutputAmount} from "../router/DefaultRouter.sol";
import {UniversalTokenLib} from "../router/libs/UniversalToken.sol";
import {ActionLib, LimitedToken} from "../router/libs/Structs.sol";
import {IFastBridge} from "./interfaces/IFastBridge.sol";
Expand Down Expand Up @@ -65,6 +65,14 @@ contract FastBridgeRouterV2 is DefaultRouter, Ownable, IFastBridgeRouter {
(token, amount) = _doSwap(address(this), token, amount, originQuery);
} else {
// Otherwise, pull the token from the user to this contract
// We still need to perform the deadline and amountOut checks
// solhint-disable-next-line not-rely-on-time
if (block.timestamp > originQuery.deadline) {
revert DeadlineExceeded();
}
if (amount < originQuery.minAmountOut) {
revert InsufficientOutputAmount();
}
amount = _pullToken(address(this), token, amount);
}
IFastBridge.BridgeParams memory params = IFastBridge.BridgeParams({
Expand Down

0 comments on commit 17ccc4d

Please sign in to comment.