ETH Price: $2,619.81 (+6.31%)

Contract

0x6dFCA04DDA768A0F940778c51e2B5c319b471c93
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Process Route Wi...207392592024-09-13 4:18:5931 days ago1726201139IN
0x6dFCA04D...19b471c93
0.00002 ETH0.000155211.06513511
Process Route Wi...207328182024-09-12 6:43:2332 days ago1726123403IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000279011.87095747
Process Route Wi...207327512024-09-12 6:29:5932 days ago1726122599IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000288821.98064926
Process Route Wi...207327432024-09-12 6:28:2332 days ago1726122503IN
0x6dFCA04D...19b471c93
0.00001 ETH0.00031422.15469827
Process Route Wi...207283632024-09-11 15:48:1133 days ago1726069691IN
0x6dFCA04D...19b471c93
0.435807 ETH0.001088466.32726169
Process Route Wi...207267052024-09-11 10:14:3533 days ago1726049675IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000220141.51466476
Process Route Wi...207262832024-09-11 8:49:2333 days ago1726044563IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000226691.52350189
Process Route Wi...207262462024-09-11 8:41:4733 days ago1726044107IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000214351.58585631
Process Route Wi...207262382024-09-11 8:40:1133 days ago1726044011IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000228351.5670337
Process Route Wi...207259902024-09-11 7:50:1133 days ago1726041011IN
0x6dFCA04D...19b471c93
0.00001 ETH0.00022821.56596407
Process Route Wi...207257952024-09-11 7:10:5933 days ago1726038659IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000247271.69685963
Process Route Wi...207256822024-09-11 6:48:1133 days ago1726037291IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000236071.6200251
Process Route Wi...207256672024-09-11 6:45:1133 days ago1726037111IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000218471.50318972
Process Route Wi...207256492024-09-11 6:41:3533 days ago1726036895IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000198831.36804109
Process Route Wi...207256442024-09-11 6:40:3533 days ago1726036835IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000205251.37717548
Process Route Wi...207256342024-09-11 6:38:3533 days ago1726036715IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000216231.48386991
Process Route Wi...207256262024-09-11 6:36:5933 days ago1726036619IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000224451.54435488
Process Route Wi...207256032024-09-11 6:32:2333 days ago1726036343IN
0x6dFCA04D...19b471c93
0.00001 ETH0.000228761.56985065
Process Route Wi...207255752024-09-11 6:26:4733 days ago1726036007IN
0x6dFCA04D...19b471c93
0.0002 ETH0.000228761.573713
Process Route Wi...207255672024-09-11 6:25:1133 days ago1726035911IN
0x6dFCA04D...19b471c93
0.0002 ETH0.000230771.58757982
Process Route Wi...207255412024-09-11 6:19:5933 days ago1726035599IN
0x6dFCA04D...19b471c93
0.0002 ETH0.000230211.58373889
Process Route Wi...207255142024-09-11 6:14:3533 days ago1726035275IN
0x6dFCA04D...19b471c93
0.0003 ETH0.000213551.4641348
Process Route Wi...207255052024-09-11 6:12:4733 days ago1726035167IN
0x6dFCA04D...19b471c93
0.0003 ETH0.000248471.52475594
Process Route Wi...207187552024-09-10 7:34:3534 days ago1725953675IN
0x6dFCA04D...19b471c93
0 ETH0.000636613.98686656
Process Route Wi...207187432024-09-10 7:32:1134 days ago1725953531IN
0x6dFCA04D...19b471c93
0 ETH0.00096063.28234057
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
207392592024-09-13 4:18:5931 days ago1726201139
0x6dFCA04D...19b471c93
0.00002 ETH
207328182024-09-12 6:43:2332 days ago1726123403
0x6dFCA04D...19b471c93
0.00001 ETH
207327512024-09-12 6:29:5932 days ago1726122599
0x6dFCA04D...19b471c93
0.00001 ETH
207327432024-09-12 6:28:2332 days ago1726122503
0x6dFCA04D...19b471c93
0.00001 ETH
207283632024-09-11 15:48:1133 days ago1726069691
0x6dFCA04D...19b471c93
0.435807 ETH
207267052024-09-11 10:14:3533 days ago1726049675
0x6dFCA04D...19b471c93
0.00001 ETH
207262832024-09-11 8:49:2333 days ago1726044563
0x6dFCA04D...19b471c93
0.00001 ETH
207262462024-09-11 8:41:4733 days ago1726044107
0x6dFCA04D...19b471c93
0.00001 ETH
207262382024-09-11 8:40:1133 days ago1726044011
0x6dFCA04D...19b471c93
0.00001 ETH
207259902024-09-11 7:50:1133 days ago1726041011
0x6dFCA04D...19b471c93
0.00001 ETH
207257952024-09-11 7:10:5933 days ago1726038659
0x6dFCA04D...19b471c93
0.00001 ETH
207256822024-09-11 6:48:1133 days ago1726037291
0x6dFCA04D...19b471c93
0.00001 ETH
207256672024-09-11 6:45:1133 days ago1726037111
0x6dFCA04D...19b471c93
0.00001 ETH
207256492024-09-11 6:41:3533 days ago1726036895
0x6dFCA04D...19b471c93
0.00001 ETH
207256442024-09-11 6:40:3533 days ago1726036835
0x6dFCA04D...19b471c93
0.00001 ETH
207256342024-09-11 6:38:3533 days ago1726036715
0x6dFCA04D...19b471c93
0.00001 ETH
207256262024-09-11 6:36:5933 days ago1726036619
0x6dFCA04D...19b471c93
0.00001 ETH
207256032024-09-11 6:32:2333 days ago1726036343
0x6dFCA04D...19b471c93
0.00001 ETH
207255752024-09-11 6:26:4733 days ago1726036007
0x6dFCA04D...19b471c93
0.0002 ETH
207255672024-09-11 6:25:1133 days ago1726035911
0x6dFCA04D...19b471c93
0.0002 ETH
207255412024-09-11 6:19:5933 days ago1726035599
0x6dFCA04D...19b471c93
0.0002 ETH
207255142024-09-11 6:14:3533 days ago1726035275
0x6dFCA04D...19b471c93
0.0003 ETH
207255052024-09-11 6:12:4733 days ago1726035167
0x6dFCA04D...19b471c93
0.0003 ETH
207187552024-09-10 7:34:3534 days ago1725953675
0x6dFCA04D...19b471c93
0.09682761 ETH
207187552024-09-10 7:34:3534 days ago1725953675
0x6dFCA04D...19b471c93
0.00023799 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PepperRouteProcessor

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
File 1 of 16 : PepperRouteProcessor.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import './interfaces/IUniswapV2Pair.sol';
import './interfaces/IUniswapV3Pool.sol';
import './interfaces/ITridentCLPool.sol';
import './interfaces/IBentoBoxMinimal.sol';
import './interfaces/IPool.sol';
import './interfaces/IWETH.sol';
import './interfaces/ICurve.sol';
import './InputStream.sol';
import './Utils.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";

address constant IMPOSSIBLE_POOL_ADDRESS = 0x0000000000000000000000000000000000000001;
address constant INTERNAL_INPUT_SOURCE = 0x0000000000000000000000000000000000000000;

uint8 constant LOCKED = 2;
uint8 constant NOT_LOCKED = 1;
uint8 constant PAUSED = 2;
uint8 constant NOT_PAUSED = 1;

/// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
uint160 constant MIN_SQRT_RATIO = 4295128739;
/// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
uint160 constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

/// @title A route processor for the Pepper Aggregator
/// @author Emmanuel Amodu
contract PepperRouteProcessor is Ownable {
  using SafeERC20 for IERC20;
  using Utils for IERC20;
  using Utils for address;
  using SafeERC20 for IERC20Permit;
  using InputStream for uint256;

  event Route(
    address indexed from, 
    address to, 
    address indexed tokenIn, 
    address indexed tokenOut, 
    uint256 amountIn, 
    uint256 amountOutMin,
    uint256 amountOut
  );

  error MinimalOutputBalanceViolation(uint256 amountOut);

  IBentoBoxMinimal public immutable bentoBox;
  mapping (address => bool) public priviledgedUsers;
  address private lastCalledPool;

  uint8 private unlocked = NOT_LOCKED;
  uint8 private paused = NOT_PAUSED;
  modifier lock() {
      require(unlocked == NOT_LOCKED, 'RouteProcessor is locked');
      require(paused == NOT_PAUSED, 'RouteProcessor is paused');
      unlocked = LOCKED;
      _;
      unlocked = NOT_LOCKED;
  }

  modifier onlyOwnerOrPriviledgedUser() {
    require(msg.sender == owner() || priviledgedUsers[msg.sender], "RP: caller is not the owner or a privileged user");
    _;
  }

  constructor(address _bentoBox, address[] memory priviledgedUserList) Ownable(_msgSender()) {
    bentoBox = IBentoBoxMinimal(_bentoBox);
    lastCalledPool = IMPOSSIBLE_POOL_ADDRESS;

    for (uint256 i = 0; i < priviledgedUserList.length; i++) {
      priviledgedUsers[priviledgedUserList[i]] = true;
    }
  }

  function setPriviledge(address user, bool priviledge) external onlyOwner {
    priviledgedUsers[user] = priviledge;
  }

  function pause() external onlyOwnerOrPriviledgedUser {
    paused = PAUSED;
  }

  function resume() external onlyOwnerOrPriviledgedUser {
    paused = NOT_PAUSED;
  }

  /// @notice For native unwrapping
  receive() external payable {}

  /// @notice Processes the route generated off-chain. Has a lock
  /// @param tokenIn Address of the input token
  /// @param amountIn Amount of the input token
  /// @param tokenOut Address of the output token
  /// @param amountOutMin Minimum amount of the output token
  /// @param to Where to transfer output tokens
  /// @param route Route to process
  /// @return amountOut Actual amount of the output token
  function processRoute(
    address tokenIn,
    uint256 amountIn,
    address tokenOut,
    uint256 amountOutMin,
    address to,
    bytes memory route
  ) external payable lock returns (uint256 amountOut) {
    return processRouteInternal(tokenIn, amountIn, tokenOut, amountOutMin, to, route);
  }

  /// @notice Transfers some value to <transferValueTo> and then processes the route
  /// @param transferValueTo Address where the value should be transferred
  /// @param amountValueTransfer How much value to transfer
  /// @param tokenIn Address of the input token
  /// @param amountIn Amount of the input token
  /// @param tokenOut Address of the output token
  /// @param amountOutMin Minimum amount of the output token
  /// @return amountOut Actual amount of the output token
  function transferValueAndprocessRoute(
    address transferValueTo,
    uint256 amountValueTransfer,
    address tokenIn,
    uint256 amountIn,
    address tokenOut,
    uint256 amountOutMin,
    address to,
    bytes memory route
  ) external payable lock returns (uint256 amountOut) {
    transferValueTo.transferNative(amountValueTransfer);
    return processRouteInternal(tokenIn, amountIn, tokenOut, amountOutMin, to, route);
  }

  /// @notice Transfers some value of input tokens to <transferValueTo> and then processes the route
  /// @param transferValueTo Address where the value should be transferred
  /// @param amountValueTransfer How much value to transfer
  /// @param tokenIn Address of the input token
  /// @param amountIn Amount of the input token
  /// @param tokenOut Address of the output token
  /// @param amountOutMin Minimum amount of the output token
  /// @return amountOut Actual amount of the output token
  function processRouteWithTransferValueInput(
    address payable transferValueTo,
    uint256 amountValueTransfer,
    address tokenIn,
    uint256 amountIn,
    address tokenOut,
    uint256 amountOutMin,
    address to,
    bytes memory route
  ) external payable lock returns (uint256 amountOut) {
    tokenIn.transferAnyFromSender(transferValueTo, amountValueTransfer);
    return processRouteInternal(tokenIn, amountIn, tokenOut, amountOutMin, to, route);
  }
  
  /// @notice processes the route and sends <amountValueTransfer> amount of output token to <transferValueTo>
  /// @param transferValueTo Address where the value should be transferred
  /// @param amountValueTransfer How much value to transfer
  /// @param tokenIn Address of the input token
  /// @param amountIn Amount of the input token
  /// @param tokenOut Address of the output token
  /// @param amountOutMin Minimum amount of the output token
  /// @return amountOut Actual amount of the output token
  function processRouteWithTransferValueOutput(
    address payable transferValueTo,
    uint256 amountValueTransfer,
    address tokenIn,
    uint256 amountIn,
    address tokenOut,
    uint256 amountOutMin,
    address to,
    bytes memory route
  ) external payable lock returns (uint256 amountOut) {
    amountOut = processRouteInternal(tokenIn, amountIn, tokenOut, amountOutMin, address(this), route);
    tokenOut.transferAny(transferValueTo, amountValueTransfer);
    tokenOut.transferAny(to, amountOut - amountValueTransfer);
  }

  /// @notice Processes the route generated off-chain
  /// @param tokenIn Address of the input token
  /// @param amountIn Amount of the input token
  /// @param tokenOut Address of the output token
  /// @param amountOutMin Minimum amount of the output token
  /// @return amountOut Actual amount of the output token
  function processRouteInternal(
    address tokenIn,
    uint256 amountIn,
    address tokenOut,
    uint256 amountOutMin,
    address to,
    bytes memory route
  ) private returns (uint256 amountOut) {
    uint256 balanceInInitial = tokenIn.anyBalanceOf(msg.sender);
    uint256 balanceOutInitial = tokenOut.anyBalanceOf(to);

    uint256 realAmountIn = amountIn;
    {
      uint256 step = 0;
      uint256 stream = InputStream.createStream(route);
      while (stream.isNotEmpty()) {
        uint8 commandCode = stream.readUint8();
        if (commandCode == 1) {
          uint256 usedAmount = processMyERC20(stream); 
          if (step == 0) realAmountIn = usedAmount;
        } 
        else if (commandCode == 2) processUserERC20(stream, amountIn);
        else if (commandCode == 3) {
          uint256 usedAmount = processNative(stream); 
          if (step == 0) realAmountIn = usedAmount;
        } 
        else if (commandCode == 4) processOnePool(stream);
        else if (commandCode == 5) processInsideBento(stream);
        else if (commandCode == 6) applyPermit(tokenIn, stream);
        else revert('RouteProcessor: Unknown command code');
        ++step;
      }
    }

    uint256 balanceInFinal = tokenIn.anyBalanceOf(msg.sender);
    if (tokenIn != Utils.NATIVE_ADDRESS)
      require(balanceInFinal + amountIn + 10 >= balanceInInitial, 'RouteProcessor: Minimal input balance violation');
    
    uint256 balanceOutFinal = tokenOut.anyBalanceOf(to);
    if (balanceOutFinal < balanceOutInitial + amountOutMin)
      revert MinimalOutputBalanceViolation(balanceOutFinal - balanceOutInitial);

    amountOut = balanceOutFinal - balanceOutInitial;

    emit Route(msg.sender, to, tokenIn, tokenOut, realAmountIn, amountOutMin, amountOut);
  }

  /// @notice Applies ERC-2612 permit
  /// @param tokenIn permitted token
  /// @param stream Streamed program
  function applyPermit(address tokenIn, uint256 stream) private {
    uint256 value = stream.readUint();
    uint256 deadline = stream.readUint();
    uint8 v = stream.readUint8();
    bytes32 r = stream.readBytes32();
    bytes32 s = stream.readBytes32();
    if (IERC20(tokenIn).allowance(msg.sender, address(this)) < value) {
      IERC20Permit(tokenIn).permit(msg.sender, address(this), value, deadline, v, r, s);
    }
  }

  /// @notice Processes native coin: call swap for all pools that swap from native coin
  /// @param stream Streamed program
  function processNative(uint256 stream) private returns (uint256 amountTotal) {
    amountTotal = address(this).balance;
    distributeAndSwap(stream, address(this), Utils.NATIVE_ADDRESS, amountTotal);
  }

  /// @notice Processes ERC20 token from this contract balance:
  /// @notice Call swap for all pools that swap from this token
  /// @param stream Streamed program
  function processMyERC20(uint256 stream) private returns (uint256 amountTotal) {
    address token = stream.readAddress();
    amountTotal = IERC20(token).balanceOf(address(this));
    unchecked {
      if (amountTotal > 0) amountTotal -= 1;     // slot undrain protection
    }
    distributeAndSwap(stream, address(this), token, amountTotal);
  }
  
  /// @notice Processes ERC20 token from msg.sender balance:
  /// @notice Call swap for all pools that swap from this token
  /// @param stream Streamed program
  /// @param amountTotal Amount of tokens to take from msg.sender
  function processUserERC20(uint256 stream, uint256 amountTotal) private {
    address token = stream.readAddress();
    distributeAndSwap(stream, msg.sender, token, amountTotal);
  }

  /// @notice Processes ERC20 token for cases when the token has only one output pool
  /// @notice In this case liquidity is already at pool balance. This is an optimization
  /// @notice Call swap for all pools that swap from this token
  /// @param stream Streamed program
  function processOnePool(uint256 stream) private {
    address token = stream.readAddress();
    swap(stream, INTERNAL_INPUT_SOURCE, token, 0);
  }

  /// @notice Processes Bento tokens 
  /// @notice Call swap for all pools that swap from this token
  /// @param stream Streamed program
  function processInsideBento(uint256 stream) private {
    address token = stream.readAddress();
    uint256 amountTotal = bentoBox.balanceOf(token, address(this));
    unchecked {
      if (amountTotal > 0) amountTotal -= 1;     // slot undrain protection
    }
    distributeAndSwap(stream, address(this), token, amountTotal);
  }

  /// @notice Distributes amountTotal to several pools according to their shares and calls swap for each pool
  /// @param stream Streamed program
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountTotal Total amount of tokenIn for swaps 
  function distributeAndSwap(uint256 stream, address from, address tokenIn, uint256 amountTotal) private {
    uint8 num = stream.readUint8();
    unchecked {
      for (uint256 i = 0; i < num; ++i) {
        uint16 share = stream.readUint16();
        uint256 amount = (amountTotal * share) / type(uint16).max /*65535*/;
        amountTotal -= amount;
        swap(stream, from, tokenIn, amount);
      }
    }
  }

  /// @notice Makes swap
  /// @param stream Streamed program
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function swap(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    uint8 poolType = stream.readUint8();
    if (poolType == 0) swapUniV2(stream, from, tokenIn, amountIn);
    else if (poolType == 1) swapUniV3(stream, from, tokenIn, amountIn);
    else if (poolType == 2) wrapNative(stream, from, tokenIn, amountIn);
    else if (poolType == 3) bentoBridge(stream, from, tokenIn, amountIn);
    else if (poolType == 4) swapTrident(stream, from, tokenIn, amountIn);
    else if (poolType == 5) swapCurve(stream, from, tokenIn, amountIn);
    else revert('RouteProcessor: Unknown pool type');
  }

  /// @notice Wraps/unwraps native token
  /// @param stream [direction & fake, recipient, wrapToken?]
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function wrapNative(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    uint8 directionAndFake = stream.readUint8();
    address to = stream.readAddress();

    if (directionAndFake & 1 == 1) {  // wrap native
      address wrapToken = stream.readAddress();
      if (directionAndFake & 2 == 0) IWETH(wrapToken).deposit{value: amountIn}();
      if (to != address(this)) IERC20(wrapToken).safeTransfer(to, amountIn);
    } else { // unwrap native
      if (directionAndFake & 2 == 0) {
        if (from == msg.sender) IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), amountIn);
        IWETH(tokenIn).withdraw(amountIn);
      }
      to.transferNative(amountIn);
    }
  }

  /// @notice Bridge/unbridge tokens to/from Bento
  /// @param stream [direction, recipient]
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function bentoBridge(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    uint8 direction = stream.readUint8();
    address to = stream.readAddress();

    if (direction > 0) {  // outside to Bento
      // deposit to arbitrary recipient is possible only from address(bentoBox)
      if (from == address(this)) IERC20(tokenIn).safeTransfer(address(bentoBox), amountIn);
      else if (from == msg.sender) IERC20(tokenIn).safeTransferFrom(msg.sender, address(bentoBox), amountIn);
      else {
        // tokens already are at address(bentoBox)
        amountIn = IERC20(tokenIn).balanceOf(address(bentoBox)) +
        bentoBox.strategyData(tokenIn).balance -
        bentoBox.totals(tokenIn).elastic;
      }
      bentoBox.deposit(tokenIn, address(bentoBox), to, amountIn, 0);
    } else { // Bento to outside
      if (from != INTERNAL_INPUT_SOURCE) {
        bentoBox.transfer(tokenIn, from, address(this), amountIn);
      } else amountIn = bentoBox.balanceOf(tokenIn, address(this));
      bentoBox.withdraw(tokenIn, address(this), to, 0, amountIn);
    }
  }

  /// @notice UniswapV2 pool swap
  /// @param stream [pool, direction, recipient, fee]
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function swapUniV2(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    address pool = stream.readAddress();
    uint8 direction = stream.readUint8();
    address to = stream.readAddress();
    uint24 fee = stream.readUint24();   // pool fee in 1/1_000_000

    if (from == address(this)) IERC20(tokenIn).safeTransfer(pool, amountIn);
    else if (from == msg.sender) IERC20(tokenIn).safeTransferFrom(msg.sender, pool, amountIn);

    (uint256 r0, uint256 r1, ) = IUniswapV2Pair(pool).getReserves();
    require(r0 > 0 && r1 > 0, 'Wrong pool reserves');
    (uint256 reserveIn, uint256 reserveOut) = direction == 1 ? (r0, r1) : (r1, r0);
    amountIn = IERC20(tokenIn).balanceOf(pool) - reserveIn;  // tokens already were transferred

    uint256 amountInWithFee = amountIn * (1_000_000 - fee);
    uint256 amountOut = (amountInWithFee * reserveOut) / (reserveIn * 1_000_000 + amountInWithFee);
    (uint256 amount0Out, uint256 amount1Out) = direction == 1 ? (uint256(0), amountOut) : (amountOut, uint256(0));
    IUniswapV2Pair(pool).swap(amount0Out, amount1Out, to, new bytes(0));
  }

  /// @notice Trident pool swap
  /// @param stream [pool, swapData]
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function swapTrident(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    address pool = stream.readAddress();
    bytes memory swapData = stream.readBytes();

    if (from != INTERNAL_INPUT_SOURCE) {
      bentoBox.transfer(tokenIn, from, pool, amountIn);
    }
    
    IPool(pool).swap(swapData);
  }

  /// @notice UniswapV3 pool swap
  /// @param stream [pool, direction, recipient]
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function swapUniV3(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    address pool = stream.readAddress();
    bool zeroForOne = stream.readUint8() > 0;
    address recipient = stream.readAddress();

    if (from == msg.sender) IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), uint256(amountIn));

    lastCalledPool = pool;
    IUniswapV3Pool(pool).swap(
      recipient,
      zeroForOne,
      int256(amountIn),
      zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1,
      abi.encode(tokenIn)
    );
    require(lastCalledPool == IMPOSSIBLE_POOL_ADDRESS, 'RouteProcessor.swapUniV3: unexpected'); // Just to be sure
  }

  /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
  /// @dev In the implementation you must pay the pool tokens owed for the swap.
  /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
  /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
  /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
  /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
  /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
  /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
  /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
  function uniswapV3SwapCallback(
    int256 amount0Delta,
    int256 amount1Delta,
    bytes calldata data
  ) public {
    require(msg.sender == lastCalledPool, 'RouteProcessor.uniswapV3SwapCallback: call from unknown source');
    int256 amount = amount0Delta > 0 ? amount0Delta : amount1Delta;
    require(amount > 0, 'RouteProcessor.uniswapV3SwapCallback: not positive amount');
    
    lastCalledPool = IMPOSSIBLE_POOL_ADDRESS;
    (address tokenIn) = abi.decode(data, (address));
    IERC20(tokenIn).safeTransfer(msg.sender, uint256(amount));
  }

  /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap.
  /// @dev In the implementation you must pay the pool tokens owed for the swap.
  /// The caller of this method _must_ be checked to be a AlgebraPool deployed by the canonical AlgebraFactory.
  /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
  /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
  /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
  /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
  /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
  /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call
  function algebraSwapCallback(
    int256 amount0Delta,
    int256 amount1Delta,
    bytes calldata data
  ) external {
    uniswapV3SwapCallback(amount0Delta, amount1Delta, data);
  }

  /// @notice Called to `msg.sender` after executing a swap via PancakeV3Pool#swap.
  /// @dev In the implementation you must pay the pool tokens owed for the swap.
  /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
  /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
  /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
  /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
  /// @param data Any data passed through by the caller via the PancakeV3Pool#swap call
  function pancakeV3SwapCallback(
    int256 amount0Delta,
    int256 amount1Delta,
    bytes calldata data
  ) external {
    uniswapV3SwapCallback(amount0Delta, amount1Delta, data);
  }

  /// @notice Curve pool swap. Legacy pools that don't return amountOut and have native coins are not supported
  /// @param stream [pool, poolType, fromIndex, toIndex, recipient, output token]
  /// @param from Where to take liquidity for swap
  /// @param tokenIn Input token
  /// @param amountIn Amount of tokenIn to take for swap
  function swapCurve(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
    address pool = stream.readAddress();
    uint8 poolType = stream.readUint8();
    int128 fromIndex = int8(stream.readUint8());
    int128 toIndex = int8(stream.readUint8());
    address to = stream.readAddress();
    address tokenOut = stream.readAddress();

    uint256 amountOut;
    if (tokenIn == Utils.NATIVE_ADDRESS) {
      amountOut = ICurve(pool).exchange{value: amountIn}(fromIndex, toIndex, amountIn, 0);
    } else {
      if (from == msg.sender) IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), amountIn);
      IERC20(tokenIn).approveSafe(pool, amountIn);
      if (poolType == 0) amountOut = ICurve(pool).exchange(fromIndex, toIndex, amountIn, 0);
      else {
        uint256 balanceBefore = tokenOut.anyBalanceOf(address(this));
        ICurveLegacy(pool).exchange(fromIndex, toIndex, amountIn, 0);
        uint256 balanceAfter = tokenOut.anyBalanceOf(address(this));
        amountOut = balanceAfter - balanceBefore;
      }
    }

    if (to != address(this)) tokenOut.transferAny(to, amountOut);
  }
}

File 2 of 16 : IUniswapV2Pair.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 3 of 16 : IUniswapV3Pool.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

interface IUniswapV3Pool {
  function token0() external returns (address);
  function token1() external returns (address);

  function swap(
    address recipient,
    bool zeroForOne,
    int256 amountSpecified,
    uint160 sqrtPriceLimitX96,
    bytes calldata data
  ) external returns (int256 amount0, int256 amount1);
}

File 4 of 16 : ITridentCLPool.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

interface ITridentCLPool {
  function token0() external returns (address);
  function token1() external returns (address);

  function swap(
    address recipient,
    bool zeroForOne,
    int256 amountSpecified,
    uint160 sqrtPriceLimitX96,
    bool unwrapBento,
    bytes calldata data
  ) external returns (int256 amount0, int256 amount1);
}

File 5 of 16 : IBentoBoxMinimal.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

struct Rebase {
    uint128 elastic;
    uint128 base;
}

struct StrategyData {
    uint64 strategyStartDate;
    uint64 targetPercentage;
    uint128 balance; // the balance of the strategy that BentoBox thinks is in there
}

/// @notice A rebasing library
library RebaseLibrary {
    /// @notice Calculates the base value in relationship to `elastic` and `total`.
    function toBase(Rebase memory total, uint256 elastic) internal pure returns (uint256 base) {
        if (total.elastic == 0) {
            base = elastic;
        } else {
            base = (elastic * total.base) / total.elastic;
        }
    }

    /// @notice Calculates the elastic value in relationship to `base` and `total`.
    function toElastic(Rebase memory total, uint256 base) internal pure returns (uint256 elastic) {
        if (total.base == 0) {
            elastic = base;
        } else {
            elastic = (base * total.elastic) / total.base;
        }
    }
}

/// @notice Minimal BentoBox vault interface.
/// @dev `token` is aliased as `address` from `IERC20` for simplicity.
interface IBentoBoxMinimal {
    /// @notice Balance per ERC-20 token per account in shares.
    function balanceOf(address, address) external view returns (uint256);

    /// @dev Helper function to represent an `amount` of `token` in shares.
    /// @param token The ERC-20 token.
    /// @param amount The `token` amount.
    /// @param roundUp If the result `share` should be rounded up.
    /// @return share The token amount represented in shares.
    function toShare(
        address token,
        uint256 amount,
        bool roundUp
    ) external view returns (uint256 share);

    /// @dev Helper function to represent shares back into the `token` amount.
    /// @param token The ERC-20 token.
    /// @param share The amount of shares.
    /// @param roundUp If the result should be rounded up.
    /// @return amount The share amount back into native representation.
    function toAmount(
        address token,
        uint256 share,
        bool roundUp
    ) external view returns (uint256 amount);

    /// @notice Registers this contract so that users can approve it for BentoBox.
    function registerProtocol() external;

    /// @notice Deposit an amount of `token` represented in either `amount` or `share`.
    /// @param token The ERC-20 token to deposit.
    /// @param from which account to pull the tokens.
    /// @param to which account to push the tokens.
    /// @param amount Token amount in native representation to deposit.
    /// @param share Token amount represented in shares to deposit. Takes precedence over `amount`.
    /// @return amountOut The amount deposited.
    /// @return shareOut The deposited amount represented in shares.
    function deposit(
        address token,
        address from,
        address to,
        uint256 amount,
        uint256 share
    ) external payable returns (uint256 amountOut, uint256 shareOut);

    /// @notice Withdraws an amount of `token` from a user account.
    /// @param token_ The ERC-20 token to withdraw.
    /// @param from which user to pull the tokens.
    /// @param to which user to push the tokens.
    /// @param amount of tokens. Either one of `amount` or `share` needs to be supplied.
    /// @param share Like above, but `share` takes precedence over `amount`.
    function withdraw(
        address token_,
        address from,
        address to,
        uint256 amount,
        uint256 share
    ) external returns (uint256 amountOut, uint256 shareOut);

    /// @notice Transfer shares from a user account to another one.
    /// @param token The ERC-20 token to transfer.
    /// @param from which user to pull the tokens.
    /// @param to which user to push the tokens.
    /// @param share The amount of `token` in shares.
    function transfer(
        address token,
        address from,
        address to,
        uint256 share
    ) external;

    /// @dev Reads the Rebase `totals`from storage for a given token
    function totals(address token) external view returns (Rebase memory total);

    function strategyData(address token) external view returns (StrategyData memory total);

    /// @dev Approves users' BentoBox assets to a "master" contract.
    function setMasterContractApproval(
        address user,
        address masterContract,
        bool approved,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function harvest(
        address token,
        bool balance,
        uint256 maxChangeAmount
    ) external;
}

File 6 of 16 : IPool.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

pragma experimental ABIEncoderV2;

/// @notice Trident pool interface.
interface IPool {
    /// @notice Executes a swap from one token to another.
    /// @dev The input tokens must've already been sent to the pool.
    /// @param data ABI-encoded params that the pool requires.
    /// @return finalAmountOut The amount of output tokens that were sent to the user.
    function swap(bytes calldata data) external returns (uint256 finalAmountOut);

    /// @notice Executes a swap from one token to another with a callback.
    /// @dev This function allows borrowing the output tokens and sending the input tokens in the callback.
    /// @param data ABI-encoded params that the pool requires.
    /// @return finalAmountOut The amount of output tokens that were sent to the user.
    function flashSwap(bytes calldata data) external returns (uint256 finalAmountOut);

    /// @notice Mints liquidity tokens.
    /// @param data ABI-encoded params that the pool requires.
    /// @return liquidity The amount of liquidity tokens that were minted for the user.
    function mint(bytes calldata data) external returns (uint256 liquidity);

    /// @notice Burns liquidity tokens.
    /// @dev The input LP tokens must've already been sent to the pool.
    /// @param data ABI-encoded params that the pool requires.
    /// @return withdrawnAmounts The amount of various output tokens that were sent to the user.
    function burn(bytes calldata data) external returns (TokenAmount[] memory withdrawnAmounts);

    /// @notice Burns liquidity tokens for a single output token.
    /// @dev The input LP tokens must've already been sent to the pool.
    /// @param data ABI-encoded params that the pool requires.
    /// @return amountOut The amount of output tokens that were sent to the user.
    function burnSingle(bytes calldata data) external returns (uint256 amountOut);

    /// @return A unique identifier for the pool type.
    function poolIdentifier() external pure returns (bytes32);

    /// @return An array of tokens supported by the pool.
    function getAssets() external view returns (address[] memory);

    /// @notice Simulates a trade and returns the expected output.
    /// @dev The pool does not need to include a trade simulator directly in itself - it can use a library.
    /// @param data ABI-encoded params that the pool requires.
    /// @return finalAmountOut The amount of output tokens that will be sent to the user if the trade is executed.
    function getAmountOut(bytes calldata data) external view returns (uint256 finalAmountOut);

    /// @notice Simulates a trade and returns the expected output.
    /// @dev The pool does not need to include a trade simulator directly in itself - it can use a library.
    /// @param data ABI-encoded params that the pool requires.
    /// @return finalAmountIn The amount of input tokens that are required from the user if the trade is executed.
    function getAmountIn(bytes calldata data) external view returns (uint256 finalAmountIn);

    /// @dev This event must be emitted on all swaps.
    event Swap(address indexed recipient, address indexed tokenIn, address indexed tokenOut, uint256 amountIn, uint256 amountOut);

    /// @dev This struct frames output tokens for burns.
    struct TokenAmount {
        address token;
        uint256 amount;
    }
}

File 7 of 16 : IWETH.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

interface IWETH {
  function deposit() external payable;

  function transfer(address to, uint256 value) external returns (bool);

  function withdraw(uint256) external;
}

File 8 of 16 : ICurve.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

interface ICurve {
  function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) payable external returns (uint256);
}

interface ICurveLegacy {
  function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) payable external;
}

File 9 of 16 : InputStream.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

/** @notice Simple read stream */
library InputStream {

  /** @notice Creates stream from data
   * @param data data
   */
  function createStream(bytes memory data) internal pure returns (uint256 stream) {
    assembly {
      stream := mload(0x40)
      mstore(0x40, add(stream, 64))
      mstore(stream, data)
      let length := mload(data)
      mstore(add(stream, 32), add(data, length))
    }
  }

  /** @notice Checks if stream is not empty
   * @param stream stream
   */
  function isNotEmpty(uint256 stream) internal pure returns (bool) {
    uint256 pos;
    uint256 finish;
    assembly {
      pos := mload(stream)
      finish := mload(add(stream, 32))
    }
    return pos < finish;
  }

  /** @notice Reads uint8 from the stream
   * @param stream stream
   */
  function readUint8(uint256 stream) internal pure returns (uint8 res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 1)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads uint16 from the stream
   * @param stream stream
   */
  function readUint16(uint256 stream) internal pure returns (uint16 res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 2)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads uint24 from the stream
   * @param stream stream
   */
  function readUint24(uint256 stream) internal pure returns (uint24 res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 3)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads uint32 from the stream
   * @param stream stream
   */
  function readUint32(uint256 stream) internal pure returns (uint32 res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 4)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads uint256 from the stream
   * @param stream stream
   */
  function readUint(uint256 stream) internal pure returns (uint256 res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 32)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads bytes32 from the stream
   * @param stream stream
   */
  function readBytes32(uint256 stream) internal pure returns (bytes32 res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 32)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads address from the stream
   * @param stream stream
   */
  function readAddress(uint256 stream) internal pure returns (address res) {
    assembly {
      let pos := mload(stream)
      pos := add(pos, 20)
      res := mload(pos)
      mstore(stream, pos)
    }
  }

  /** @notice Reads bytes from the stream
   * @param stream stream
   */
  function readBytes(uint256 stream) internal pure returns (bytes memory res) {
    assembly {
      let pos := mload(stream)
      res := add(pos, 32)
      let length := mload(res)
      mstore(stream, add(res, length))
    }
  }
}

File 10 of 16 : Utils.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';

library Utils {
  using SafeERC20 for IERC20;

  address constant NATIVE_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

  /**
   * @dev returns user's balance of token (or native)
   */
  function anyBalanceOf(address token, address user) internal view returns (uint256) {
    if (token == NATIVE_ADDRESS) return address(user).balance;
    else return IERC20(token).balanceOf(user);
  }

  /**
   * @dev transfers native with correct revert bubble up
   */
  function transferNative(address to, uint256 amount) internal {
    (bool success, bytes memory returnBytes) = to.call{value: amount}('');
    if (!success) {
      assembly {
        revert(add(32, returnBytes), mload(returnBytes))
      }
    }
  }

  /**
   * @dev transfers ERC20 or native
   */
  function transferAny(address token, address to, uint256 amount) internal {
    if (token == NATIVE_ADDRESS) transferNative(to, amount);
    else IERC20(token).safeTransfer(to, amount);
  }

  /**
   * @dev transfers from ERC20 or transfers native
   */
  function transferAnyFromSender(address token, address to, uint256 amount) internal {
    if (token == NATIVE_ADDRESS) transferNative(to, amount);  // native liquidity is already on this contract
    else IERC20(token).safeTransferFrom(msg.sender, to, amount);
  }

  /**
   * @dev ERC20 approve that correct works with token.approve which returns bool or nothing (USDT for example)
   * @param token The token targeted by the call.
   * @param spender token spender
   * @param amount token amount
   */
  function approveStable(IERC20 token, address spender, uint256 amount) internal returns (bool) {
    (bool success, bytes memory data) = address(token).call(
      abi.encodeWithSelector(token.approve.selector, spender, amount)
    );
    return success && (data.length == 0 || abi.decode(data, (bool)));
  }

  /**
   * @dev ERC20 approve that correct works with token.approve which reverts if amount and 
   *      current allowance are not zero simultaniously (USDT for example). 
   *      In second case it tries to set allowance to 0, and then back to amount.
   * @param token The token targeted by the call.
   * @param spender token spender
   * @param amount token amount
   */
  function approveSafe(IERC20 token, address spender, uint256 amount) internal returns (bool) {
    return approveStable(token, spender, amount) 
      || (approveStable(token, spender, 0) && approveStable(token, spender, amount));
  }
}

File 11 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 12 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 13 of 16 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 14 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 15 of 16 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 16 of 16 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@uniswap/v3-core/=lib/v3-core/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_bentoBox","type":"address"},{"internalType":"address[]","name":"priviledgedUserList","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"MinimalOutputBalanceViolation","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Route","type":"event"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"algebraSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bentoBox","outputs":[{"internalType":"contract IBentoBoxMinimal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"pancakeV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priviledgedUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"processRoute","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"transferValueTo","type":"address"},{"internalType":"uint256","name":"amountValueTransfer","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"processRouteWithTransferValueInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"transferValueTo","type":"address"},{"internalType":"uint256","name":"amountValueTransfer","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"processRouteWithTransferValueOutput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resume","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"priviledge","type":"bool"}],"name":"setPriviledge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transferValueTo","type":"address"},{"internalType":"uint256","name":"amountValueTransfer","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"transferValueAndprocessRoute","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a0604052346101c15761289780380380610019816101d9565b9283398101906040818303126101c157610032816101fe565b602082015190916001600160401b0382116101c157019180601f840112156101c1578251926001600160401b0384116101c5578360051b906020806100788185016101d9565b8097815201928201019283116101c157602001905b8282106101a9575050503315610196575f8054336001600160a01b03198216811783556001939290916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a360025490828060a01b031660805261010160a01b90828060b01b03191617176002555f5b815181101561013f57600190818060a01b0360208260051b85010151165f528160205260405f208260ff1982541617905501610108565b6040516126849081610213823960805181818161050f0152818161105f015281816117a40152818161197a015281816119c001528181611a5b01528181611a9a01528181611c4301528181611d050152611d830152f35b631e4fbdf760e01b5f525f60045260245ffd5b602080916101b6846101fe565b81520191019061008d565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040519190601f01601f191682016001600160401b038111838210176101c557604052565b51906001600160a01b03821682036101c15756fe6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c8063046f7da21461010057806323a69e75146100c45780632646478b146100fb5780632c8958f6146100c457806347f8bd41146100f65780636678ec1f146100f15780636b2ace87146100ec578063715018a6146100e75780638456cb59146100e25780638da5cb5b146100dd57806393b3774c146100d85780639a1f3406146100d3578063cd0fb7a7146100ce578063f2fde38b146100c95763fa461e330361000e575b6101c6565b61075f565b61071f565b6106c7565b610616565b6105ef565b610595565b61053e565b6104fa565b610466565b6103c7565b61028e565b610113565b5f91031261010f57565b5f80fd5b3461010f575f36600319011261010f575f546001600160a01b031633148015610155575b610140906107e8565b6002805460ff60a81b1916600160a81b179055005b50335f9081526001602052604090205460ff16610137565b90606060031983011261010f57600435916024359160443567ffffffffffffffff811161010f578260238201121561010f5780600401359267ffffffffffffffff841161010f576024848301011161010f576024019190565b3461010f576100186101d73661016d565b9291909161091b565b6001600160a01b0381160361010f57565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761022757604052565b6101f1565b67ffffffffffffffff811161022757601f01601f191660200190565b81601f8201121561010f5780359061025f8261022c565b9261026d6040519485610205565b8284526020838301011161010f57815f926020809301838601378301015290565b60c036600319011261010f576004356102a6816101e0565b60243590604435906102b7826101e0565b6084356064356102c6826101e0565b60a4359367ffffffffffffffff851161010f57610353956102ee610330963690600401610248565b94610313600160ff60025461030983838360a01c161461084d565b60a81c1614610899565b6002805460ff60a01b1916600160a11b179055610afa565b610afa565b6002805460ff60a01b1916600160a01b1790556040519081529081906020820190565b0390f35b9061010060031983011261010f57600435610371816101e0565b9160243591604435610382816101e0565b9160643591608435610393816101e0565b9160a4359160c4356103a4816101e0565b9160e4359067ffffffffffffffff821161010f576103c491600401610248565b90565b61043d6103d336610357565b966103f7600160ff60029994999895989796975461030983838360a01c161461084d565b6002805460ff60a01b1916600160a11b1790556001600160a01b0383811692911673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee830361045b5761032b9250610dda565b6002805460ff60a01b1916600160a01b179055604051908152602090f35b61032b9233906112b7565b6104c56104b561047536610357565b9183879561049b600160ff60029e9a969e9d989c9d5461030983838360a01c161461084d565b6002805460ff60a01b1916600160a11b1790553093610afa565b946001600160a01b031684610d4c565b82038281116104f5576020936104da92610d4c565b6002805460ff60a01b1916600160a01b179055604051908152f35b6108e5565b3461010f575f36600319011261010f576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b3461010f575f36600319011261010f57610556610d85565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461010f575f36600319011261010f575f546001600160a01b0316331480156105d7575b6105c2906107e8565b6002805460ff60a81b1916600160a91b179055005b50335f9081526001602052604090205460ff166105b9565b3461010f575f36600319011261010f575f546040516001600160a01b039091168152602090f35b61010036600319011261010f5760043561062f816101e0565b6024356044359161063f836101e0565b60643560843561064e816101e0565b60a4359060c4359261065f846101e0565b60e4359667ffffffffffffffff881161010f5761032b6103309761068a6103539a3690600401610248565b976106a5600160ff60025461030983838360a01c161461084d565b6002805460ff60a01b1916600160a11b179055610dda565b8015150361010f57565b3461010f57604036600319011261010f576004356106e4816101e0565b602435906106f1826106bd565b6106f9610d85565b60018060a01b03165f52600160205260405f209060ff8019835416911515161790555f80f35b3461010f57602036600319011261010f5760043561073c816101e0565b60018060a01b03165f526001602052602060ff60405f2054166040519015158152f35b3461010f57602036600319011261010f5760043561077c816101e0565b610784610d85565b6001600160a01b031680156107d5575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b156107ef57565b60405162461bcd60e51b815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201526f10383934bb34b632b3b2b2103ab9b2b960811b6064820152608490fd5b1561085457565b60405162461bcd60e51b815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606490fd5b156108a057565b60405162461bcd60e51b815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606490fd5b634e487b7160e01b5f52601160045260245ffd5b919082039182116104f557565b9081602091031261010f57356103c4816101e0565b6002549293929091906001600160a01b03163303610a02575f8213156109fa5750905b5f82131561098f5761098861097c61097c61098d9561097260016bffffffffffffffffffffffff60a01b6002541617600255565b3394810190610906565b6001600160a01b031690565b610dfb565b565b60405162461bcd60e51b815260206004820152603960248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a206e6f7420706f73697469766520616d6f756e74000000000000006064820152608490fd5b90509061093e565b60405162461bcd60e51b815260206004820152603e60248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a2063616c6c2066726f6d20756e6b6e6f776e20736f7572636500006064820152608490fd5b5f1981146104f55760010190565b90600a82018092116104f557565b919082018092116104f557565b15610a9d57565b60405162461bcd60e51b815260206004820152602f60248201527f526f75746550726f636573736f723a204d696e696d616c20696e70757420626160448201526e3630b731b2903b34b7b630ba34b7b760891b6064820152608490fd5b929590939495610b0a3385610e56565b95610b158185610e56565b918692610b365f9a9060405191604083016040528083528051016020830152565b995b8a5160208c01511115610c4c57610b5e610b588c90600182510180519252565b60ff1690565b60018103610b915750610b708b611234565b8115610b87575b50610b82905b610a6d565b610b38565b9450610b82610b77565b60028103610ba85750610b8290610b7d8a8d61121e565b60038103610bba5750610b708b6111bd565b60048103610bd05750610b8290610b7d8c6110d7565b60058103610be65750610b8290610b7d8c611025565b600603610bfb57610b8290610b7d8c8a610ee7565b60405162461bcd60e51b8152602060048201526024808201527f526f75746550726f636573736f723a20556e6b6e6f776e20636f6d6d616e6420604482015263636f646560e01b6064820152608490fd5b50929695919498509296610c603383610e56565b6001600160a01b039092169573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed198701610d28575b505050610c968388610e56565b610ca08383610a89565b8110610d06577f2db5ddd0b42bdbca0d69ea16f234a870a485854ae0d91f16643d6f317d8b89949291610cd2916108f9565b604080516001600160a01b0395861681526020810197909752860191909152606085018190529590911692339190608090a4565b610d2591610d13916108f9565b63963b34a560e01b5f52600452602490565b5ffd5b610d38610d3d91610d4494610a89565b610a7b565b1015610a96565b5f8080610c89565b6001600160a01b0316919073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8303610d7c5761098d9250610dda565b61098d92610dfb565b5f546001600160a01b03163303610d9857565b63118cdaa760e01b5f523360045260245ffd5b3d15610dd5573d90610dbc8261022c565b91610dca6040519384610205565b82523d5f602084013e565b606090565b5f80809381935af1610dea610dab565b9015610df35750565b805190602001fd5b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261098d91610e37606483610205565b611310565b9081602091031261010f575190565b6040513d5f823e3d90fd5b6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8103610e7f57503190565b6040516370a0823160e01b81526001600160a01b039092166004830152602090829060249082905afa908115610ee2575f91610eb9575090565b6103c4915060203d602011610edb575b610ed38183610205565b810190610e3c565b503d610ec9565b610e4b565b8151602001805190835290610f028390602082510180519252565b90610f138490600182510180519252565b91610f34610f278690602082510180519252565b9590602082510180519252565b604051636eb1769f60e11b81523360048201523060248201526001600160a01b039390931692602081604481875afa8015610ee25786915f91611006575b5010610f81575b505050505050565b823b1561010f5760405163d505accf60e01b81523360048201523060248201526044810195909552606485019190915260ff92909216608484015260a483019390935260c4820152905f90829060e490829084905af18015610ee257610fec575b8080808080610f79565b80610ffa5f61100093610205565b80610105565b5f610fe2565b61101f915060203d602011610edb57610ed38183610205565b5f610f72565b80516014018051908252604051633de222bb60e21b81526001600160a01b03821660048201523060248201529190602083806044810103817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa918215610ee25761098d935f936110b6575b5082806110ab575b503090611399565b5f190192505f6110a3565b6110d091935060203d602011610edb57610ed38183610205565b915f61109b565b601481510190815191815260ff6110f48290600182510180519252565b1680611107575061098d915f8092612232565b6001810361111c575061098d915f8092611fc8565b60028103611131575061098d915f8092611de3565b60038103611146575061098d915f809261192a565b6004810361115b575061098d915f809261170a565b60050361116e5761098d915f8092611462565b60405162461bcd60e51b815260206004820152602160248201527f526f75746550726f636573736f723a20556e6b6e6f776e20706f6f6c207479706044820152606560f81b6064820152608490fd5b90479182600182510191825192815260ff5f9316925b8381106111e05750505050565b60019061121861ffff8060028651018051908752168602048095039473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee30866113e9565b016111d3565b8051601401805190825261098d92913390611399565b805160140180519082526040516370a0823160e01b815230600482015292916020846024816001600160a01b0386165afa938415610ee2575f94611296575b508380611289575b5061098d9184913090611399565b5f1901935061098d61127b565b6112b091945060203d602011610edb57610ed38183610205565b925f611273565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815261098d91610e37608483610205565b9081602091031261010f57516103c4816106bd565b5f806113389260018060a01b03169360208151910182865af1611331610dab565b9083612570565b8051908115159182611360575b505061134e5750565b635274afe760e01b5f5260045260245ffd5b61137392506020809183010191016112fb565b155f80611345565b8115611385570490565b634e487b7160e01b5f52601260045260245ffd5b93929091600185510192835193865260ff5f9416935b8481106113bf5750505050509050565b6001906113e361ffff8060028b51018051908c52168702048096039585858b6113e9565b016113af565b92919060ff6113fe8590600182510180519252565b168061140e575061098d93612232565b60018103611420575061098d93611fc8565b60028103611432575061098d93611de3565b60038103611444575061098d9361192a565b60048103611456575061098d9361170a565b60050361116e5761098d935b9192906114758390601482510180519252565b906114868490600182510180519252565b6114a16114998690600182510180519252565b60ff165f0b90565b5f0b906114b76114998790600182510180519252565b5f0b926114da6114cd8890601482510180519252565b9790601482510180519252565b976001600160a01b03169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8203611595575050604051630f7c084960e21b8152600f92830b60048201529290910b602483015250604481018390525f60648201529160209183916084918391906001600160a01b03165af1908115610ee2575f91611576575b50905b306001600160a01b0382160361156d57505050565b61098d92610d4c565b61158f915060203d602011610edb57610ed38183610205565b5f611555565b60ff92916115b591889188916001600160a01b031633146116c4576124a1565b501661163457604051630f7c084960e21b8152600f91820b600482015291900b602482015260448101929092525f6064830181905260209183916084918391906001600160a01b03165af1908115610ee2575f91611615575b5090611558565b61162e915060203d602011610edb57610ed38183610205565b5f61160e565b90926116403087610e56565b926001600160a01b0316803b1561010f57604051630f7c084960e21b8152600f93840b60048201529490920b602485015260448401525f60648401819052908390608490829084905af1918215610ee2576116aa926116b0575b506116a53085610e56565b6108f9565b90611558565b80610ffa5f6116be93610205565b5f61169a565b6116d0833033846112b7565b6124a1565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b9060206103c49281815201906116d5565b9192906117336117208490601482510180519252565b9390815191602080840193845101019052565b936001600160a01b03821661179f575b50505061176a6020915f9360405194858094819363313eeab560e11b8352600483016116f9565b03926001600160a01b03165af18015610ee2576117845750565b61179c9060203d602011610edb57610ed38183610205565b50565b9192917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561010f57604051633c6340f360e21b81526001600160a01b039283166004820152928216602484015290831660448301526064820193909352915f908390608490829084905af1908115610ee2575f9360209361176a93611835575b5093819350611743565b80610ffa8761184393610205565b5f61182b565b919082604091031261010f576020825192015190565b519067ffffffffffffffff8216820361010f57565b51906001600160801b038216820361010f57565b9081606091031261010f57604051906060820182811067ffffffffffffffff821117610227576118d99160409182526118c08161185f565b84526118ce6020820161185f565b602085015201611874565b604082015290565b9081604091031261010f57604051906040820182811067ffffffffffffffff821117610227576119229160209160405261191a81611874565b845201611874565b602082015290565b919060ff61194e6119418590600182510180519252565b9490601482510180519252565b931615611c30576001600160a01b0316308103611a415750604091905f906119a3856001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116908416610dfb565b835162ae511b60e21b81526001600160a01b0391821660048201527f000000000000000000000000000000000000000000000000000000000000000082166024820181905293909116604482015260648101949094525f6084850152839160a49183915af18015610ee257611a155750565b611a369060403d604011611a3a575b611a2e8183610205565b810190611849565b5050565b503d611a24565b3303611a8b57604091905f90611a86856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811690339085166112b7565b6119a3565b6040516370a0823160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660048201819052919350909190602081806024810103816001600160a01b0388165afa908115610ee2575f91611c11575b5060405163df23b45b60e01b81526001600160a01b038516600482015290606082602481875afa918215610ee257611b446040611b5694611b50935f91611be2575b5001516001600160801b031690565b6001600160801b031690565b90610a89565b60408051634ffe34db60e01b81526001600160a01b03861660048201529193829060249082905afa908115610ee257604093611ba9611b445f94611baf948691611bb5575b50516001600160801b031690565b906108f9565b936119a3565b611bd59150883d8a11611bdb575b611bcd8183610205565b8101906118e1565b5f611b9b565b503d611bc3565b611c04915060603d606011611c0a575b611bfc8183610205565b810190611888565b5f611b35565b503d611bf2565b611c2a915060203d602011610edb57610ed38183610205565b5f611af3565b91906001600160a01b03831615611d50577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561010f57604051633c6340f360e21b81526001600160a01b038381166004830152949094166024850152306044850152606484018590525f908490608490829084905af1928315610ee257604093611d3c575b505b825163097da6d360e41b81526001600160a01b039182166004820152306024820152911660448201525f60648201526084810192909252818060a4810103815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af18015610ee257611a155750565b80610ffa5f611d4a93610205565b5f611cc1565b604051633de222bb60e21b81526001600160a01b03821660048201523060248201529093509150602082806044810103817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa8015610ee2576040925f91611dc4575b5092611cc3565b611ddd915060203d602011610edb57610ed38183610205565b5f611dbd565b8051600101805190825292939293611e018290601482510180519252565b92600186811603611e965750508051601401805191529260021615611e48575b306001600160a01b03821603611e3657505050565b61098d926001600160a01b0316610dfb565b6001600160a01b038316803b1561010f575f8391600460405180948193630d0e30db60e41b83525af18015610ee257611e82575b50611e21565b80610ffa5f611e9093610205565b5f611e7c565b9150919360021615611eae575b505061098d91610dda565b6001600160a01b03163314611f1d575b6001600160a01b031691823b1561010f57604051632e1a7d4d60e01b815260048101839052925f908490602490829084905af1928315610ee25761098d93611f09575b819350611ea3565b80610ffa5f611f1793610205565b5f611f01565b611f328230336001600160a01b0385166112b7565b611ebe565b6001600160a01b039182168152911515602083015260408201929092529116606082015260a0608082018190526103c4929101906116d5565b15611f7757565b60405162461bcd60e51b8152602060048201526024808201527f526f75746550726f636573736f722e73776170556e6956333a20756e6578706560448201526318dd195960e21b6064820152608490fd5b9060409293915f611fdf8290601482510180519252565b9261200560ff611ff58590600182510180519252565b1615159390601482510180519252565b906001600160a01b03163314612102575b600280546001600160a01b0319166001600160a01b0386161790558282146120de5761208f6120656120736401000276a4995b89516001600160a01b0390911660208201529182906040820190565b03601f198101835282610205565b8751630251596160e31b81529889978896879560048701611f37565b03926001600160a01b03165af18015610ee2576120c0575b5060025461098d906001600160a01b0316600114611f70565b6120d89060403d604011611a3a57611a2e8183610205565b506120a7565b61208f61206561207373fffd8963efd1fc6a506488495d951d5263988d2599612049565b6121178530336001600160a01b038b166112b7565b612016565b51906001600160701b038216820361010f57565b9081606091031261010f576121448161211c565b9160406121536020840161211c565b92015163ffffffff8116810361010f5790565b1561216d57565b60405162461bcd60e51b815260206004820152601360248201527257726f6e6720706f6f6c20726573657276657360681b6044820152606490fd5b62ffffff16620f4240039062ffffff82116104f557565b90620f4240820291808304620f424014901517156104f557565b818102929181159184041417156104f557565b604051906121fb602083610205565b5f808352366020840137565b90926080926103c495948352602083015260018060a01b0316604082015281606082015201906116d5565b906122438290601482510180519252565b926122548390600182510180519252565b946122756122688590601482510180519252565b9490600382510180519252565b926001600160a01b0316308103612479575061229b90856001600160a01b038416610dfb565b604051630240bc6b60e21b81526001600160a01b0385169590916060836004818a5afa928315610ee2575f905f94612434575b5060ff6001600160701b0380600193169516938515158061242b575b6122f390612166565b161495861561241d5760209061233293925b6040516370a0823160e01b81526001600160a01b0390921660048301529093849190829081906024820190565b03916001600160a01b03165afa938415610ee25761238a6123836123909261237d61237561236f8961239b9b6123959a5f916123fe575b506108f9565b926121a8565b62ffffff1690565b906121d9565b92836121d9565b936121bf565b610a89565b9061137b565b91156123f7575f91925b6123ad6121ec565b93813b1561010f575f80946123d86040519788968795869463022c0d9f60e01b865260048601612207565b03925af18015610ee2576123e95750565b80610ffa5f61098d93610205565b5f926123a5565b612417915060203d602011610edb57610ed38183610205565b5f612369565b602090612332939492612305565b508415156122ea565b6001600160701b038095506001925061246660ff9260603d606011612472575b61245e8183610205565b810190612130565b509690935050506122ce565b503d612454565b3314612486575b5061229b565b61249b9085336001600160a01b0385166112b7565b5f612480565b90916124ae8184846125ce565b9283156124bc575b50505090565b60405163095ea7b360e01b602082019081526001600160a01b03831660248301525f604480840182905283529495509293919282916124fc606482610205565b5190826001600160a01b0388165af192612514610dab565b8461253e575b508361252c575b5050505f80806124b6565b61253693506125ce565b5f8080612521565b80519194508115918215612556575b5050925f61251a565b61256992506020809183010191016112fb565b5f8061254d565b90612594575080511561258557805190602001fd5b630a12f52160e11b5f5260045ffd5b815115806125c5575b6125a5575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561259d565b60405163095ea7b360e01b602082019081526001600160a01b03909316602482015260448101939093525f92839290839061260c8160648101612065565b51926001600160a01b03165af1612621610dab565b8161262a575090565b805180159250821561263b57505090565b6103c492506020809183010191016112fb56fea264697066735822122034840caaacdee9b2ae65d0b7739452422ea084f60a53b02dea2e83a7e812515564736f6c634300081a0033000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd64396600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a1d2fc16b435f91295420d40d6a98bb1302080d9000000000000000000000000475e053c171ff06fe555e536ff85148f6b053d29

Deployed Bytecode

0x6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c8063046f7da21461010057806323a69e75146100c45780632646478b146100fb5780632c8958f6146100c457806347f8bd41146100f65780636678ec1f146100f15780636b2ace87146100ec578063715018a6146100e75780638456cb59146100e25780638da5cb5b146100dd57806393b3774c146100d85780639a1f3406146100d3578063cd0fb7a7146100ce578063f2fde38b146100c95763fa461e330361000e575b6101c6565b61075f565b61071f565b6106c7565b610616565b6105ef565b610595565b61053e565b6104fa565b610466565b6103c7565b61028e565b610113565b5f91031261010f57565b5f80fd5b3461010f575f36600319011261010f575f546001600160a01b031633148015610155575b610140906107e8565b6002805460ff60a81b1916600160a81b179055005b50335f9081526001602052604090205460ff16610137565b90606060031983011261010f57600435916024359160443567ffffffffffffffff811161010f578260238201121561010f5780600401359267ffffffffffffffff841161010f576024848301011161010f576024019190565b3461010f576100186101d73661016d565b9291909161091b565b6001600160a01b0381160361010f57565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761022757604052565b6101f1565b67ffffffffffffffff811161022757601f01601f191660200190565b81601f8201121561010f5780359061025f8261022c565b9261026d6040519485610205565b8284526020838301011161010f57815f926020809301838601378301015290565b60c036600319011261010f576004356102a6816101e0565b60243590604435906102b7826101e0565b6084356064356102c6826101e0565b60a4359367ffffffffffffffff851161010f57610353956102ee610330963690600401610248565b94610313600160ff60025461030983838360a01c161461084d565b60a81c1614610899565b6002805460ff60a01b1916600160a11b179055610afa565b610afa565b6002805460ff60a01b1916600160a01b1790556040519081529081906020820190565b0390f35b9061010060031983011261010f57600435610371816101e0565b9160243591604435610382816101e0565b9160643591608435610393816101e0565b9160a4359160c4356103a4816101e0565b9160e4359067ffffffffffffffff821161010f576103c491600401610248565b90565b61043d6103d336610357565b966103f7600160ff60029994999895989796975461030983838360a01c161461084d565b6002805460ff60a01b1916600160a11b1790556001600160a01b0383811692911673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee830361045b5761032b9250610dda565b6002805460ff60a01b1916600160a01b179055604051908152602090f35b61032b9233906112b7565b6104c56104b561047536610357565b9183879561049b600160ff60029e9a969e9d989c9d5461030983838360a01c161461084d565b6002805460ff60a01b1916600160a11b1790553093610afa565b946001600160a01b031684610d4c565b82038281116104f5576020936104da92610d4c565b6002805460ff60a01b1916600160a01b179055604051908152f35b6108e5565b3461010f575f36600319011261010f576040517f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b03168152602090f35b3461010f575f36600319011261010f57610556610d85565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461010f575f36600319011261010f575f546001600160a01b0316331480156105d7575b6105c2906107e8565b6002805460ff60a81b1916600160a91b179055005b50335f9081526001602052604090205460ff166105b9565b3461010f575f36600319011261010f575f546040516001600160a01b039091168152602090f35b61010036600319011261010f5760043561062f816101e0565b6024356044359161063f836101e0565b60643560843561064e816101e0565b60a4359060c4359261065f846101e0565b60e4359667ffffffffffffffff881161010f5761032b6103309761068a6103539a3690600401610248565b976106a5600160ff60025461030983838360a01c161461084d565b6002805460ff60a01b1916600160a11b179055610dda565b8015150361010f57565b3461010f57604036600319011261010f576004356106e4816101e0565b602435906106f1826106bd565b6106f9610d85565b60018060a01b03165f52600160205260405f209060ff8019835416911515161790555f80f35b3461010f57602036600319011261010f5760043561073c816101e0565b60018060a01b03165f526001602052602060ff60405f2054166040519015158152f35b3461010f57602036600319011261010f5760043561077c816101e0565b610784610d85565b6001600160a01b031680156107d5575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b156107ef57565b60405162461bcd60e51b815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201526f10383934bb34b632b3b2b2103ab9b2b960811b6064820152608490fd5b1561085457565b60405162461bcd60e51b815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606490fd5b156108a057565b60405162461bcd60e51b815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606490fd5b634e487b7160e01b5f52601160045260245ffd5b919082039182116104f557565b9081602091031261010f57356103c4816101e0565b6002549293929091906001600160a01b03163303610a02575f8213156109fa5750905b5f82131561098f5761098861097c61097c61098d9561097260016bffffffffffffffffffffffff60a01b6002541617600255565b3394810190610906565b6001600160a01b031690565b610dfb565b565b60405162461bcd60e51b815260206004820152603960248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a206e6f7420706f73697469766520616d6f756e74000000000000006064820152608490fd5b90509061093e565b60405162461bcd60e51b815260206004820152603e60248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a2063616c6c2066726f6d20756e6b6e6f776e20736f7572636500006064820152608490fd5b5f1981146104f55760010190565b90600a82018092116104f557565b919082018092116104f557565b15610a9d57565b60405162461bcd60e51b815260206004820152602f60248201527f526f75746550726f636573736f723a204d696e696d616c20696e70757420626160448201526e3630b731b2903b34b7b630ba34b7b760891b6064820152608490fd5b929590939495610b0a3385610e56565b95610b158185610e56565b918692610b365f9a9060405191604083016040528083528051016020830152565b995b8a5160208c01511115610c4c57610b5e610b588c90600182510180519252565b60ff1690565b60018103610b915750610b708b611234565b8115610b87575b50610b82905b610a6d565b610b38565b9450610b82610b77565b60028103610ba85750610b8290610b7d8a8d61121e565b60038103610bba5750610b708b6111bd565b60048103610bd05750610b8290610b7d8c6110d7565b60058103610be65750610b8290610b7d8c611025565b600603610bfb57610b8290610b7d8c8a610ee7565b60405162461bcd60e51b8152602060048201526024808201527f526f75746550726f636573736f723a20556e6b6e6f776e20636f6d6d616e6420604482015263636f646560e01b6064820152608490fd5b50929695919498509296610c603383610e56565b6001600160a01b039092169573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed198701610d28575b505050610c968388610e56565b610ca08383610a89565b8110610d06577f2db5ddd0b42bdbca0d69ea16f234a870a485854ae0d91f16643d6f317d8b89949291610cd2916108f9565b604080516001600160a01b0395861681526020810197909752860191909152606085018190529590911692339190608090a4565b610d2591610d13916108f9565b63963b34a560e01b5f52600452602490565b5ffd5b610d38610d3d91610d4494610a89565b610a7b565b1015610a96565b5f8080610c89565b6001600160a01b0316919073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8303610d7c5761098d9250610dda565b61098d92610dfb565b5f546001600160a01b03163303610d9857565b63118cdaa760e01b5f523360045260245ffd5b3d15610dd5573d90610dbc8261022c565b91610dca6040519384610205565b82523d5f602084013e565b606090565b5f80809381935af1610dea610dab565b9015610df35750565b805190602001fd5b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261098d91610e37606483610205565b611310565b9081602091031261010f575190565b6040513d5f823e3d90fd5b6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8103610e7f57503190565b6040516370a0823160e01b81526001600160a01b039092166004830152602090829060249082905afa908115610ee2575f91610eb9575090565b6103c4915060203d602011610edb575b610ed38183610205565b810190610e3c565b503d610ec9565b610e4b565b8151602001805190835290610f028390602082510180519252565b90610f138490600182510180519252565b91610f34610f278690602082510180519252565b9590602082510180519252565b604051636eb1769f60e11b81523360048201523060248201526001600160a01b039390931692602081604481875afa8015610ee25786915f91611006575b5010610f81575b505050505050565b823b1561010f5760405163d505accf60e01b81523360048201523060248201526044810195909552606485019190915260ff92909216608484015260a483019390935260c4820152905f90829060e490829084905af18015610ee257610fec575b8080808080610f79565b80610ffa5f61100093610205565b80610105565b5f610fe2565b61101f915060203d602011610edb57610ed38183610205565b5f610f72565b80516014018051908252604051633de222bb60e21b81526001600160a01b03821660048201523060248201529190602083806044810103817f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b03165afa918215610ee25761098d935f936110b6575b5082806110ab575b503090611399565b5f190192505f6110a3565b6110d091935060203d602011610edb57610ed38183610205565b915f61109b565b601481510190815191815260ff6110f48290600182510180519252565b1680611107575061098d915f8092612232565b6001810361111c575061098d915f8092611fc8565b60028103611131575061098d915f8092611de3565b60038103611146575061098d915f809261192a565b6004810361115b575061098d915f809261170a565b60050361116e5761098d915f8092611462565b60405162461bcd60e51b815260206004820152602160248201527f526f75746550726f636573736f723a20556e6b6e6f776e20706f6f6c207479706044820152606560f81b6064820152608490fd5b90479182600182510191825192815260ff5f9316925b8381106111e05750505050565b60019061121861ffff8060028651018051908752168602048095039473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee30866113e9565b016111d3565b8051601401805190825261098d92913390611399565b805160140180519082526040516370a0823160e01b815230600482015292916020846024816001600160a01b0386165afa938415610ee2575f94611296575b508380611289575b5061098d9184913090611399565b5f1901935061098d61127b565b6112b091945060203d602011610edb57610ed38183610205565b925f611273565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815261098d91610e37608483610205565b9081602091031261010f57516103c4816106bd565b5f806113389260018060a01b03169360208151910182865af1611331610dab565b9083612570565b8051908115159182611360575b505061134e5750565b635274afe760e01b5f5260045260245ffd5b61137392506020809183010191016112fb565b155f80611345565b8115611385570490565b634e487b7160e01b5f52601260045260245ffd5b93929091600185510192835193865260ff5f9416935b8481106113bf5750505050509050565b6001906113e361ffff8060028b51018051908c52168702048096039585858b6113e9565b016113af565b92919060ff6113fe8590600182510180519252565b168061140e575061098d93612232565b60018103611420575061098d93611fc8565b60028103611432575061098d93611de3565b60038103611444575061098d9361192a565b60048103611456575061098d9361170a565b60050361116e5761098d935b9192906114758390601482510180519252565b906114868490600182510180519252565b6114a16114998690600182510180519252565b60ff165f0b90565b5f0b906114b76114998790600182510180519252565b5f0b926114da6114cd8890601482510180519252565b9790601482510180519252565b976001600160a01b03169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8203611595575050604051630f7c084960e21b8152600f92830b60048201529290910b602483015250604481018390525f60648201529160209183916084918391906001600160a01b03165af1908115610ee2575f91611576575b50905b306001600160a01b0382160361156d57505050565b61098d92610d4c565b61158f915060203d602011610edb57610ed38183610205565b5f611555565b60ff92916115b591889188916001600160a01b031633146116c4576124a1565b501661163457604051630f7c084960e21b8152600f91820b600482015291900b602482015260448101929092525f6064830181905260209183916084918391906001600160a01b03165af1908115610ee2575f91611615575b5090611558565b61162e915060203d602011610edb57610ed38183610205565b5f61160e565b90926116403087610e56565b926001600160a01b0316803b1561010f57604051630f7c084960e21b8152600f93840b60048201529490920b602485015260448401525f60648401819052908390608490829084905af1918215610ee2576116aa926116b0575b506116a53085610e56565b6108f9565b90611558565b80610ffa5f6116be93610205565b5f61169a565b6116d0833033846112b7565b6124a1565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b9060206103c49281815201906116d5565b9192906117336117208490601482510180519252565b9390815191602080840193845101019052565b936001600160a01b03821661179f575b50505061176a6020915f9360405194858094819363313eeab560e11b8352600483016116f9565b03926001600160a01b03165af18015610ee2576117845750565b61179c9060203d602011610edb57610ed38183610205565b50565b9192917f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b0316803b1561010f57604051633c6340f360e21b81526001600160a01b039283166004820152928216602484015290831660448301526064820193909352915f908390608490829084905af1908115610ee2575f9360209361176a93611835575b5093819350611743565b80610ffa8761184393610205565b5f61182b565b919082604091031261010f576020825192015190565b519067ffffffffffffffff8216820361010f57565b51906001600160801b038216820361010f57565b9081606091031261010f57604051906060820182811067ffffffffffffffff821117610227576118d99160409182526118c08161185f565b84526118ce6020820161185f565b602085015201611874565b604082015290565b9081604091031261010f57604051906040820182811067ffffffffffffffff821117610227576119229160209160405261191a81611874565b845201611874565b602082015290565b919060ff61194e6119418590600182510180519252565b9490601482510180519252565b931615611c30576001600160a01b0316308103611a415750604091905f906119a3856001600160a01b037f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439668116908416610dfb565b835162ae511b60e21b81526001600160a01b0391821660048201527f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd64396682166024820181905293909116604482015260648101949094525f6084850152839160a49183915af18015610ee257611a155750565b611a369060403d604011611a3a575b611a2e8183610205565b810190611849565b5050565b503d611a24565b3303611a8b57604091905f90611a86856001600160a01b037f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd643966811690339085166112b7565b6119a3565b6040516370a0823160e01b81527f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b031660048201819052919350909190602081806024810103816001600160a01b0388165afa908115610ee2575f91611c11575b5060405163df23b45b60e01b81526001600160a01b038516600482015290606082602481875afa918215610ee257611b446040611b5694611b50935f91611be2575b5001516001600160801b031690565b6001600160801b031690565b90610a89565b60408051634ffe34db60e01b81526001600160a01b03861660048201529193829060249082905afa908115610ee257604093611ba9611b445f94611baf948691611bb5575b50516001600160801b031690565b906108f9565b936119a3565b611bd59150883d8a11611bdb575b611bcd8183610205565b8101906118e1565b5f611b9b565b503d611bc3565b611c04915060603d606011611c0a575b611bfc8183610205565b810190611888565b5f611b35565b503d611bf2565b611c2a915060203d602011610edb57610ed38183610205565b5f611af3565b91906001600160a01b03831615611d50577f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b0316803b1561010f57604051633c6340f360e21b81526001600160a01b038381166004830152949094166024850152306044850152606484018590525f908490608490829084905af1928315610ee257604093611d3c575b505b825163097da6d360e41b81526001600160a01b039182166004820152306024820152911660448201525f60648201526084810192909252818060a4810103815f7f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b03165af18015610ee257611a155750565b80610ffa5f611d4a93610205565b5f611cc1565b604051633de222bb60e21b81526001600160a01b03821660048201523060248201529093509150602082806044810103817f000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd6439666001600160a01b03165afa8015610ee2576040925f91611dc4575b5092611cc3565b611ddd915060203d602011610edb57610ed38183610205565b5f611dbd565b8051600101805190825292939293611e018290601482510180519252565b92600186811603611e965750508051601401805191529260021615611e48575b306001600160a01b03821603611e3657505050565b61098d926001600160a01b0316610dfb565b6001600160a01b038316803b1561010f575f8391600460405180948193630d0e30db60e41b83525af18015610ee257611e82575b50611e21565b80610ffa5f611e9093610205565b5f611e7c565b9150919360021615611eae575b505061098d91610dda565b6001600160a01b03163314611f1d575b6001600160a01b031691823b1561010f57604051632e1a7d4d60e01b815260048101839052925f908490602490829084905af1928315610ee25761098d93611f09575b819350611ea3565b80610ffa5f611f1793610205565b5f611f01565b611f328230336001600160a01b0385166112b7565b611ebe565b6001600160a01b039182168152911515602083015260408201929092529116606082015260a0608082018190526103c4929101906116d5565b15611f7757565b60405162461bcd60e51b8152602060048201526024808201527f526f75746550726f636573736f722e73776170556e6956333a20756e6578706560448201526318dd195960e21b6064820152608490fd5b9060409293915f611fdf8290601482510180519252565b9261200560ff611ff58590600182510180519252565b1615159390601482510180519252565b906001600160a01b03163314612102575b600280546001600160a01b0319166001600160a01b0386161790558282146120de5761208f6120656120736401000276a4995b89516001600160a01b0390911660208201529182906040820190565b03601f198101835282610205565b8751630251596160e31b81529889978896879560048701611f37565b03926001600160a01b03165af18015610ee2576120c0575b5060025461098d906001600160a01b0316600114611f70565b6120d89060403d604011611a3a57611a2e8183610205565b506120a7565b61208f61206561207373fffd8963efd1fc6a506488495d951d5263988d2599612049565b6121178530336001600160a01b038b166112b7565b612016565b51906001600160701b038216820361010f57565b9081606091031261010f576121448161211c565b9160406121536020840161211c565b92015163ffffffff8116810361010f5790565b1561216d57565b60405162461bcd60e51b815260206004820152601360248201527257726f6e6720706f6f6c20726573657276657360681b6044820152606490fd5b62ffffff16620f4240039062ffffff82116104f557565b90620f4240820291808304620f424014901517156104f557565b818102929181159184041417156104f557565b604051906121fb602083610205565b5f808352366020840137565b90926080926103c495948352602083015260018060a01b0316604082015281606082015201906116d5565b906122438290601482510180519252565b926122548390600182510180519252565b946122756122688590601482510180519252565b9490600382510180519252565b926001600160a01b0316308103612479575061229b90856001600160a01b038416610dfb565b604051630240bc6b60e21b81526001600160a01b0385169590916060836004818a5afa928315610ee2575f905f94612434575b5060ff6001600160701b0380600193169516938515158061242b575b6122f390612166565b161495861561241d5760209061233293925b6040516370a0823160e01b81526001600160a01b0390921660048301529093849190829081906024820190565b03916001600160a01b03165afa938415610ee25761238a6123836123909261237d61237561236f8961239b9b6123959a5f916123fe575b506108f9565b926121a8565b62ffffff1690565b906121d9565b92836121d9565b936121bf565b610a89565b9061137b565b91156123f7575f91925b6123ad6121ec565b93813b1561010f575f80946123d86040519788968795869463022c0d9f60e01b865260048601612207565b03925af18015610ee2576123e95750565b80610ffa5f61098d93610205565b5f926123a5565b612417915060203d602011610edb57610ed38183610205565b5f612369565b602090612332939492612305565b508415156122ea565b6001600160701b038095506001925061246660ff9260603d606011612472575b61245e8183610205565b810190612130565b509690935050506122ce565b503d612454565b3314612486575b5061229b565b61249b9085336001600160a01b0385166112b7565b5f612480565b90916124ae8184846125ce565b9283156124bc575b50505090565b60405163095ea7b360e01b602082019081526001600160a01b03831660248301525f604480840182905283529495509293919282916124fc606482610205565b5190826001600160a01b0388165af192612514610dab565b8461253e575b508361252c575b5050505f80806124b6565b61253693506125ce565b5f8080612521565b80519194508115918215612556575b5050925f61251a565b61256992506020809183010191016112fb565b5f8061254d565b90612594575080511561258557805190602001fd5b630a12f52160e11b5f5260045ffd5b815115806125c5575b6125a5575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561259d565b60405163095ea7b360e01b602082019081526001600160a01b03909316602482015260448101939093525f92839290839061260c8160648101612065565b51926001600160a01b03165af1612621610dab565b8161262a575090565b805180159250821561263b57505090565b6103c492506020809183010191016112fb56fea264697066735822122034840caaacdee9b2ae65d0b7739452422ea084f60a53b02dea2e83a7e812515564736f6c634300081a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd64396600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a1d2fc16b435f91295420d40d6a98bb1302080d9000000000000000000000000475e053c171ff06fe555e536ff85148f6b053d29

-----Decoded View---------------
Arg [0] : _bentoBox (address): 0xF5BCE5077908a1b7370B9ae04AdC565EBd643966
Arg [1] : priviledgedUserList (address[]): 0xA1D2fc16b435F91295420D40d6a98bB1302080D9,0x475e053c171FF06FE555E536fF85148F6B053d29

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000f5bce5077908a1b7370b9ae04adc565ebd643966
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 000000000000000000000000a1d2fc16b435f91295420d40d6a98bb1302080d9
Arg [4] : 000000000000000000000000475e053c171ff06fe555e536ff85148f6b053d29


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.