/

SMART CONTRACT on

c
0xF7b1e993d1b4F7348D64Aa55A294E4B74512F7f2
undefined: Router

Baguette: Router Contract

Last Transaction

0xd61a0192553e897edade76a72e157e830aafd8bf8e4219f9018d1b3a04731eaa
From
0xf5C1bbf4F739bDD0DBB8882517417263509453B0
To
Baguette: Router
a minute
Tue, 19 Oct 2021 08:29:47 GMT
1.50AVAX

AVAX balance

0

2 Tokens

Amount Estimated USD value
NEKO Token 265,500,425,622.61002 NEKO 24.12USD
TangleV3 0.000000001 TNGLv3 0.00USD

Contract Properties

Language
Solidity
Compiler Version
v0.6.6+commit.6c089d02
Source Code
Available and Matching

Compiler settings

{
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "BaguetteRouter.sol": {
      "BaguetteRouter": [
        "*"
      ]
    }
  }
}

ABI

[
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_factory",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "_WAVAX",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "inputs": [],
    "name": "WAVAX",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "tokenA",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "tokenB",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amountADesired",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountBDesired",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountBMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "addLiquidity",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountA",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountB",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amountTokenDesired",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountTokenMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAXMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "addLiquidityAVAX",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountToken",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAX",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "factory",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOut",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "reserveIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "reserveOut",
        "type": "uint256"
      }
    ],
    "name": "getAmountIn",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "reserveIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "reserveOut",
        "type": "uint256"
      }
    ],
    "name": "getAmountOut",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountOut",
        "type": "uint256"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOut",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      }
    ],
    "name": "getAmountsIn",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      }
    ],
    "name": "getAmountsOut",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountA",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "reserveA",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "reserveB",
        "type": "uint256"
      }
    ],
    "name": "quote",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountB",
        "type": "uint256"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "tokenA",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "tokenB",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountBMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "removeLiquidity",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountA",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountB",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountTokenMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAXMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "removeLiquidityAVAX",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountToken",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAX",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountTokenMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAXMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "removeLiquidityAVAXSupportingFeeOnTransferTokens",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountAVAX",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountTokenMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAXMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      },
      {
        "internalType": "bool",
        "name": "approveMax",
        "type": "bool"
      },
      {
        "internalType": "uint8",
        "name": "v",
        "type": "uint8"
      },
      {
        "internalType": "bytes32",
        "name": "r",
        "type": "bytes32"
      },
      {
        "internalType": "bytes32",
        "name": "s",
        "type": "bytes32"
      }
    ],
    "name": "removeLiquidityAVAXWithPermit",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountToken",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAX",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountTokenMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAVAXMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      },
      {
        "internalType": "bool",
        "name": "approveMax",
        "type": "bool"
      },
      {
        "internalType": "uint8",
        "name": "v",
        "type": "uint8"
      },
      {
        "internalType": "bytes32",
        "name": "r",
        "type": "bytes32"
      },
      {
        "internalType": "bytes32",
        "name": "s",
        "type": "bytes32"
      }
    ],
    "name": "removeLiquidityAVAXWithPermitSupportingFeeOnTransferTokens",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountAVAX",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "tokenA",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "tokenB",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "liquidity",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountAMin",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountBMin",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      },
      {
        "internalType": "bool",
        "name": "approveMax",
        "type": "bool"
      },
      {
        "internalType": "uint8",
        "name": "v",
        "type": "uint8"
      },
      {
        "internalType": "bytes32",
        "name": "r",
        "type": "bytes32"
      },
      {
        "internalType": "bytes32",
        "name": "s",
        "type": "bytes32"
      }
    ],
    "name": "removeLiquidityWithPermit",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "amountA",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountB",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOut",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapAVAXForExactTokens",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOutMin",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapExactAVAXForTokens",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOutMin",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapExactAVAXForTokensSupportingFeeOnTransferTokens",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountOutMin",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapExactTokensForAVAX",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountOutMin",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapExactTokensForAVAXSupportingFeeOnTransferTokens",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountOutMin",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapExactTokensForTokens",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountIn",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountOutMin",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOut",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountInMax",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapTokensForExactAVAX",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amountOut",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amountInMax",
        "type": "uint256"
      },
      {
        "internalType": "address[]",
        "name": "path",
        "type": "address[]"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "deadline",
        "type": "uint256"
      }
    ],
    "name": "swapTokensForExactTokens",
    "outputs": [
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "stateMutability": "payable",
    "type": "receive"
  }
]

Contract Source Code

BaguetteRouter.sol

BaguetteRouter.sol

// Sources flattened with hardhat v2.1.1 https://hardhat.org

// File contracts/baguette-core/interfaces/IBaguetteFactory.sol

pragma solidity >=0.5.0;

interface IBaguetteFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}


// File contracts/baguette-lib/libraries/TransferHelper.sol

// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending AVAX that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferAVAX(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'TransferHelper: AVAX_TRANSFER_FAILED');
    }
}


// File contracts/baguette-periphery/interfaces/IBaguetteRouter.sol

pragma solidity >=0.6.2;

interface IBaguetteRouter {
    function factory() external pure returns (address);
    function WAVAX() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityAVAX(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountAVAX, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityAVAX(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountAVAX);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityAVAXWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountAVAX);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactAVAXForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactAVAX(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForAVAX(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapAVAXForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);

    function removeLiquidityAVAXSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline
    ) external returns (uint amountAVAX);
    function removeLiquidityAVAXWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountAVAX);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactAVAXForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForAVAXSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}


// File contracts/baguette-core/interfaces/IBaguettePair.sol

pragma solidity >=0.5.0;

interface IBaguettePair {
    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 contracts/baguette-periphery/libraries/SafeMath.sol

pragma solidity =0.6.6;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }
}


// File contracts/baguette-periphery/libraries/BaguetteLibrary.sol

pragma solidity >=0.5.0;


library BaguetteLibrary {
    using SafeMath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'BaguetteLibrary: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'BaguetteLibrary: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'81dbf51ab39dc634785936a3b34def28bf8007e6dfa30d4284c4b8547cb47a51' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IBaguettePair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'BaguetteLibrary: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'BaguetteLibrary: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'BaguetteLibrary: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'BaguetteLibrary: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'BaguetteLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'BaguetteLibrary: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'BaguetteLibrary: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'BaguetteLibrary: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}


// File contracts/baguette-periphery/interfaces/IERC20.sol

pragma solidity >=0.5.0;

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

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view 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);
}


// File contracts/baguette-periphery/interfaces/IWAVAX.sol

pragma solidity >=0.5.0;

interface IWAVAX {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}


// File contracts/baguette-periphery/BaguetteRouter.sol

pragma solidity =0.6.6;






contract BaguetteRouter is IBaguetteRouter {
    using SafeMath for uint;

    address public immutable override factory;
    address public immutable override WAVAX;

    modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'BaguetteRouter: EXPIRED');
        _;
    }

    constructor(address _factory, address _WAVAX) public {
        factory = _factory;
        WAVAX = _WAVAX;
    }

    receive() external payable {
        assert(msg.sender == WAVAX); // only accept AVAX via fallback from the WAVAX contract
    }

    // **** ADD LIQUIDITY ****
    function _addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin
    ) internal virtual returns (uint amountA, uint amountB) {
        // create the pair if it doesn't exist yet
        if (IBaguetteFactory(factory).getPair(tokenA, tokenB) == address(0)) {
            IBaguetteFactory(factory).createPair(tokenA, tokenB);
        }
        (uint reserveA, uint reserveB) = BaguetteLibrary.getReserves(factory, tokenA, tokenB);
        if (reserveA == 0 && reserveB == 0) {
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint amountBOptimal = BaguetteLibrary.quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                require(amountBOptimal >= amountBMin, 'BaguetteRouter: INSUFFICIENT_B_AMOUNT');
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint amountAOptimal = BaguetteLibrary.quote(amountBDesired, reserveB, reserveA);
                assert(amountAOptimal <= amountADesired);
                require(amountAOptimal >= amountAMin, 'BaguetteRouter: INSUFFICIENT_A_AMOUNT');
                (amountA, amountB) = (amountAOptimal, amountBDesired);
            }
        }
    }
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
        (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);
        address pair = BaguetteLibrary.pairFor(factory, tokenA, tokenB);
        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
        liquidity = IBaguettePair(pair).mint(to);
    }
    function addLiquidityAVAX(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline
    ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountAVAX, uint liquidity) {
        (amountToken, amountAVAX) = _addLiquidity(
            token,
            WAVAX,
            amountTokenDesired,
            msg.value,
            amountTokenMin,
            amountAVAXMin
        );
        address pair = BaguetteLibrary.pairFor(factory, token, WAVAX);
        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
        IWAVAX(WAVAX).deposit{value: amountAVAX}();
        assert(IWAVAX(WAVAX).transfer(pair, amountAVAX));
        liquidity = IBaguettePair(pair).mint(to);
        // refund dust AVAX, if any
        if (msg.value > amountAVAX) TransferHelper.safeTransferAVAX(msg.sender, msg.value - amountAVAX);
    }

    // **** REMOVE LIQUIDITY ****
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
        address pair = BaguetteLibrary.pairFor(factory, tokenA, tokenB);
        IBaguettePair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair
        (uint amount0, uint amount1) = IBaguettePair(pair).burn(to);
        (address token0,) = BaguetteLibrary.sortTokens(tokenA, tokenB);
        (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);
        require(amountA >= amountAMin, 'BaguetteRouter: INSUFFICIENT_A_AMOUNT');
        require(amountB >= amountBMin, 'BaguetteRouter: INSUFFICIENT_B_AMOUNT');
    }
    function removeLiquidityAVAX(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountToken, uint amountAVAX) {
        (amountToken, amountAVAX) = removeLiquidity(
            token,
            WAVAX,
            liquidity,
            amountTokenMin,
            amountAVAXMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, amountToken);
        IWAVAX(WAVAX).withdraw(amountAVAX);
        TransferHelper.safeTransferAVAX(to, amountAVAX);
    }
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountA, uint amountB) {
        address pair = BaguetteLibrary.pairFor(factory, tokenA, tokenB);
        uint value = approveMax ? uint(-1) : liquidity;
        IBaguettePair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);
    }
    function removeLiquidityAVAXWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountToken, uint amountAVAX) {
        address pair = BaguetteLibrary.pairFor(factory, token, WAVAX);
        uint value = approveMax ? uint(-1) : liquidity;
        IBaguettePair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        (amountToken, amountAVAX) = removeLiquidityAVAX(token, liquidity, amountTokenMin, amountAVAXMin, to, deadline);
    }

    // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****
    function removeLiquidityAVAXSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountAVAX) {
        (, amountAVAX) = removeLiquidity(
            token,
            WAVAX,
            liquidity,
            amountTokenMin,
            amountAVAXMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, IERC20(token).balanceOf(address(this)));
        IWAVAX(WAVAX).withdraw(amountAVAX);
        TransferHelper.safeTransferAVAX(to, amountAVAX);
    }
    function removeLiquidityAVAXWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountAVAXMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountAVAX) {
        address pair = BaguetteLibrary.pairFor(factory, token, WAVAX);
        uint value = approveMax ? uint(-1) : liquidity;
        IBaguettePair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        amountAVAX = removeLiquidityAVAXSupportingFeeOnTransferTokens(
            token, liquidity, amountTokenMin, amountAVAXMin, to, deadline
        );
    }

    // **** SWAP ****
    // requires the initial amount to have already been sent to the first pair
    function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0,) = BaguetteLibrary.sortTokens(input, output);
            uint amountOut = amounts[i + 1];
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
            address to = i < path.length - 2 ? BaguetteLibrary.pairFor(factory, output, path[i + 2]) : _to;
            IBaguettePair(BaguetteLibrary.pairFor(factory, input, output)).swap(
                amount0Out, amount1Out, to, new bytes(0)
            );
        }
    }
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        amounts = BaguetteLibrary.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'BaguetteRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, BaguetteLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to);
    }
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        amounts = BaguetteLibrary.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= amountInMax, 'BaguetteRouter: EXCESSIVE_INPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, BaguetteLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to);
    }
    function swapExactAVAXForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        payable
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[0] == WAVAX, 'BaguetteRouter: INVALID_PATH');
        amounts = BaguetteLibrary.getAmountsOut(factory, msg.value, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'BaguetteRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        IWAVAX(WAVAX).deposit{value: amounts[0]}();
        assert(IWAVAX(WAVAX).transfer(BaguetteLibrary.pairFor(factory, path[0], path[1]), amounts[0]));
        _swap(amounts, path, to);
    }
    function swapTokensForExactAVAX(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WAVAX, 'BaguetteRouter: INVALID_PATH');
        amounts = BaguetteLibrary.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= amountInMax, 'BaguetteRouter: EXCESSIVE_INPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, BaguetteLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this));
        IWAVAX(WAVAX).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferAVAX(to, amounts[amounts.length - 1]);
    }
    function swapExactTokensForAVAX(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WAVAX, 'BaguetteRouter: INVALID_PATH');
        amounts = BaguetteLibrary.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'BaguetteRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, BaguetteLibrary.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this));
        IWAVAX(WAVAX).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferAVAX(to, amounts[amounts.length - 1]);
    }
    function swapAVAXForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        payable
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[0] == WAVAX, 'BaguetteRouter: INVALID_PATH');
        amounts = BaguetteLibrary.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= msg.value, 'BaguetteRouter: EXCESSIVE_INPUT_AMOUNT');
        IWAVAX(WAVAX).deposit{value: amounts[0]}();
        assert(IWAVAX(WAVAX).transfer(BaguetteLibrary.pairFor(factory, path[0], path[1]), amounts[0]));
        _swap(amounts, path, to);
        // refund dust AVAX, if any
        if (msg.value > amounts[0]) TransferHelper.safeTransferAVAX(msg.sender, msg.value - amounts[0]);
    }

    // **** SWAP (supporting fee-on-transfer tokens) ****
    // requires the initial amount to have already been sent to the first pair
    function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0,) = BaguetteLibrary.sortTokens(input, output);
            IBaguettePair pair = IBaguettePair(BaguetteLibrary.pairFor(factory, input, output));
            uint amountInput;
            uint amountOutput;
            { // scope to avoid stack too deep errors
            (uint reserve0, uint reserve1,) = pair.getReserves();
            (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
            amountInput = IERC20(input).balanceOf(address(pair)).sub(reserveInput);
            amountOutput = BaguetteLibrary.getAmountOut(amountInput, reserveInput, reserveOutput);
            }
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));
            address to = i < path.length - 2 ? BaguetteLibrary.pairFor(factory, output, path[i + 2]) : _to;
            pair.swap(amount0Out, amount1Out, to, new bytes(0));
        }
    }
    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) {
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, BaguetteLibrary.pairFor(factory, path[0], path[1]), amountIn
        );
        uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to);
        _swapSupportingFeeOnTransferTokens(path, to);
        require(
            IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
            'BaguetteRouter: INSUFFICIENT_OUTPUT_AMOUNT'
        );
    }
    function swapExactAVAXForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    )
        external
        virtual
        override
        payable
        ensure(deadline)
    {
        require(path[0] == WAVAX, 'BaguetteRouter: INVALID_PATH');
        uint amountIn = msg.value;
        IWAVAX(WAVAX).deposit{value: amountIn}();
        assert(IWAVAX(WAVAX).transfer(BaguetteLibrary.pairFor(factory, path[0], path[1]), amountIn));
        uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to);
        _swapSupportingFeeOnTransferTokens(path, to);
        require(
            IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
            'BaguetteRouter: INSUFFICIENT_OUTPUT_AMOUNT'
        );
    }
    function swapExactTokensForAVAXSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    )
        external
        virtual
        override
        ensure(deadline)
    {
        require(path[path.length - 1] == WAVAX, 'BaguetteRouter: INVALID_PATH');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, BaguetteLibrary.pairFor(factory, path[0], path[1]), amountIn
        );
        _swapSupportingFeeOnTransferTokens(path, address(this));
        uint amountOut = IERC20(WAVAX).balanceOf(address(this));
        require(amountOut >= amountOutMin, 'BaguetteRouter: INSUFFICIENT_OUTPUT_AMOUNT');
        IWAVAX(WAVAX).withdraw(amountOut);
        TransferHelper.safeTransferAVAX(to, amountOut);
    }

    // **** LIBRARY FUNCTIONS ****
    function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
        return BaguetteLibrary.quote(amountA, reserveA, reserveB);
    }

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountOut)
    {
        return BaguetteLibrary.getAmountOut(amountIn, reserveIn, reserveOut);
    }

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountIn)
    {
        return BaguetteLibrary.getAmountIn(amountOut, reserveIn, reserveOut);
    }

    function getAmountsOut(uint amountIn, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return BaguetteLibrary.getAmountsOut(factory, amountIn, path);
    }

    function getAmountsIn(uint amountOut, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return BaguetteLibrary.getAmountsIn(factory, amountOut, path);
    }
}

Contract Bytecode

Bytecode

60c060405234801561001057600080fd5b50604051620048e9380380620048e98339818101604052604081101561003557600080fd5b5080516020909101516001600160601b0319606092831b8116608052911b1660a05260805160601c60a05160601c614764620001856000398061019f5280610e5e5280610f935280610fce528061152952806116cb528061178152806117ef528061189e52806119725280611a7e5280611b345280611c0a5280611ea65280611ffb52806120835280612226528061235252806124aa5280612532528061293952806129e05280612a545280612e495280612e9f5280612ed35280612f47525080610d095280610d425280610e3c52806110ab528061118252806112ae52806115c95280611caa5280611db05280611f4b52806120b5528061220452806123f7528061256452806126c052806128d15280612a865280612c985280612d215280612e7d528061399c52806139df5280613b8a5280613d10528061417a528061424152806142c152506147646000f3fe60806040526004361061018f5760003560e01c806385f8c259116100d6578063baa2abde1161007f578063d06ca61f11610059578063d06ca61f14610b70578063e8e3370014610c27578063f91b3f7214610ca7576101c8565b8063baa2abde14610a78578063c45a015514610ad5578063c57559dd14610aea576101c8565b80639fc27226116100b05780639fc2722614610949578063a2a1623d146109bc578063ad615dec14610a42576101c8565b806385f8c259146107f55780638803dbee1461082b5780638a657e67146108c3576101c8565b80635c11d7951161013857806373bc79cf1161011257806373bc79cf14610672578063762b1562146106c55780637a42416a1461075d576101c8565b80635c11d79514610511578063676528d1146105a957806373b295c214610641576101c8565b80632c407024116101695780632c407024146103b357806333c6b7251461042657806338ed173914610479576101c8565b8063054d50d4146101cd5780631f00ca74146102155780632195995c1461031c576101c8565b366101c857336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101c657fe5b005b600080fd5b3480156101d957600080fd5b50610203600480360360608110156101f057600080fd5b5080359060208101359060400135610ced565b60408051918252519081900360200190f35b34801561022157600080fd5b506102cc6004803603604081101561023857600080fd5b8135919081019060408101602082013564010000000081111561025a57600080fd5b82018360208201111561026c57600080fd5b8035906020019184602083028401116401000000008311171561028e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d02945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103085781810151838201526020016102f0565b505050509050019250505060405180910390f35b34801561032857600080fd5b5061039a600480360361016081101561034057600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359091169060c08101359060e081013515159060ff6101008201351690610120810135906101400135610d38565b6040805192835260208301919091528051918290030190f35b3480156103bf57600080fd5b5061039a60048036036101408110156103d757600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a08101359060c081013515159060ff60e08201351690610100810135906101200135610e32565b34801561043257600080fd5b5061039a600480360360c081101561044957600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a00135610f46565b34801561048557600080fd5b506102cc600480360360a081101561049c57600080fd5b8135916020810135918101906060810160408201356401000000008111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460208302840111640100000000831117156104f757600080fd5b91935091506001600160a01b038135169060200135611060565b34801561051d57600080fd5b506101c6600480360360a081101561053457600080fd5b81359160208101359181019060608101604082013564010000000081111561055b57600080fd5b82018360208201111561056d57600080fd5b8035906020019184602083028401116401000000008311171561058f57600080fd5b91935091506001600160a01b038135169060200135611244565b3480156105b557600080fd5b506102cc600480360360a08110156105cc57600080fd5b8135916020810135918101906060810160408201356401000000008111156105f357600080fd5b82018360208201111561060557600080fd5b8035906020019184602083028401116401000000008311171561062757600080fd5b91935091506001600160a01b0381351690602001356114d9565b34801561064d57600080fd5b5061065661177f565b604080516001600160a01b039092168252519081900360200190f35b34801561067e57600080fd5b50610203600480360360c081101561069557600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a001356117a3565b3480156106d157600080fd5b506101c6600480360360a08110156106e857600080fd5b81359160208101359181019060608101604082013564010000000081111561070f57600080fd5b82018360208201111561072157600080fd5b8035906020019184602083028401116401000000008311171561074357600080fd5b91935091506001600160a01b038135169060200135611924565b34801561076957600080fd5b506102cc600480360360a081101561078057600080fd5b8135916020810135918101906060810160408201356401000000008111156107a757600080fd5b8201836020820111156107b957600080fd5b803590602001918460208302840111640100000000831117156107db57600080fd5b91935091506001600160a01b038135169060200135611bba565b34801561080157600080fd5b506102036004803603606081101561081857600080fd5b5080359060208101359060400135611d58565b34801561083757600080fd5b506102cc600480360360a081101561084e57600080fd5b81359160208101359181019060608101604082013564010000000081111561087557600080fd5b82018360208201111561088757600080fd5b803590602001918460208302840111640100000000831117156108a957600080fd5b91935091506001600160a01b038135169060200135611d65565b6102cc600480360360808110156108d957600080fd5b813591908101906040810160208201356401000000008111156108fb57600080fd5b82018360208201111561090d57600080fd5b8035906020019184602083028401116401000000008311171561092f57600080fd5b91935091506001600160a01b038135169060200135611e5e565b34801561095557600080fd5b50610203600480360361014081101561096d57600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a08101359060c081013515159060ff60e082013516906101008101359061012001356121fc565b6102cc600480360360808110156109d257600080fd5b813591908101906040810160208201356401000000008111156109f457600080fd5b820183602082011115610a0657600080fd5b80359060200191846020830284011164010000000083111715610a2857600080fd5b91935091506001600160a01b03813516906020013561230a565b348015610a4e57600080fd5b5061020360048036036060811015610a6557600080fd5b5080359060208101359060400135612665565b348015610a8457600080fd5b5061039a600480360360e0811015610a9b57600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359091169060c00135612672565b348015610ae157600080fd5b506106566128cf565b6101c660048036036080811015610b0057600080fd5b81359190810190604081016020820135640100000000811115610b2257600080fd5b820183602082011115610b3457600080fd5b80359060200191846020830284011164010000000083111715610b5657600080fd5b91935091506001600160a01b0381351690602001356128f3565b348015610b7c57600080fd5b506102cc60048036036040811015610b9357600080fd5b81359190810190604081016020820135640100000000811115610bb557600080fd5b820183602082011115610bc757600080fd5b80359060200191846020830284011164010000000083111715610be957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612c91945050505050565b348015610c3357600080fd5b50610c896004803603610100811015610c4b57600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359160c0820135169060e00135612cbe565b60408051938452602084019290925282820152519081900360600190f35b610c89600480360360c0811015610cbd57600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a00135612dfa565b6000610cfa84848461309f565b949350505050565b6060610d2f7f0000000000000000000000000000000000000000000000000000000000000000848461318f565b90505b92915050565b6000806000610d687f00000000000000000000000000000000000000000000000000000000000000008f8f6132dc565b9050600087610d77578c610d7b565b6000195b6040805163d505accf60e01b815233600482015230602482015260448101839052606481018c905260ff8a16608482015260a4810189905260c4810188905290519192506001600160a01b0384169163d505accf9160e48082019260009290919082900301818387803b158015610df157600080fd5b505af1158015610e05573d6000803e3d6000fd5b50505050610e188f8f8f8f8f8f8f612672565b809450819550505050509b509b9950505050505050505050565b6000806000610e827f00000000000000000000000000000000000000000000000000000000000000008e7f00000000000000000000000000000000000000000000000000000000000000006132dc565b9050600087610e91578c610e95565b6000195b6040805163d505accf60e01b815233600482015230602482015260448101839052606481018c905260ff8a16608482015260a4810189905260c4810188905290519192506001600160a01b0384169163d505accf9160e48082019260009290919082900301818387803b158015610f0b57600080fd5b505af1158015610f1f573d6000803e3d6000fd5b50505050610f318e8e8e8e8e8e610f46565b909f909e509c50505050505050505050505050565b6000808242811015610f8d576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b610fbc897f00000000000000000000000000000000000000000000000000000000000000008a8a8a308a612672565b9093509150610fcc8986856133b4565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561103257600080fd5b505af1158015611046573d6000803e3d6000fd5b50505050611054858361354c565b50965096945050505050565b606081428110156110a6576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b6111047f00000000000000000000000000000000000000000000000000000000000000008988888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061364492505050565b9150868260018451038151811061111757fe5b6020026020010151101561115c5760405162461bcd60e51b815260040180806020018281038252602a815260200180614692602a913960400191505060405180910390fd5b6111fa8686600081811061116c57fe5b905060200201356001600160a01b0316336111e07f00000000000000000000000000000000000000000000000000000000000000008a8a60008181106111ae57fe5b905060200201356001600160a01b03168b8b60018181106111cb57fe5b905060200201356001600160a01b03166132dc565b856000815181106111ed57fe5b602002602001015161377b565b611239828787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992506138ed915050565b509695505050505050565b8042811015611288576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b6112fd8585600081811061129857fe5b905060200201356001600160a01b0316336112f77f0000000000000000000000000000000000000000000000000000000000000000898960008181106112da57fe5b905060200201356001600160a01b03168a8a60018181106111cb57fe5b8a61377b565b60008585600019810181811061130f57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561137457600080fd5b505afa158015611388573d6000803e3d6000fd5b505050506040513d602081101561139e57600080fd5b505160408051602088810282810182019093528882529293506113e0929091899189918291850190849080828437600092019190915250889250613b33915050565b8661149282888860001981018181106113f557fe5b905060200201356001600160a01b03166001600160a01b03166370a08231886040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561145a57600080fd5b505afa15801561146e573d6000803e3d6000fd5b505050506040513d602081101561148457600080fd5b50519063ffffffff613e5e16565b10156114cf5760405162461bcd60e51b815260040180806020018281038252602a815260200180614692602a913960400191505060405180910390fd5b5050505050505050565b6060814281101561151f576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168686600019810181811061155957fe5b905060200201356001600160a01b03166001600160a01b0316146115c4576040805162461bcd60e51b815260206004820152601c60248201527f4261677565747465526f757465723a20494e56414c49445f5041544800000000604482015290519081900360640190fd5b6116227f00000000000000000000000000000000000000000000000000000000000000008988888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061364492505050565b9150868260018451038151811061163557fe5b6020026020010151101561167a5760405162461bcd60e51b815260040180806020018281038252602a815260200180614692602a913960400191505060405180910390fd5b61168a8686600081811061116c57fe5b6116c9828787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152503092506138ed915050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d8360018551038151811061170857fe5b60200260200101516040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561174657600080fd5b505af115801561175a573d6000803e3d6000fd5b50505050611239848360018551038151811061177257fe5b602002602001015161354c565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081428110156117e9576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b611818887f00000000000000000000000000000000000000000000000000000000000000008989893089612672565b604080516370a0823160e01b8152306004820152905191945061189c92508a9187916001600160a01b038416916370a0823191602480820192602092909190829003018186803b15801561186b57600080fd5b505afa15801561187f573d6000803e3d6000fd5b505050506040513d602081101561189557600080fd5b50516133b4565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561190257600080fd5b505af1158015611916573d6000803e3d6000fd5b50505050611239848361354c565b8042811015611968576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858560001981018181106119a257fe5b905060200201356001600160a01b03166001600160a01b031614611a0d576040805162461bcd60e51b815260206004820152601c60248201527f4261677565747465526f757465723a20494e56414c49445f5041544800000000604482015290519081900360640190fd5b611a1d8585600081811061129857fe5b611a5b858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250309250613b33915050565b604080516370a0823160e01b815230600482015290516000916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b158015611ac557600080fd5b505afa158015611ad9573d6000803e3d6000fd5b505050506040513d6020811015611aef57600080fd5b5051905086811015611b325760405162461bcd60e51b815260040180806020018281038252602a815260200180614692602a913960400191505060405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611b9857600080fd5b505af1158015611bac573d6000803e3d6000fd5b505050506114cf848261354c565b60608142811015611c00576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001686866000198101818110611c3a57fe5b905060200201356001600160a01b03166001600160a01b031614611ca5576040805162461bcd60e51b815260206004820152601c60248201527f4261677565747465526f757465723a20494e56414c49445f5041544800000000604482015290519081900360640190fd5b611d037f00000000000000000000000000000000000000000000000000000000000000008988888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061318f92505050565b91508682600081518110611d1357fe5b6020026020010151111561167a5760405162461bcd60e51b81526004018080602001828103825260268152602001806145b86026913960400191505060405180910390fd5b6000610cfa848484613eb6565b60608142811015611dab576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b611e097f00000000000000000000000000000000000000000000000000000000000000008988888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061318f92505050565b91508682600081518110611e1957fe5b6020026020010151111561115c5760405162461bcd60e51b81526004018080602001828103825260268152602001806145b86026913960400191505060405180910390fd5b60608142811015611ea4576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031686866000818110611edb57fe5b905060200201356001600160a01b03166001600160a01b031614611f46576040805162461bcd60e51b815260206004820152601c60248201527f4261677565747465526f757465723a20494e56414c49445f5041544800000000604482015290519081900360640190fd5b611fa47f00000000000000000000000000000000000000000000000000000000000000008888888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061318f92505050565b91503482600081518110611fb457fe5b60200260200101511115611ff95760405162461bcd60e51b81526004018080602001828103825260268152602001806145b86026913960400191505060405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08360008151811061203557fe5b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561206857600080fd5b505af115801561207c573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb6120e17f0000000000000000000000000000000000000000000000000000000000000000898960008181106112da57fe5b846000815181106120ee57fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561214557600080fd5b505af1158015612159573d6000803e3d6000fd5b505050506040513d602081101561216f57600080fd5b505161217757fe5b6121b6828787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992506138ed915050565b816000815181106121c357fe5b60200260200101513411156121f2576121f233836000815181106121e357fe5b6020026020010151340361354c565b5095945050505050565b60008061224a7f00000000000000000000000000000000000000000000000000000000000000008d7f00000000000000000000000000000000000000000000000000000000000000006132dc565b9050600086612259578b61225d565b6000195b6040805163d505accf60e01b815233600482015230602482015260448101839052606481018b905260ff8916608482015260a4810188905260c4810187905290519192506001600160a01b0384169163d505accf9160e48082019260009290919082900301818387803b1580156122d357600080fd5b505af11580156122e7573d6000803e3d6000fd5b505050506122f98d8d8d8d8d8d6117a3565b9d9c50505050505050505050505050565b60608142811015612350576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168686600081811061238757fe5b905060200201356001600160a01b03166001600160a01b0316146123f2576040805162461bcd60e51b815260206004820152601c60248201527f4261677565747465526f757465723a20494e56414c49445f5041544800000000604482015290519081900360640190fd5b6124507f00000000000000000000000000000000000000000000000000000000000000003488888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061364492505050565b9150868260018451038151811061246357fe5b602002602001015110156124a85760405162461bcd60e51b815260040180806020018281038252602a815260200180614692602a913960400191505060405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836000815181106124e457fe5b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561251757600080fd5b505af115801561252b573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb6125907f0000000000000000000000000000000000000000000000000000000000000000898960008181106112da57fe5b8460008151811061259d57fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156125f457600080fd5b505af1158015612608573d6000803e3d6000fd5b505050506040513d602081101561261e57600080fd5b505161262657fe5b6121f2828787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992506138ed915050565b6000610cfa848484613fa6565b60008082428110156126b9576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b60006126e67f00000000000000000000000000000000000000000000000000000000000000008c8c6132dc565b604080516323b872dd60e01b81523360048201526001600160a01b03831660248201819052604482018d9052915192935090916323b872dd916064808201926020929091908290030181600087803b15801561274157600080fd5b505af1158015612755573d6000803e3d6000fd5b505050506040513d602081101561276b57600080fd5b5050604080517f89afcb440000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015282516000938493928616926389afcb44926024808301939282900301818787803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b505050506040513d60408110156127fb57600080fd5b508051602090910151909250905060006128158e8e614052565b509050806001600160a01b03168e6001600160a01b03161461283857818361283b565b82825b90975095508a87101561287f5760405162461bcd60e51b81526004018080602001828103825260258152602001806146056025913960400191505060405180910390fd5b898610156128be5760405162461bcd60e51b81526004018080602001828103825260258152602001806145696025913960400191505060405180910390fd5b505050505097509795505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8042811015612937576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168585600081811061296e57fe5b905060200201356001600160a01b03166001600160a01b0316146129d9576040805162461bcd60e51b815260206004820152601c60248201527f4261677565747465526f757465723a20494e56414c49445f5041544800000000604482015290519081900360640190fd5b60003490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015612a3957600080fd5b505af1158015612a4d573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb612ab27f0000000000000000000000000000000000000000000000000000000000000000898960008181106112da57fe5b836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612b0257600080fd5b505af1158015612b16573d6000803e3d6000fd5b505050506040513d6020811015612b2c57600080fd5b5051612b3457fe5b600086866000198101818110612b4657fe5b905060200201356001600160a01b03166001600160a01b03166370a08231866040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015612bab57600080fd5b505afa158015612bbf573d6000803e3d6000fd5b505050506040513d6020811015612bd557600080fd5b50516040805160208981028281018201909352898252929350612c179290918a918a918291850190849080828437600092019190915250899250613b33915050565b876114928289896000198101818110612c2c57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231896040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561145a57600080fd5b6060610d2f7f00000000000000000000000000000000000000000000000000000000000000008484613644565b60008060008342811015612d07576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b612d158c8c8c8c8c8c614130565b90945092506000612d477f00000000000000000000000000000000000000000000000000000000000000008e8e6132dc565b9050612d558d33838861377b565b612d618c33838761377b565b806001600160a01b0316636a627842886040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050602060405180830381600087803b158015612db957600080fd5b505af1158015612dcd573d6000803e3d6000fd5b505050506040513d6020811015612de357600080fd5b5051949d939c50939a509198505050505050505050565b60008060008342811015612e43576040805162461bcd60e51b8152602060048201526017602482015260008051602061464e833981519152604482015290519081900360640190fd5b612e718a7f00000000000000000000000000000000000000000000000000000000000000008b348c8c614130565b90945092506000612ec37f00000000000000000000000000000000000000000000000000000000000000008c7f00000000000000000000000000000000000000000000000000000000000000006132dc565b9050612ed18b33838861377b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015612f2c57600080fd5b505af1158015612f40573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb82866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612fc557600080fd5b505af1158015612fd9573d6000803e3d6000fd5b505050506040513d6020811015612fef57600080fd5b5051612ff757fe5b806001600160a01b0316636a627842886040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050602060405180830381600087803b15801561304f57600080fd5b505af1158015613063573d6000803e3d6000fd5b505050506040513d602081101561307957600080fd5b5051925034841015613091576130913385340361354c565b505096509650969350505050565b60008084116130df5760405162461bcd60e51b815260040180806020018281038252602a81526020018061458e602a913960400191505060405180910390fd5b6000831180156130ef5750600082115b61312a5760405162461bcd60e51b81526004018080602001828103825260278152602001806145de6027913960400191505060405180910390fd5b600061313e856103e563ffffffff6143d616565b90506000613152828563ffffffff6143d616565b905060006131788361316c886103e863ffffffff6143d616565b9063ffffffff61444216565b905080828161318357fe5b04979650505050505050565b60606002825110156131e8576040805162461bcd60e51b815260206004820152601d60248201527f42616775657474654c6962726172793a20494e56414c49445f50415448000000604482015290519081900360640190fd5b815167ffffffffffffffff8111801561320057600080fd5b5060405190808252806020026020018201604052801561322a578160200160208202803683370190505b509050828160018351038151811061323e57fe5b60209081029190910101528151600019015b80156132d45760008061328d8786600186038151811061326c57fe5b602002602001015187868151811061328057fe5b602002602001015161449a565b915091506132af8484815181106132a057fe5b60200260200101518383613eb6565b8460018503815181106132be57fe5b6020908102919091010152505060001901613250565b509392505050565b60008060006132eb8585614052565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527f81dbf51ab39dc634785936a3b34def28bf8007e6dfa30d4284c4b8547cb47a51609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061345f5780518252601f199092019160209182019101613440565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146134c1576040519150601f19603f3d011682016040523d82523d6000602084013e6134c6565b606091505b50915091508180156134f45750805115806134f457508080602001905160208110156134f157600080fd5b50515b613545576040805162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b5050505050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106135985780518252601f199092019160209182019101613579565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146135fa576040519150601f19603f3d011682016040523d82523d6000602084013e6135ff565b606091505b505090508061363f5760405162461bcd60e51b815260040180806020018281038252602481526020018061466e6024913960400191505060405180910390fd5b505050565b606060028251101561369d576040805162461bcd60e51b815260206004820152601d60248201527f42616775657474654c6962726172793a20494e56414c49445f50415448000000604482015290519081900360640190fd5b815167ffffffffffffffff811180156136b557600080fd5b506040519080825280602002602001820160405280156136df578160200160208202803683370190505b50905082816000815181106136f057fe5b60200260200101818152505060005b60018351038110156132d4576000806137358786858151811061371e57fe5b602002602001015187866001018151811061328057fe5b9150915061375784848151811061374857fe5b6020026020010151838361309f565b84846001018151811061376657fe5b602090810291909101015250506001016136ff565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b17815292518251600094606094938a169392918291908083835b602083106138155780518252601f1990920191602091820191016137f6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613877576040519150601f19603f3d011682016040523d82523d6000602084013e61387c565b606091505b50915091508180156138aa5750805115806138aa57508080602001905160208110156138a757600080fd5b50515b6138e55760405162461bcd60e51b815260040180806020018281038252602481526020018061470b6024913960400191505060405180910390fd5b505050505050565b60005b6001835103811015613b2d5760008084838151811061390b57fe5b602002602001015185846001018151811061392257fe5b602002602001015191509150600061393a8383614052565b509050600087856001018151811061394e57fe5b60200260200101519050600080836001600160a01b0316866001600160a01b03161461397c57826000613980565b6000835b91509150600060028a5103881061399757886139d8565b6139d87f0000000000000000000000000000000000000000000000000000000000000000878c8b600201815181106139cb57fe5b60200260200101516132dc565b9050613a057f000000000000000000000000000000000000000000000000000000000000000088886132dc565b6001600160a01b031663022c0d9f84848460006040519080825280601f01601f191660200182016040528015613a42576020820181803683370190505b506040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613ab3578181015183820152602001613a9b565b50505050905090810190601f168015613ae05780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015613b0257600080fd5b505af1158015613b16573d6000803e3d6000fd5b5050600190990198506138f0975050505050505050565b50505050565b60005b600183510381101561363f57600080848381518110613b5157fe5b6020026020010151858460010181518110613b6857fe5b6020026020010151915091506000613b808383614052565b5090506000613bb07f000000000000000000000000000000000000000000000000000000000000000085856132dc565b9050600080600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015613bf157600080fd5b505afa158015613c05573d6000803e3d6000fd5b505050506040513d6060811015613c1b57600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506000806001600160a01b038a811690891614613c58578284613c5b565b83835b91509150613cb9828b6001600160a01b03166370a082318a6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561145a57600080fd5b9550613cc686838361309f565b945050505050600080856001600160a01b0316886001600160a01b031614613cf057826000613cf4565b6000835b91509150600060028c51038a10613d0b578a613d3f565b613d3f7f0000000000000000000000000000000000000000000000000000000000000000898e8d600201815181106139cb57fe5b60408051600080825260208201928390527f022c0d9f00000000000000000000000000000000000000000000000000000000835260248201878152604483018790526001600160a01b038086166064850152608060848501908152845160a48601819052969750908c169563022c0d9f958a958a958a9591949193919260c486019290918190849084905b83811015613de2578181015183820152602001613dca565b50505050905090810190601f168015613e0f5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015613e3157600080fd5b505af1158015613e45573d6000803e3d6000fd5b50506001909b019a50613b369950505050505050505050565b80820382811115610d32576040805162461bcd60e51b815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6000808411613ef65760405162461bcd60e51b815260040180806020018281038252602b8152602001806146e0602b913960400191505060405180910390fd5b600083118015613f065750600082115b613f415760405162461bcd60e51b81526004018080602001828103825260278152602001806145de6027913960400191505060405180910390fd5b6000613f656103e8613f59868863ffffffff6143d616565b9063ffffffff6143d616565b90506000613f7f6103e5613f59868963ffffffff613e5e16565b9050613f9c6001828481613f8f57fe5b049063ffffffff61444216565b9695505050505050565b6000808411613fe65760405162461bcd60e51b81526004018080602001828103825260248152602001806146bc6024913960400191505060405180910390fd5b600083118015613ff65750600082115b6140315760405162461bcd60e51b81526004018080602001828103825260278152602001806145de6027913960400191505060405180910390fd5b82614042858463ffffffff6143d616565b8161404957fe5b04949350505050565b600080826001600160a01b0316846001600160a01b031614156140a65760405162461bcd60e51b815260040180806020018281038252602481526020018061462a6024913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b0316106140c65782846140c9565b83835b90925090506001600160a01b038216614129576040805162461bcd60e51b815260206004820152601d60248201527f42616775657474654c6962726172793a205a45524f5f41444452455353000000604482015290519081900360640190fd5b9250929050565b604080517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015287811660248301529151600092839283927f00000000000000000000000000000000000000000000000000000000000000009092169163e6a4390591604480820192602092909190829003018186803b1580156141c357600080fd5b505afa1580156141d7573d6000803e3d6000fd5b505050506040513d60208110156141ed57600080fd5b50516001600160a01b031614156142b957604080517fc9c653960000000000000000000000000000000000000000000000000000000081526001600160a01b038a81166004830152898116602483015291517f00000000000000000000000000000000000000000000000000000000000000009092169163c9c65396916044808201926020929091908290030181600087803b15801561428c57600080fd5b505af11580156142a0573d6000803e3d6000fd5b505050506040513d60208110156142b657600080fd5b50505b6000806142e77f00000000000000000000000000000000000000000000000000000000000000008b8b61449a565b915091508160001480156142f9575080155b15614309578793508692506143c9565b6000614316898484613fa6565b9050878111614369578581101561435e5760405162461bcd60e51b81526004018080602001828103825260258152602001806145696025913960400191505060405180910390fd5b8894509250826143c7565b6000614376898486613fa6565b90508981111561438257fe5b878110156143c15760405162461bcd60e51b81526004018080602001828103825260258152602001806146056025913960400191505060405180910390fd5b94508793505b505b5050965096945050505050565b60008115806143f1575050808202828282816143ee57fe5b04145b610d32576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820182811015610d32576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b60008060006144a98585614052565b5090506000806144ba8888886132dc565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156144f257600080fd5b505afa158015614506573d6000803e3d6000fd5b505050506040513d606081101561451c57600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506001600160a01b0387811690841614614556578082614559565b81815b9099909850965050505050505056fe4261677565747465526f757465723a20494e53554646494349454e545f425f414d4f554e5442616775657474654c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e544261677565747465526f757465723a204558434553534956455f494e5055545f414d4f554e5442616775657474654c6962726172793a20494e53554646494349454e545f4c49515549444954594261677565747465526f757465723a20494e53554646494349454e545f415f414d4f554e5442616775657474654c6962726172793a204944454e544943414c5f4144445245535345534261677565747465526f757465723a20455850495245440000000000000000005472616e7366657248656c7065723a20415641585f5452414e534645525f4641494c45444261677565747465526f757465723a20494e53554646494349454e545f4f55545055545f414d4f554e5442616775657474654c6962726172793a20494e53554646494349454e545f414d4f554e5442616775657474654c6962726172793a20494e53554646494349454e545f4f55545055545f414d4f554e545472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544