Skip to content

Commit

Permalink
Merge pull request #348 from tranchess/dev-terry-flash-helper
Browse files Browse the repository at this point in the history
Update FlashSwapRouterV3Helper
  • Loading branch information
bill-clippy authored Apr 25, 2024
2 parents 512112f + e334b4f commit 4338f51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contracts/swap/FlashSwapRouterV3Helper.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

import "@openzeppelin/contracts/math/SafeMath.sol";

import "./FlashSwapRouterV3.sol";

contract FlashSwapRouterV3Helper {
using SafeMath for uint256;

FlashSwapRouterV3 public immutable flashSwapRouter;

constructor(address flashSwapRouter_) public {
Expand All @@ -24,9 +28,10 @@ contract FlashSwapRouterV3Helper {
address tokenQuote,
uint256 minOutR,
uint256 maxOutR,
uint256 precision,
uint256 inQuote
) external returns (uint256 outR) {
while (minOutR < maxOutR - 1) {
while (minOutR.add(precision) < maxOutR) {
uint256 midOutR = minOutR / 2 + maxOutR / 2;
(bool success, bytes memory data) = address(flashSwapRouter).call(
abi.encodeWithSelector(
Expand Down

0 comments on commit 4338f51

Please sign in to comment.