Skip to content

Commit

Permalink
Merge pull request #165 from ConveyorLabs/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
0xOsiris authored Sep 21, 2023
2 parents f0d8b72 + 269d4bd commit f677e5f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 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
{}
1 change: 1 addition & 0 deletions src/callbacks/UniswapV3Callback.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +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)
// Start at fmp
let freeMemoryPointer := mload(0x40)
let token := calldataload(data.offset)
Expand Down
20 changes: 20 additions & 0 deletions src/deploy/DeployBaseAggregator.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.21;

import {Script} from "../../lib/forge-std/src/Script.sol";
import {ConveyorRouterV1} from "../ConveyorRouterV1.sol";
import {ICREATE3Factory} from "../../lib/create3-factory/src/ICREATE3Factory.sol";

contract Deploy is Script {
///@dev Base Constructor Constants
address constant WETH = 0x4200000000000000000000000000000000000006;

function run() public returns (address conveyorRouterV1) {
bytes32 salt = bytes32("0x8fbb158");
bytes memory creationCode = abi.encodePacked(type(ConveyorRouterV1).creationCode, abi.encode(WETH));

vm.startBroadcast();
conveyorRouterV1 = ICREATE3Factory(0x93FEC2C00BfE902F733B57c5a6CeeD7CD1384AE1).deploy(salt, creationCode);
vm.stopBroadcast();
}
}

0 comments on commit f677e5f

Please sign in to comment.