APE Price: $1.27 (+8.55%)

Contract

0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55
Transaction Hash
Method
Block
From
To
Process Route Wi...51359962024-11-23 20:07:377 mins ago1732392457IN
0xf2614A23...3f1eb2c55
0.5 APE0.0045757425.42069
Process Route Wi...51359552024-11-23 20:07:048 mins ago1732392424IN
0xf2614A23...3f1eb2c55
0.5 APE0.0045757725.42069
Process Route Wi...51359292024-11-23 20:06:428 mins ago1732392402IN
0xf2614A23...3f1eb2c55
0.3 APE0.0046146625.42069
Process Route Wi...51358962024-11-23 20:06:199 mins ago1732392379IN
0xf2614A23...3f1eb2c55
1 APE0.0047143125.42069
Process Route Wi...51317042024-11-23 19:04:191 hr ago1732388659IN
0xf2614A23...3f1eb2c55
1.1 APE0.0074199625.42069
Process Route Wi...51283682024-11-23 18:18:591 hr ago1732385939IN
0xf2614A23...3f1eb2c55
1 APE0.0047144925.42069
Process Route Wi...51266912024-11-23 17:56:532 hrs ago1732384613IN
0xf2614A23...3f1eb2c55
0.01 APE0.0079057825.42069
Process Route51240612024-11-23 17:21:182 hrs ago1732382478IN
0xf2614A23...3f1eb2c55
0 APE0.0023609725.42069
Process Route Wi...51151372024-11-23 15:15:344 hrs ago1732374934IN
0xf2614A23...3f1eb2c55
0 APE0.0042296925.42069
Process Route Wi...51149532024-11-23 15:12:575 hrs ago1732374777IN
0xf2614A23...3f1eb2c55
0.0003 APE0.0042786825.42069
Process Route50858092024-11-23 7:22:0212 hrs ago1732346522IN
0xf2614A23...3f1eb2c55
126.14101019 APE0.0021624625.42069
Process Route50857692024-11-23 7:21:2012 hrs ago1732346480IN
0xf2614A23...3f1eb2c55
0 APE0.0023609725.42069
Process Route Wi...50794952024-11-23 5:35:0414 hrs ago1732340104IN
0xf2614A23...3f1eb2c55
200 APE0.0047143125.42069
Process Route50722162024-11-23 3:38:3016 hrs ago1732333110IN
0xf2614A23...3f1eb2c55
0 APE0.0023604625.42069
Process Route50695682024-11-23 3:00:2617 hrs ago1732330826IN
0xf2614A23...3f1eb2c55
0 APE0.002431225.42069
Process Route50691452024-11-23 2:54:3417 hrs ago1732330474IN
0xf2614A23...3f1eb2c55
50 APE0.0021614925.42069
Process Route50683072024-11-23 2:41:2617 hrs ago1732329686IN
0xf2614A23...3f1eb2c55
0 APE0.0024307225.42069
Process Route50682542024-11-23 2:40:2917 hrs ago1732329629IN
0xf2614A23...3f1eb2c55
0 APE0.0024302125.42069
Process Route50681702024-11-23 2:39:0417 hrs ago1732329544IN
0xf2614A23...3f1eb2c55
0 APE0.0024307225.42069
Process Route50668702024-11-23 2:21:3817 hrs ago1732328498IN
0xf2614A23...3f1eb2c55
0 APE0.0024297325.42069
Process Route50518222024-11-22 22:38:1121 hrs ago1732315091IN
0xf2614A23...3f1eb2c55
18 APE0.0021604725.42069
Process Route50088492024-11-22 15:41:4128 hrs ago1732290101IN
0xf2614A23...3f1eb2c55
0 APE0.0023609425.42069
Process Route49982032024-11-22 14:21:0329 hrs ago1732285263IN
0xf2614A23...3f1eb2c55
0 APE0.0024307225.42069
Process Route Wi...49831442024-11-22 11:20:0832 hrs ago1732274408IN
0xf2614A23...3f1eb2c55
0 APE0.0043527325.42069
Process Route49770342024-11-22 9:43:4834 hrs ago1732268628IN
0xf2614A23...3f1eb2c55
0 APE0.0024307225.42069
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
51359962024-11-23 20:07:377 mins ago1732392457
0xf2614A23...3f1eb2c55
0.5 APE
51359552024-11-23 20:07:048 mins ago1732392424
0xf2614A23...3f1eb2c55
0.5 APE
51359292024-11-23 20:06:428 mins ago1732392402
0xf2614A23...3f1eb2c55
0.3 APE
51358962024-11-23 20:06:199 mins ago1732392379
0xf2614A23...3f1eb2c55
1 APE
51317042024-11-23 19:04:191 hr ago1732388659
0xf2614A23...3f1eb2c55
1.1 APE
51283682024-11-23 18:18:591 hr ago1732385939
0xf2614A23...3f1eb2c55
1 APE
51266912024-11-23 17:56:532 hrs ago1732384613
0xf2614A23...3f1eb2c55
0.01 APE
51240612024-11-23 17:21:182 hrs ago1732382478
0xf2614A23...3f1eb2c55
20.55306968 APE
51240612024-11-23 17:21:182 hrs ago1732382478
0xf2614A23...3f1eb2c55
20.55306968 APE
51151372024-11-23 15:15:344 hrs ago1732374934
0xf2614A23...3f1eb2c55
99.63684155 APE
51151372024-11-23 15:15:344 hrs ago1732374934
0xf2614A23...3f1eb2c55
0.24846469 APE
51151372024-11-23 15:15:344 hrs ago1732374934
0xf2614A23...3f1eb2c55
0xf2614A23...3f1eb2c55
99.88530625 APE
51151372024-11-23 15:15:344 hrs ago1732374934
0xf2614A23...3f1eb2c55
99.88530625 APE
51149532024-11-23 15:12:575 hrs ago1732374777
0xf2614A23...3f1eb2c55
0.0003 APE
50858092024-11-23 7:22:0212 hrs ago1732346522
0xf2614A23...3f1eb2c55
126.14101019 APE
50857692024-11-23 7:21:2012 hrs ago1732346480
0xf2614A23...3f1eb2c55
132.00002983 APE
50857692024-11-23 7:21:2012 hrs ago1732346480
0xf2614A23...3f1eb2c55
132.00002983 APE
50794952024-11-23 5:35:0414 hrs ago1732340104
0xf2614A23...3f1eb2c55
200 APE
50722162024-11-23 3:38:3016 hrs ago1732333110
0xf2614A23...3f1eb2c55
12.37002627 APE
50722162024-11-23 3:38:3016 hrs ago1732333110
0xf2614A23...3f1eb2c55
12.37002627 APE
50695682024-11-23 3:00:2617 hrs ago1732330826
0xf2614A23...3f1eb2c55
52.22538238 APE
50695682024-11-23 3:00:2617 hrs ago1732330826
0xf2614A23...3f1eb2c55
52.22538238 APE
50691452024-11-23 2:54:3417 hrs ago1732330474
0xf2614A23...3f1eb2c55
50 APE
50683072024-11-23 2:41:2617 hrs ago1732329686
0xf2614A23...3f1eb2c55
25.3667 APE
50683072024-11-23 2:41:2617 hrs ago1732329686
0xf2614A23...3f1eb2c55
25.3667 APE
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RouteProcessor5

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 10000000 runs

Other Settings:
default evmVersion
File 1 of 16 : RouteProcessor5.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.10;

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";

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 Sushi Aggregator
/// @author Ilya Lyalin
contract RouteProcessor5 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) {
    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).safePermit(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 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. 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;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _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 3 of 16 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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.
 */
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].
     */
    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 4 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount
    ) external returns (bool);
}

File 5 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 16 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @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, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * 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.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @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`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

File 7 of 16 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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;
    }
}

File 8 of 16 : InputStream.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.10;

/** @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 9 of 16 : Utils.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.10;

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 10 of 16 : IBentoBoxMinimal.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity >=0.8.0;

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 11 of 16 : ICurve.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity >=0.8.0;

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 12 of 16 : IPool.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.5.0;
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 13 of 16 : ITridentCLPool.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.8.10;

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 14 of 16 : IUniswapV2Pair.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0;

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 15 of 16 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.8.10;

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 16 of 16 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.8.10;

interface IWETH {
  function deposit() external payable;

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

  function withdraw(uint256) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 10000000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": 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":"uint256","name":"amountOut","type":"uint256"}],"name":"MinimalOutputBalanceViolation","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"}]

60a06040526002805461ffff60a01b191661010160a01b1790553480156200002657600080fd5b50604051620040a3380380620040a383398101604081905262000049916200016e565b6200005433620000eb565b6001600160a01b038216608052600280546001600160a01b031916600117905560005b8151811015620000e25760018060008484815181106200009b576200009b62000257565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580620000d9816200026d565b91505062000077565b50505062000297565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200015357600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156200018257600080fd5b6200018d836200013b565b602084810151919350906001600160401b0380821115620001ad57600080fd5b818601915086601f830112620001c257600080fd5b815181811115620001d757620001d762000158565b8060051b604051601f19603f83011681018181108582111715620001ff57620001ff62000158565b6040529182528482019250838101850191898311156200021e57600080fd5b938501935b82851015620002475762000237856200013b565b8452938501939285019262000223565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200029057634e487b7160e01b600052601160045260246000fd5b5060010190565b608051613da3620003006000396000818161018d01528181611798015281816127380152818161279d01528181612807015281816128cc0152818161297901528181612a5d01528181612b6401528181612c1001528181612cdf0152612df10152613da36000f3fe6080604052600436106100ec5760003560e01c8063715018a61161008a5780639a1f3406116100595780639a1f34061461023c578063cd0fb7a71461025c578063f2fde38b1461029c578063fa461e33146102bc57600080fd5b8063715018a6146101d45780638456cb59146101e95780638da5cb5b146101fe57806393b3774c1461022957600080fd5b80632c8958f6116100c65780632c8958f61461010f57806347f8bd41146101555780636678ec1f146101685780636b2ace871461017b57600080fd5b8063046f7da2146100f857806323a69e751461010f5780632646478b1461012f57600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102dc565b005b34801561011b57600080fd5b5061010d61012a3660046135d4565b6103e4565b61014261013d366004613750565b6103f6565b6040519081526020015b60405180910390f35b6101426101633660046137d7565b6105a0565b6101426101763660046137d7565b61076e565b34801561018757600080fd5b506101af7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014c565b3480156101e057600080fd5b5061010d61091c565b3480156101f557600080fd5b5061010d610930565b34801561020a57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166101af565b6101426102373660046137d7565b610a33565b34801561024857600080fd5b5061010d61025736600461388a565b610ba4565b34801561026857600080fd5b5061028c6102773660046138c3565b60016020526000908152604090205460ff1681565b604051901515815260200161014c565b3480156102a857600080fd5b5061010d6102b73660046138c3565b610c02565b3480156102c857600080fd5b5061010d6102d73660046135d4565b610cb9565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061031157503360009081526001602052604090205460ff165b6103a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c6567656420757365720000000000000000000000000000000060648201526084015b60405180910390fd5b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b6103f084848484610cb9565b50505050565b60025460009074010000000000000000000000000000000000000000900460ff16600114610480576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff16600114610508576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674020000000000000000000000000000000000000000179055610555878787878787610e67565b9050600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790559695505050505050565b60025460009074010000000000000000000000000000000000000000900460ff1660011461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff166001146106b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167402000000000000000000000000000000000000000017905561071273ffffffffffffffffffffffffffffffffffffffff88168a8a61121d565b610720878787878787610e67565b90505b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905598975050505050505050565b60025460009074010000000000000000000000000000000000000000900460ff166001146107f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff16600114610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740200000000000000000000000000000000000000001790556108cd878787873087610e67565b90506108f073ffffffffffffffffffffffffffffffffffffffff86168a8a611280565b610723836108fe8a84613916565b73ffffffffffffffffffffffffffffffffffffffff88169190611280565b6109246112dd565b61092e600061135e565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061096557503360009081526001602052604090205460ff165b6109f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c656765642075736572000000000000000000000000000000006064820152608401610399565b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167502000000000000000000000000000000000000000000179055565b60025460009074010000000000000000000000000000000000000000900460ff16600114610abd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff16600114610b45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167402000000000000000000000000000000000000000017905561071273ffffffffffffffffffffffffffffffffffffffff8a16896113d3565b610bac6112dd565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b610c0a6112dd565b73ffffffffffffffffffffffffffffffffffffffff8116610cad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610399565b610cb68161135e565b50565b60025473ffffffffffffffffffffffffffffffffffffffff163314610d60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a2063616c6c2066726f6d20756e6b6e6f776e20736f7572636500006064820152608401610399565b6000808513610d6f5783610d71565b845b905060008113610e03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a206e6f7420706f73697469766520616d6f756e74000000000000006064820152608401610399565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001660011790556000610e3c838501856138c3565b9050610e5f73ffffffffffffffffffffffffffffffffffffffff82163384611445565b505050505050565b600080610e8a73ffffffffffffffffffffffffffffffffffffffff891633611519565b90506000610eae73ffffffffffffffffffffffffffffffffffffffff881686611519565b905087600080610ed287604080518082019091528181528151909101602082015290565b90505b805160208201511115611028576000610ef48280516001018051915290565b90508060ff1660011415610f1e576000610f0d83611604565b905083610f18578094505b50611017565b8060ff1660021415610f3957610f34828d6116c9565b611017565b8060ff1660031415610f50576000610f0d836116e9565b8060ff1660041415610f6557610f348261170f565b8060ff1660051415610f7a57610f3482611735565b8060ff1660061415610f9057610f348d8361183a565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f723a20556e6b6e6f776e20636f6d6d616e642060448201527f636f6465000000000000000000000000000000000000000000000000000000006064820152608401610399565b6110208361392d565b925050610ed5565b506000905061104d73ffffffffffffffffffffffffffffffffffffffff8c1633611519565b905073ffffffffffffffffffffffffffffffffffffffff8b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611124578361108b8b83613966565b61109690600a613966565b1015611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f526f75746550726f636573736f723a204d696e696d616c20696e70757420626160448201527f6c616e63652076696f6c6174696f6e00000000000000000000000000000000006064820152608401610399565b600061114673ffffffffffffffffffffffffffffffffffffffff8b1689611519565b90506111528985613966565b811015611198576111638482613916565b6040517f963b34a500000000000000000000000000000000000000000000000000000000815260040161039991815260200190565b6111a28482613916565b6040805173ffffffffffffffffffffffffffffffffffffffff8b81168252602082018790529181018c905260608101839052919750808c1691908e169033907f2db5ddd0b42bdbca0d69ea16f234a870a485854ae0d91f16643d6f317d8b89949060800160405180910390a450505050509695505050505050565b73ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561125e5761125982826113d3565b505050565b61125973ffffffffffffffffffffffffffffffffffffffff841633848461196a565b73ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156112bc5761125982826113d3565b61125973ffffffffffffffffffffffffffffffffffffffff84168383611445565b60005473ffffffffffffffffffffffffffffffffffffffff16331461092e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610399565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808373ffffffffffffffffffffffffffffffffffffffff168360405160006040518083038185875af1925050503d806000811461142e576040519150601f19603f3d011682016040523d82523d6000602084013e611433565b606091505b5091509150816103f057805181602001fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526112599084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526119c8565b600073ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561156b575073ffffffffffffffffffffffffffffffffffffffff8116316115fe565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301528416906370a0823190602401602060405180830381865afa1580156115d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fb919061397e565b90505b92915050565b6000806116178380516014018051915290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915073ffffffffffffffffffffffffffffffffffffffff8216906370a0823190602401602060405180830381865afa158015611684573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a8919061397e565b915081156116b7576001820391505b6116c383308385611ad4565b50919050565b60006116db8380516014018051915290565b905061125983338385611ad4565b4761170a823073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84611ad4565b919050565b60006117218280516014018051915290565b9050611731826000836000611b2f565b5050565b60006117478280516014018051915290565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301523060248301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa1580156117df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611803919061397e565b9050801561182e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b61125983308484611ad4565b600061184c8280516020018051915290565b905060006118608380516020018051915290565b905060006118748480516001018051915290565b905060006118888580516020018051915290565b9050600061189c8680516020018051915290565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152909150859073ffffffffffffffffffffffffffffffffffffffff89169063dd62ed3e90604401602060405180830381865afa158015611911573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611935919061397e565b10156119615761196173ffffffffffffffffffffffffffffffffffffffff881633308888888888611c63565b50505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526103f09085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611497565b6000611a2a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ee39092919063ffffffff16565b8051909150156112595780806020019051810190611a489190613997565b611259576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610399565b6000611ae68580516001018051915290565b905060005b8160ff16811015610e5f576000611b088780516002018051915290565b61ffff8082168602049485900394909150611b2588888884611b2f565b5050600101611aeb565b6000611b418580516001018051915290565b905060ff8116611b5c57611b5785858585611efa565b611c5c565b8060ff1660011415611b7457611b57858585856122af565b8060ff1660021415611b8c57611b57858585856124ef565b8060ff1660031415611ba457611b57858585856126cd565b8060ff1660041415611bbc57611b5785858585612d55565b8060ff1660051415611bd457611b5785858585612ee3565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f526f75746550726f636573736f723a20556e6b6e6f776e20706f6f6c2074797060448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610399565b5050505050565b6040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152600091908a1690637ecebe0090602401602060405180830381865afa158015611cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf7919061397e565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b158015611d9157600080fd5b505af1158015611da5573d6000803e3d6000fd5b50506040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015611e18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3c919061397e565b9050611e49826001613966565b8114611ed7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f742073756363656560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610399565b50505050505050505050565b6060611ef2848460008561329a565b949350505050565b6000611f0c8580516014018051915290565b90506000611f208680516001018051915290565b90506000611f348780516014018051915290565b90506000611f488880516003018051915290565b905073ffffffffffffffffffffffffffffffffffffffff8716301415611f8e57611f8973ffffffffffffffffffffffffffffffffffffffff87168587611445565b611fce565b73ffffffffffffffffffffffffffffffffffffffff8716331415611fce57611fce73ffffffffffffffffffffffffffffffffffffffff871633868861196a565b6000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561201c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204091906139d2565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000821180156120755750600081115b6120db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e6720706f6f6c207265736572766573000000000000000000000000006044820152606401610399565b6000808660ff166001146120f05782846120f3565b83835b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b8116600483015292945090925083918c16906370a0823190602401602060405180830381865afa158015612167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218b919061397e565b6121959190613916565b985060006121a686620f4240613a22565b6121b59062ffffff168b613a46565b90506000816121c785620f4240613a46565b6121d19190613966565b6121db8484613a46565b6121e59190613a83565b90506000808a60ff166001146121fd57826000612201565b6000835b604080516000815260208101918290527f022c0d9f00000000000000000000000000000000000000000000000000000000909152919350915073ffffffffffffffffffffffffffffffffffffffff8d169063022c0d9f9061226b90859085908f9060248101613b34565b600060405180830381600087803b15801561228557600080fd5b505af1158015612299573d6000803e3d6000fd5b5050505050505050505050505050505050505050565b60006122c18580516014018051915290565b90506000806122d68780516001018051915290565b60ff1611905060006122ee8780516014018051915290565b905073ffffffffffffffffffffffffffffffffffffffff86163314156123305761233073ffffffffffffffffffffffffffffffffffffffff861633308761196a565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851690811790915563128acb08828487816123a45761239f600173fffd8963efd1fc6a506488495d951d5263988d26613b6f565b6123b4565b6123b46401000276a36001613b9c565b6040805173ffffffffffffffffffffffffffffffffffffffff8d166020820152016040516020818303038152906040526040518663ffffffff1660e01b8152600401612404959493929190613bd4565b60408051808303816000875af1158015612422573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124469190613c1b565b505060025473ffffffffffffffffffffffffffffffffffffffff16600114611961576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f722e73776170556e6956333a20756e6578706560448201527f63746564000000000000000000000000000000000000000000000000000000006064820152608401610399565b60006125018580516001018051915290565b905060006125158680516014018051915290565b9050600180831614156125e45760006125348780516014018051915290565b9050600283166125a0578073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561258657600080fd5b505af115801561259a573d6000803e3d6000fd5b50505050505b73ffffffffffffffffffffffffffffffffffffffff821630146125de576125de73ffffffffffffffffffffffffffffffffffffffff82168386611445565b50610e5f565b600282166126ad5773ffffffffffffffffffffffffffffffffffffffff851633141561262c5761262c73ffffffffffffffffffffffffffffffffffffffff851633308661196a565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff851690632e1a7d4d90602401600060405180830381600087803b15801561269457600080fd5b505af11580156126a8573d6000803e3d6000fd5b505050505b610e5f73ffffffffffffffffffffffffffffffffffffffff8216846113d3565b60006126df8580516001018051915290565b905060006126f38680516014018051915290565b905060ff821615612aee5773ffffffffffffffffffffffffffffffffffffffff85163014156127625761275d73ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000085611445565b612a18565b73ffffffffffffffffffffffffffffffffffffffff85163314156127c25761275d73ffffffffffffffffffffffffffffffffffffffff8516337f00000000000000000000000000000000000000000000000000000000000000008661196a565b6040517f4ffe34db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f00000000000000000000000000000000000000000000000000000000000000001690634ffe34db906024016040805180830381865afa15801561284d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128719190613c5f565b516040517fdf23b45b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526fffffffffffffffffffffffffffffffff909216917f0000000000000000000000000000000000000000000000000000000000000000169063df23b45b90602401606060405180830381865afa158015612913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129379190613cd2565b60409081015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526fffffffffffffffffffffffffffffffff909216918716906370a0823190602401602060405180830381865afa1580156129dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a01919061397e565b612a0b9190613966565b612a159190613916565b92505b6040517f02b9446c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830181905290831660448301526064820185905260006084830152906302b9446c9060a40160408051808303816000875af1158015612ac3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae79190613c1b565b5050610e5f565b73ffffffffffffffffffffffffffffffffffffffff851615612bc5576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528681166024830152306044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612ba857600080fd5b505af1158015612bbc573d6000803e3d6000fd5b50505050612c7e565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015612c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c7b919061397e565b92505b6040517f97da6d3000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152306024830152828116604483015260006064830152608482018590527f000000000000000000000000000000000000000000000000000000000000000016906397da6d309060a40160408051808303816000875af1158015612d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4b9190613c1b565b5050505050505050565b6000612d678580516014018051915290565b85516020808201805190920101875290915073ffffffffffffffffffffffffffffffffffffffff851615612e4e576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015286811660248301528381166044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612e3557600080fd5b505af1158015612e49573d6000803e3d6000fd5b505050505b6040517f627dd56a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169063627dd56a90612ea0908490600401613d3e565b6020604051808303816000875af1158015612ebf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611961919061397e565b6000612ef58580516014018051915290565b90506000612f098680516001018051915290565b90506000612f1d8780516001018051915290565b60000b90506000612f348880516001018051915290565b60000b90506000612f4b8980516014018051915290565b90506000612f5f8a80516014018051915290565b9050600073ffffffffffffffffffffffffffffffffffffffff891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613048576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124908a9060840160206040518083038185885af115801561301c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613041919061397e565b905061324f565b73ffffffffffffffffffffffffffffffffffffffff8a163314156130885761308873ffffffffffffffffffffffffffffffffffffffff8a1633308b61196a565b6130a973ffffffffffffffffffffffffffffffffffffffff8a16888a6133b3565b5060ff861661315c576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124906084016020604051808303816000875af1158015613138573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613041919061397e565b600061317e73ffffffffffffffffffffffffffffffffffffffff841630611519565b6040517f3df02124000000000000000000000000000000000000000000000000000000008152600f88810b600483015287900b6024820152604481018b90526000606482015290915073ffffffffffffffffffffffffffffffffffffffff891690633df0212490608401600060405180830381600087803b15801561320257600080fd5b505af1158015613216573d6000803e3d6000fd5b506000925061323e91505073ffffffffffffffffffffffffffffffffffffffff851630611519565b905061324a8282613916565b925050505b73ffffffffffffffffffffffffffffffffffffffff8316301461328d5761328d73ffffffffffffffffffffffffffffffffffffffff83168483611280565b5050505050505050505050565b60608247101561332c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610399565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133559190613d51565b60006040518083038185875af1925050503d8060008114613392576040519150601f19603f3d011682016040523d82523d6000602084013e613397565b606091505b50915091506133a8878383876133e4565b979650505050505050565b60006133c0848484613481565b80611ef257506133d284846000613481565b8015611ef25750611ef2848484613481565b606083156134775782516134705773ffffffffffffffffffffffffffffffffffffffff85163b613470576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610399565b5081611ef2565b611ef28383613590565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839283929188169161351a9190613d51565b6000604051808303816000865af19150503d8060008114613557576040519150601f19603f3d011682016040523d82523d6000602084013e61355c565b606091505b50915091508180156135865750805115806135865750808060200190518101906135869190613997565b9695505050505050565b8151156135a05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103999190613d3e565b600080600080606085870312156135ea57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561361057600080fd5b818701915087601f83011261362457600080fd5b81358181111561363357600080fd5b88602082850101111561364557600080fd5b95989497505060200194505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610cb657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126136b657600080fd5b813567ffffffffffffffff808211156136d1576136d1613676565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561371757613717613676565b8160405283815286602085880101111561373057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c0878903121561376957600080fd5b863561377481613654565b955060208701359450604087013561378b81613654565b93506060870135925060808701356137a281613654565b915060a087013567ffffffffffffffff8111156137be57600080fd5b6137ca89828a016136a5565b9150509295509295509295565b600080600080600080600080610100898b0312156137f457600080fd5b88356137ff81613654565b975060208901359650604089013561381681613654565b955060608901359450608089013561382d81613654565b935060a0890135925060c089013561384481613654565b915060e089013567ffffffffffffffff81111561386057600080fd5b61386c8b828c016136a5565b9150509295985092959890939650565b8015158114610cb657600080fd5b6000806040838503121561389d57600080fd5b82356138a881613654565b915060208301356138b88161387c565b809150509250929050565b6000602082840312156138d557600080fd5b81356138e081613654565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015613928576139286138e7565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561395f5761395f6138e7565b5060010190565b60008219821115613979576139796138e7565b500190565b60006020828403121561399057600080fd5b5051919050565b6000602082840312156139a957600080fd5b81516138e08161387c565b80516dffffffffffffffffffffffffffff8116811461170a57600080fd5b6000806000606084860312156139e757600080fd5b6139f0846139b4565b92506139fe602085016139b4565b9150604084015163ffffffff81168114613a1757600080fd5b809150509250925092565b600062ffffff83811690831681811015613a3e57613a3e6138e7565b039392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a7e57613a7e6138e7565b500290565b600082613ab9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b83811015613ad9578181015183820152602001613ac1565b838111156103f05750506000910152565b60008151808452613b02816020860160208601613abe565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006135866080830184613aea565b600073ffffffffffffffffffffffffffffffffffffffff83811690831681811015613a3e57613a3e6138e7565b600073ffffffffffffffffffffffffffffffffffffffff808316818516808303821115613bcb57613bcb6138e7565b01949350505050565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a060808301526133a860a0830184613aea565b60008060408385031215613c2e57600080fd5b505080516020909101519092909150565b80516fffffffffffffffffffffffffffffffff8116811461170a57600080fd5b600060408284031215613c7157600080fd5b6040516040810181811067ffffffffffffffff82111715613c9457613c94613676565b604052613ca083613c3f565b8152613cae60208401613c3f565b60208201529392505050565b805167ffffffffffffffff8116811461170a57600080fd5b600060608284031215613ce457600080fd5b6040516060810181811067ffffffffffffffff82111715613d0757613d07613676565b604052613d1383613cba565b8152613d2160208401613cba565b6020820152613d3260408401613c3f565b60408201529392505050565b6020815260006138e06020830184613aea565b60008251613d63818460208701613abe565b919091019291505056fea26469706673582212209f3b5dd61e1718e28656003bdb1e93579bac1e86bdbff2eb5116c63421166cc164736f6c634300080a0033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106100ec5760003560e01c8063715018a61161008a5780639a1f3406116100595780639a1f34061461023c578063cd0fb7a71461025c578063f2fde38b1461029c578063fa461e33146102bc57600080fd5b8063715018a6146101d45780638456cb59146101e95780638da5cb5b146101fe57806393b3774c1461022957600080fd5b80632c8958f6116100c65780632c8958f61461010f57806347f8bd41146101555780636678ec1f146101685780636b2ace871461017b57600080fd5b8063046f7da2146100f857806323a69e751461010f5780632646478b1461012f57600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102dc565b005b34801561011b57600080fd5b5061010d61012a3660046135d4565b6103e4565b61014261013d366004613750565b6103f6565b6040519081526020015b60405180910390f35b6101426101633660046137d7565b6105a0565b6101426101763660046137d7565b61076e565b34801561018757600080fd5b506101af7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014c565b3480156101e057600080fd5b5061010d61091c565b3480156101f557600080fd5b5061010d610930565b34801561020a57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166101af565b6101426102373660046137d7565b610a33565b34801561024857600080fd5b5061010d61025736600461388a565b610ba4565b34801561026857600080fd5b5061028c6102773660046138c3565b60016020526000908152604090205460ff1681565b604051901515815260200161014c565b3480156102a857600080fd5b5061010d6102b73660046138c3565b610c02565b3480156102c857600080fd5b5061010d6102d73660046135d4565b610cb9565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061031157503360009081526001602052604090205460ff165b6103a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c6567656420757365720000000000000000000000000000000060648201526084015b60405180910390fd5b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b6103f084848484610cb9565b50505050565b60025460009074010000000000000000000000000000000000000000900460ff16600114610480576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff16600114610508576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674020000000000000000000000000000000000000000179055610555878787878787610e67565b9050600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790559695505050505050565b60025460009074010000000000000000000000000000000000000000900460ff1660011461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff166001146106b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167402000000000000000000000000000000000000000017905561071273ffffffffffffffffffffffffffffffffffffffff88168a8a61121d565b610720878787878787610e67565b90505b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905598975050505050505050565b60025460009074010000000000000000000000000000000000000000900460ff166001146107f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff16600114610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740200000000000000000000000000000000000000001790556108cd878787873087610e67565b90506108f073ffffffffffffffffffffffffffffffffffffffff86168a8a611280565b610723836108fe8a84613916565b73ffffffffffffffffffffffffffffffffffffffff88169190611280565b6109246112dd565b61092e600061135e565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061096557503360009081526001602052604090205460ff165b6109f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c656765642075736572000000000000000000000000000000006064820152608401610399565b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167502000000000000000000000000000000000000000000179055565b60025460009074010000000000000000000000000000000000000000900460ff16600114610abd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610399565b6002547501000000000000000000000000000000000000000000900460ff16600114610b45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610399565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167402000000000000000000000000000000000000000017905561071273ffffffffffffffffffffffffffffffffffffffff8a16896113d3565b610bac6112dd565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b610c0a6112dd565b73ffffffffffffffffffffffffffffffffffffffff8116610cad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610399565b610cb68161135e565b50565b60025473ffffffffffffffffffffffffffffffffffffffff163314610d60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a2063616c6c2066726f6d20756e6b6e6f776e20736f7572636500006064820152608401610399565b6000808513610d6f5783610d71565b845b905060008113610e03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a206e6f7420706f73697469766520616d6f756e74000000000000006064820152608401610399565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001660011790556000610e3c838501856138c3565b9050610e5f73ffffffffffffffffffffffffffffffffffffffff82163384611445565b505050505050565b600080610e8a73ffffffffffffffffffffffffffffffffffffffff891633611519565b90506000610eae73ffffffffffffffffffffffffffffffffffffffff881686611519565b905087600080610ed287604080518082019091528181528151909101602082015290565b90505b805160208201511115611028576000610ef48280516001018051915290565b90508060ff1660011415610f1e576000610f0d83611604565b905083610f18578094505b50611017565b8060ff1660021415610f3957610f34828d6116c9565b611017565b8060ff1660031415610f50576000610f0d836116e9565b8060ff1660041415610f6557610f348261170f565b8060ff1660051415610f7a57610f3482611735565b8060ff1660061415610f9057610f348d8361183a565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f723a20556e6b6e6f776e20636f6d6d616e642060448201527f636f6465000000000000000000000000000000000000000000000000000000006064820152608401610399565b6110208361392d565b925050610ed5565b506000905061104d73ffffffffffffffffffffffffffffffffffffffff8c1633611519565b905073ffffffffffffffffffffffffffffffffffffffff8b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611124578361108b8b83613966565b61109690600a613966565b1015611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f526f75746550726f636573736f723a204d696e696d616c20696e70757420626160448201527f6c616e63652076696f6c6174696f6e00000000000000000000000000000000006064820152608401610399565b600061114673ffffffffffffffffffffffffffffffffffffffff8b1689611519565b90506111528985613966565b811015611198576111638482613916565b6040517f963b34a500000000000000000000000000000000000000000000000000000000815260040161039991815260200190565b6111a28482613916565b6040805173ffffffffffffffffffffffffffffffffffffffff8b81168252602082018790529181018c905260608101839052919750808c1691908e169033907f2db5ddd0b42bdbca0d69ea16f234a870a485854ae0d91f16643d6f317d8b89949060800160405180910390a450505050509695505050505050565b73ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561125e5761125982826113d3565b505050565b61125973ffffffffffffffffffffffffffffffffffffffff841633848461196a565b73ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156112bc5761125982826113d3565b61125973ffffffffffffffffffffffffffffffffffffffff84168383611445565b60005473ffffffffffffffffffffffffffffffffffffffff16331461092e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610399565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808373ffffffffffffffffffffffffffffffffffffffff168360405160006040518083038185875af1925050503d806000811461142e576040519150601f19603f3d011682016040523d82523d6000602084013e611433565b606091505b5091509150816103f057805181602001fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526112599084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526119c8565b600073ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561156b575073ffffffffffffffffffffffffffffffffffffffff8116316115fe565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301528416906370a0823190602401602060405180830381865afa1580156115d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fb919061397e565b90505b92915050565b6000806116178380516014018051915290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915073ffffffffffffffffffffffffffffffffffffffff8216906370a0823190602401602060405180830381865afa158015611684573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a8919061397e565b915081156116b7576001820391505b6116c383308385611ad4565b50919050565b60006116db8380516014018051915290565b905061125983338385611ad4565b4761170a823073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84611ad4565b919050565b60006117218280516014018051915290565b9050611731826000836000611b2f565b5050565b60006117478280516014018051915290565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301523060248301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa1580156117df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611803919061397e565b9050801561182e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b61125983308484611ad4565b600061184c8280516020018051915290565b905060006118608380516020018051915290565b905060006118748480516001018051915290565b905060006118888580516020018051915290565b9050600061189c8680516020018051915290565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152909150859073ffffffffffffffffffffffffffffffffffffffff89169063dd62ed3e90604401602060405180830381865afa158015611911573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611935919061397e565b10156119615761196173ffffffffffffffffffffffffffffffffffffffff881633308888888888611c63565b50505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526103f09085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611497565b6000611a2a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ee39092919063ffffffff16565b8051909150156112595780806020019051810190611a489190613997565b611259576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610399565b6000611ae68580516001018051915290565b905060005b8160ff16811015610e5f576000611b088780516002018051915290565b61ffff8082168602049485900394909150611b2588888884611b2f565b5050600101611aeb565b6000611b418580516001018051915290565b905060ff8116611b5c57611b5785858585611efa565b611c5c565b8060ff1660011415611b7457611b57858585856122af565b8060ff1660021415611b8c57611b57858585856124ef565b8060ff1660031415611ba457611b57858585856126cd565b8060ff1660041415611bbc57611b5785858585612d55565b8060ff1660051415611bd457611b5785858585612ee3565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f526f75746550726f636573736f723a20556e6b6e6f776e20706f6f6c2074797060448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610399565b5050505050565b6040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152600091908a1690637ecebe0090602401602060405180830381865afa158015611cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf7919061397e565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b158015611d9157600080fd5b505af1158015611da5573d6000803e3d6000fd5b50506040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015611e18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3c919061397e565b9050611e49826001613966565b8114611ed7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f742073756363656560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610399565b50505050505050505050565b6060611ef2848460008561329a565b949350505050565b6000611f0c8580516014018051915290565b90506000611f208680516001018051915290565b90506000611f348780516014018051915290565b90506000611f488880516003018051915290565b905073ffffffffffffffffffffffffffffffffffffffff8716301415611f8e57611f8973ffffffffffffffffffffffffffffffffffffffff87168587611445565b611fce565b73ffffffffffffffffffffffffffffffffffffffff8716331415611fce57611fce73ffffffffffffffffffffffffffffffffffffffff871633868861196a565b6000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561201c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204091906139d2565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000821180156120755750600081115b6120db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e6720706f6f6c207265736572766573000000000000000000000000006044820152606401610399565b6000808660ff166001146120f05782846120f3565b83835b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b8116600483015292945090925083918c16906370a0823190602401602060405180830381865afa158015612167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218b919061397e565b6121959190613916565b985060006121a686620f4240613a22565b6121b59062ffffff168b613a46565b90506000816121c785620f4240613a46565b6121d19190613966565b6121db8484613a46565b6121e59190613a83565b90506000808a60ff166001146121fd57826000612201565b6000835b604080516000815260208101918290527f022c0d9f00000000000000000000000000000000000000000000000000000000909152919350915073ffffffffffffffffffffffffffffffffffffffff8d169063022c0d9f9061226b90859085908f9060248101613b34565b600060405180830381600087803b15801561228557600080fd5b505af1158015612299573d6000803e3d6000fd5b5050505050505050505050505050505050505050565b60006122c18580516014018051915290565b90506000806122d68780516001018051915290565b60ff1611905060006122ee8780516014018051915290565b905073ffffffffffffffffffffffffffffffffffffffff86163314156123305761233073ffffffffffffffffffffffffffffffffffffffff861633308761196a565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851690811790915563128acb08828487816123a45761239f600173fffd8963efd1fc6a506488495d951d5263988d26613b6f565b6123b4565b6123b46401000276a36001613b9c565b6040805173ffffffffffffffffffffffffffffffffffffffff8d166020820152016040516020818303038152906040526040518663ffffffff1660e01b8152600401612404959493929190613bd4565b60408051808303816000875af1158015612422573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124469190613c1b565b505060025473ffffffffffffffffffffffffffffffffffffffff16600114611961576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f722e73776170556e6956333a20756e6578706560448201527f63746564000000000000000000000000000000000000000000000000000000006064820152608401610399565b60006125018580516001018051915290565b905060006125158680516014018051915290565b9050600180831614156125e45760006125348780516014018051915290565b9050600283166125a0578073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561258657600080fd5b505af115801561259a573d6000803e3d6000fd5b50505050505b73ffffffffffffffffffffffffffffffffffffffff821630146125de576125de73ffffffffffffffffffffffffffffffffffffffff82168386611445565b50610e5f565b600282166126ad5773ffffffffffffffffffffffffffffffffffffffff851633141561262c5761262c73ffffffffffffffffffffffffffffffffffffffff851633308661196a565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff851690632e1a7d4d90602401600060405180830381600087803b15801561269457600080fd5b505af11580156126a8573d6000803e3d6000fd5b505050505b610e5f73ffffffffffffffffffffffffffffffffffffffff8216846113d3565b60006126df8580516001018051915290565b905060006126f38680516014018051915290565b905060ff821615612aee5773ffffffffffffffffffffffffffffffffffffffff85163014156127625761275d73ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000085611445565b612a18565b73ffffffffffffffffffffffffffffffffffffffff85163314156127c25761275d73ffffffffffffffffffffffffffffffffffffffff8516337f00000000000000000000000000000000000000000000000000000000000000008661196a565b6040517f4ffe34db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f00000000000000000000000000000000000000000000000000000000000000001690634ffe34db906024016040805180830381865afa15801561284d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128719190613c5f565b516040517fdf23b45b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526fffffffffffffffffffffffffffffffff909216917f0000000000000000000000000000000000000000000000000000000000000000169063df23b45b90602401606060405180830381865afa158015612913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129379190613cd2565b60409081015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526fffffffffffffffffffffffffffffffff909216918716906370a0823190602401602060405180830381865afa1580156129dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a01919061397e565b612a0b9190613966565b612a159190613916565b92505b6040517f02b9446c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830181905290831660448301526064820185905260006084830152906302b9446c9060a40160408051808303816000875af1158015612ac3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae79190613c1b565b5050610e5f565b73ffffffffffffffffffffffffffffffffffffffff851615612bc5576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528681166024830152306044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612ba857600080fd5b505af1158015612bbc573d6000803e3d6000fd5b50505050612c7e565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015612c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c7b919061397e565b92505b6040517f97da6d3000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152306024830152828116604483015260006064830152608482018590527f000000000000000000000000000000000000000000000000000000000000000016906397da6d309060a40160408051808303816000875af1158015612d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4b9190613c1b565b5050505050505050565b6000612d678580516014018051915290565b85516020808201805190920101875290915073ffffffffffffffffffffffffffffffffffffffff851615612e4e576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015286811660248301528381166044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612e3557600080fd5b505af1158015612e49573d6000803e3d6000fd5b505050505b6040517f627dd56a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169063627dd56a90612ea0908490600401613d3e565b6020604051808303816000875af1158015612ebf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611961919061397e565b6000612ef58580516014018051915290565b90506000612f098680516001018051915290565b90506000612f1d8780516001018051915290565b60000b90506000612f348880516001018051915290565b60000b90506000612f4b8980516014018051915290565b90506000612f5f8a80516014018051915290565b9050600073ffffffffffffffffffffffffffffffffffffffff891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613048576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124908a9060840160206040518083038185885af115801561301c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613041919061397e565b905061324f565b73ffffffffffffffffffffffffffffffffffffffff8a163314156130885761308873ffffffffffffffffffffffffffffffffffffffff8a1633308b61196a565b6130a973ffffffffffffffffffffffffffffffffffffffff8a16888a6133b3565b5060ff861661315c576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124906084016020604051808303816000875af1158015613138573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613041919061397e565b600061317e73ffffffffffffffffffffffffffffffffffffffff841630611519565b6040517f3df02124000000000000000000000000000000000000000000000000000000008152600f88810b600483015287900b6024820152604481018b90526000606482015290915073ffffffffffffffffffffffffffffffffffffffff891690633df0212490608401600060405180830381600087803b15801561320257600080fd5b505af1158015613216573d6000803e3d6000fd5b506000925061323e91505073ffffffffffffffffffffffffffffffffffffffff851630611519565b905061324a8282613916565b925050505b73ffffffffffffffffffffffffffffffffffffffff8316301461328d5761328d73ffffffffffffffffffffffffffffffffffffffff83168483611280565b5050505050505050505050565b60608247101561332c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610399565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133559190613d51565b60006040518083038185875af1925050503d8060008114613392576040519150601f19603f3d011682016040523d82523d6000602084013e613397565b606091505b50915091506133a8878383876133e4565b979650505050505050565b60006133c0848484613481565b80611ef257506133d284846000613481565b8015611ef25750611ef2848484613481565b606083156134775782516134705773ffffffffffffffffffffffffffffffffffffffff85163b613470576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610399565b5081611ef2565b611ef28383613590565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839283929188169161351a9190613d51565b6000604051808303816000865af19150503d8060008114613557576040519150601f19603f3d011682016040523d82523d6000602084013e61355c565b606091505b50915091508180156135865750805115806135865750808060200190518101906135869190613997565b9695505050505050565b8151156135a05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103999190613d3e565b600080600080606085870312156135ea57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561361057600080fd5b818701915087601f83011261362457600080fd5b81358181111561363357600080fd5b88602082850101111561364557600080fd5b95989497505060200194505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610cb657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126136b657600080fd5b813567ffffffffffffffff808211156136d1576136d1613676565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561371757613717613676565b8160405283815286602085880101111561373057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c0878903121561376957600080fd5b863561377481613654565b955060208701359450604087013561378b81613654565b93506060870135925060808701356137a281613654565b915060a087013567ffffffffffffffff8111156137be57600080fd5b6137ca89828a016136a5565b9150509295509295509295565b600080600080600080600080610100898b0312156137f457600080fd5b88356137ff81613654565b975060208901359650604089013561381681613654565b955060608901359450608089013561382d81613654565b935060a0890135925060c089013561384481613654565b915060e089013567ffffffffffffffff81111561386057600080fd5b61386c8b828c016136a5565b9150509295985092959890939650565b8015158114610cb657600080fd5b6000806040838503121561389d57600080fd5b82356138a881613654565b915060208301356138b88161387c565b809150509250929050565b6000602082840312156138d557600080fd5b81356138e081613654565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015613928576139286138e7565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561395f5761395f6138e7565b5060010190565b60008219821115613979576139796138e7565b500190565b60006020828403121561399057600080fd5b5051919050565b6000602082840312156139a957600080fd5b81516138e08161387c565b80516dffffffffffffffffffffffffffff8116811461170a57600080fd5b6000806000606084860312156139e757600080fd5b6139f0846139b4565b92506139fe602085016139b4565b9150604084015163ffffffff81168114613a1757600080fd5b809150509250925092565b600062ffffff83811690831681811015613a3e57613a3e6138e7565b039392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a7e57613a7e6138e7565b500290565b600082613ab9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b83811015613ad9578181015183820152602001613ac1565b838111156103f05750506000910152565b60008151808452613b02816020860160208601613abe565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006135866080830184613aea565b600073ffffffffffffffffffffffffffffffffffffffff83811690831681811015613a3e57613a3e6138e7565b600073ffffffffffffffffffffffffffffffffffffffff808316818516808303821115613bcb57613bcb6138e7565b01949350505050565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a060808301526133a860a0830184613aea565b60008060408385031215613c2e57600080fd5b505080516020909101519092909150565b80516fffffffffffffffffffffffffffffffff8116811461170a57600080fd5b600060408284031215613c7157600080fd5b6040516040810181811067ffffffffffffffff82111715613c9457613c94613676565b604052613ca083613c3f565b8152613cae60208401613c3f565b60208201529392505050565b805167ffffffffffffffff8116811461170a57600080fd5b600060608284031215613ce457600080fd5b6040516060810181811067ffffffffffffffff82111715613d0757613d07613676565b604052613d1383613cba565b8152613d2160208401613cba565b6020820152613d3260408401613c3f565b60408201529392505050565b6020815260006138e06020830184613aea565b60008251613d63818460208701613abe565b919091019291505056fea26469706673582212209f3b5dd61e1718e28656003bdb1e93579bac1e86bdbff2eb5116c63421166cc164736f6c634300080a0033

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

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _bentoBox (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000


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
[ 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.