Skip to content

Commit

Permalink
base swap callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOsiris committed Sep 20, 2023
1 parent c18fd0a commit 308ba1d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ optimizer = true
optimizer_runs = 200



2 changes: 0 additions & 2 deletions src/ConveyorRouterV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {SafeERC20} from "../lib/libraries/token/SafeERC20.sol";
import {ConveyorMath} from "./lib/ConveyorMath.sol";
import {ConveyorSwapCallbacks} from "./callbacks/ConveyorSwapCallbacks.sol";
import {IConveyorRouterV1} from "./interfaces/IConveyorRouterV1.sol";
import "../test/utils/Console.sol";

interface IConveyorMulticall {
function executeMulticall(ConveyorRouterV1.SwapAggregatorMulticall calldata multicall) external;
Expand Down Expand Up @@ -129,7 +128,6 @@ contract ConveyorRouterV1 is IConveyorRouterV1 {
IConveyorMulticall(CONVEYOR_MULTICALL).executeMulticall(genericMulticall);

uint256 balanceAfter = IERC20(swapData.tokenOut).balanceOf(msg.sender);
console.log("balanceAfter", balanceAfter);
///@notice Check if tokenOut balance of msg.sender is sufficient.
if (balanceAfter < tokenOutAmountRequired) {
revert InsufficientOutputAmount(tokenOutAmountRequired - balanceAfter, swapData.amountOutMin);
Expand Down
14 changes: 2 additions & 12 deletions src/callbacks/ConveyorSwapCallbacks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,14 @@ import {PancakeV2Callback} from "./PancakeV2Callback.sol";
import {PancakeV3Callback} from "./PancakeV3Callback.sol";
import {UniswapV2Callback} from "./UniswapV2Callback.sol";
import {UniswapV3Callback} from "./UniswapV3Callback.sol";
import {ConvergenceXCallback} from "./ConvergenceXCallback.sol";
import {UniFiCallback} from "./UniFiCallback.sol";
import {VerseCallback} from "./VerseCallback.sol";
import {ApeSwapCallback} from "./ApeSwapCallback.sol";
import {LinkSwapCallback} from "./LinkSwapCallback.sol";
import {SakeSwapCallback} from "./SakeSwapCallback.sol";
import {DefiSwapCallback} from "./DefiSwapCallback.sol";
import {AlgebraCallback} from "./AlgebraCallback.sol";

contract ConveyorSwapCallbacks is
PancakeV2Callback,
PancakeV3Callback,
UniswapV2Callback,
UniswapV3Callback,
ConvergenceXCallback,
UniFiCallback,
VerseCallback,
ApeSwapCallback,
LinkSwapCallback,
SakeSwapCallback,
DefiSwapCallback
AlgebraCallback
{}
2 changes: 1 addition & 1 deletion src/callbacks/UniswapV3Callback.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract UniswapV3Callback {
///@param data - The data packed into the swap.
function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {
assembly {
let tokenIn :=calldataload(data.offset)
let tokenIn := calldataload(data.offset)
// Start at fmp
let freeMemoryPointer := mload(0x40)
let token := calldataload(data.offset)
Expand Down

0 comments on commit 308ba1d

Please sign in to comment.