Skip to content

Commit

Permalink
fix: 👕 function order
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Jan 29, 2024
1 parent 5065c5f commit b5b4630
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions contracts/operators/TokenConverterOperator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,6 @@ contract TokenConverterOperator is ExactOutputFlashSwap {
_flashSwap(FlashSwapParams({ amountOut: amountToPay, path: params.path, data: abi.encode(data) }));
}

function _validatePath(bytes calldata path, address expectedPathStart, address expectedPathEnd) internal pure {
address swapStart = path.toAddress(0);
if (swapStart != expectedPathStart) {
revert InvalidSwapStart(expectedPathStart, swapStart);
}

address swapEnd = path.toAddress(path.length - 20);
if (swapEnd != expectedPathEnd) {
revert InvalidSwapEnd(expectedPathEnd, swapEnd);
}
}

function _onMoneyReceived(bytes memory data) internal override returns (IERC20 tokenIn, uint256 maxAmountIn) {
ConversionData memory decoded = abi.decode(data, (ConversionData));

Expand Down Expand Up @@ -195,6 +183,18 @@ contract TokenConverterOperator is ExactOutputFlashSwap {
return tokensReceived;
}

function _validatePath(bytes calldata path, address expectedPathStart, address expectedPathEnd) internal pure {
address swapStart = path.toAddress(0);
if (swapStart != expectedPathStart) {
revert InvalidSwapStart(expectedPathStart, swapStart);
}

address swapEnd = path.toAddress(path.length - 20);
if (swapEnd != expectedPathEnd) {
revert InvalidSwapEnd(expectedPathEnd, swapEnd);
}
}

function _u(int256 value) private pure returns (uint256) {
if (value < 0) {
revert Underflow();
Expand Down

0 comments on commit b5b4630

Please sign in to comment.