Contract
0xc06e6E717E217D9148c30D1B01E1b04CB6E6bB8e
13
My Name Tag:
Not Available
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
ApeSwapZapArbitrumV1
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.15; /* ______ ______ / \ / \ | ▓▓▓▓▓▓\ ______ ______ | ▓▓▓▓▓▓\__ __ __ ______ ______ | ▓▓__| ▓▓/ \ / \| ▓▓___\▓▓ \ | \ | \| \ / \ | ▓▓ ▓▓ ▓▓▓▓▓▓\ ▓▓▓▓▓▓\\▓▓ \| ▓▓ | ▓▓ | ▓▓ \▓▓▓▓▓▓\ ▓▓▓▓▓▓\ | ▓▓▓▓▓▓▓▓ ▓▓ | ▓▓ ▓▓ ▓▓_\▓▓▓▓▓▓\ ▓▓ | ▓▓ | ▓▓/ ▓▓ ▓▓ | ▓▓ | ▓▓ | ▓▓ ▓▓__/ ▓▓ ▓▓▓▓▓▓▓▓ \__| ▓▓ ▓▓_/ ▓▓_/ ▓▓ ▓▓▓▓▓▓▓ ▓▓__/ ▓▓ | ▓▓ | ▓▓ ▓▓ ▓▓\▓▓ \\▓▓ ▓▓\▓▓ ▓▓ ▓▓\▓▓ ▓▓ ▓▓ ▓▓ \▓▓ \▓▓ ▓▓▓▓▓▓▓ \▓▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓▓▓▓\▓▓▓▓ \▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ | ▓▓ | ▓▓ | ▓▓ | ▓▓ \▓▓ \▓▓ * App: https://apeswap.finance * Medium: https://ape-swap.medium.com * Twitter: https://twitter.com/ape_swap * Telegram: https://t.me/ape_swap * Announcements: https://t.me/ape_swap_news * GitHub: https://github.com/ApeSwapFinance */ import "./ApeSwapZap.sol"; import "./extensions/bills/ApeSwapZapTBills.sol"; import "./extensions/ApeSwapZapLPMigrator.sol"; import "./lib/IApeRouter02.sol"; /// @title ApeSwap Zap Arbitrum V1 /// @author ApeSwap contract ApeSwapZapArbitrumV1 is ApeSwapZap, ApeSwapZapTBills, ApeSwapZapLPMigrator { constructor(IApeRouter02 _router) ApeSwapZap(_router) ApeSwapZapLPMigrator(_router) {} }
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; interface IWETH { function deposit() external payable; function transfer(address to, uint256 value) external returns (bool); function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; import "./IApeRouter01.sol"; interface IApeRouter02 is IApeRouter01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; interface IApeRouter01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.6; interface IApePair { event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 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 (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 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 (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); 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 (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.6; interface IApeFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function INIT_CODE_PAIR_HASH() external view returns (bytes32); 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; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; interface ICustomBill { function principalToken() external returns (address); function deposit( uint256 _amount, uint256 _maxPrice, address _depositor ) external returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import "../../ApeSwapZap.sol"; import "./lib/ICustomBill.sol"; abstract contract ApeSwapZapTBills is ApeSwapZap { using SafeERC20 for IERC20; event ZapTBill(IERC20 inputToken, uint256 inputAmount, ICustomBill bill); event ZapTBillNative(uint256 inputAmount, ICustomBill bill); /// @notice Zap single token to LP /// @param inputToken Input token to zap /// @param inputAmount Amount of input tokens to zap /// @param lpTokens Tokens of LP to zap to /// @param path0 Path from input token to LP token0 /// @param path1 Path from input token to LP token1 /// @param minAmountsSwap The minimum amount of output tokens that must be received for swap /// @param minAmountsLP AmountAMin and amountBMin for adding liquidity /// @param deadline Unix timestamp after which the transaction will revert /// @param bill Treasury bill address /// @param maxPrice Max price of treasury bill function zapTBill( IERC20 inputToken, uint256 inputAmount, address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] uint256 deadline, ICustomBill bill, uint256 maxPrice ) external nonReentrant { IApePair pair = IApePair(bill.principalToken()); require( (lpTokens[0] == pair.token0() && lpTokens[1] == pair.token1()) || (lpTokens[1] == pair.token0() && lpTokens[0] == pair.token1()), "ApeSwapZap: Wrong LP pair for TBill" ); _zapInternal( inputToken, inputAmount, lpTokens, path0, path1, minAmountsSwap, minAmountsLP, address(this), deadline ); _depositTBill(bill, IERC20(address(pair)), maxPrice, msg.sender); emit ZapTBill(inputToken, inputAmount, bill); } /// @notice Zap native token to Treasury Bill /// @param lpTokens Tokens of LP to zap to /// @param path0 Path from input token to LP token0 /// @param path1 Path from input token to LP token1 /// @param minAmountsSwap The minimum amount of output tokens that must be received for swap /// @param minAmountsLP AmountAMin and amountBMin for adding liquidity /// @param deadline Unix timestamp after which the transaction will revert /// @param bill Treasury bill address /// @param maxPrice Max price of treasury bill function zapTBillNative( address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] uint256 deadline, ICustomBill bill, uint256 maxPrice ) external payable nonReentrant { IApePair pair = IApePair(bill.principalToken()); require( (lpTokens[0] == pair.token0() && lpTokens[1] == pair.token1()) || (lpTokens[1] == pair.token0() && lpTokens[0] == pair.token1()), "ApeSwapZap: Wrong LP pair for TBill" ); _zapNativeInternal( lpTokens, path0, path1, minAmountsSwap, minAmountsLP, address(this), deadline ); _depositTBill(bill, IERC20(address(pair)), maxPrice, msg.sender); emit ZapTBillNative(msg.value, bill); } /// @notice Zap token to single asset Treasury Bill /// @param inputToken Input token to zap /// @param inputAmount Amount of input tokens to zap /// @param path Path from input token to stake token /// @param minAmountsSwap The minimum amount of output tokens that must be received for swap /// @param deadline Unix timestamp after which the transaction will revert /// @param bill Pool address /// @param maxPrice MaxPrice for purchasing a bill function zapSingleAssetTBill( IERC20 inputToken, uint256 inputAmount, address[] calldata path, uint256 minAmountsSwap, uint256 deadline, ICustomBill bill, uint256 maxPrice ) external nonReentrant { IERC20 principalToken = IERC20(bill.principalToken()); require( (address(inputToken) == path[0] && address(principalToken) == path[path.length - 1]), "ApeSwapZapTBills: Wrong path for inputToken or principalToken" ); uint256 balanceBefore = _getBalance(inputToken); inputToken.safeTransferFrom(msg.sender, address(this), inputAmount); inputAmount = _getBalance(inputToken) - balanceBefore; inputToken.approve(address(router), inputAmount); _routerSwap(inputAmount, minAmountsSwap, path, deadline); _depositTBill(bill, principalToken, maxPrice, msg.sender); emit ZapTBill(inputToken, inputAmount, bill); } /// @notice Zap native token to single asset Treasury Bill /// @param path Path from input token to stake token /// @param minAmountsSwap The minimum amount of output tokens that must be received for swap /// @param deadline Unix timestamp after which the transaction will revert /// @param bill Pool address /// @param maxPrice MaxPrice for purchasing a bill function zapSingleAssetTBillNative( address[] calldata path, uint256 minAmountsSwap, uint256 deadline, ICustomBill bill, uint256 maxPrice ) external payable nonReentrant { (uint256 inputAmount, IERC20 inputToken) = _wrapNative(); IERC20 principalToken = IERC20(bill.principalToken()); require( (address(inputToken) == path[0] && address(principalToken) == path[path.length - 1]), "ApeSwapZapTBills: Wrong path for inputToken or principalToken" ); inputToken.approve(address(router), inputAmount); _routerSwap(inputAmount, minAmountsSwap, path, deadline); _depositTBill(bill, principalToken, maxPrice, msg.sender); emit ZapTBillNative(inputAmount, bill); } function _depositTBill( ICustomBill bill, IERC20 principalToken, uint256 maxPrice, address depositor ) private returns (uint256 depositAmount) { depositAmount = principalToken.balanceOf(address(this)); require(depositAmount > 0, "ApeSwapZapTBills: Nothing to deposit"); principalToken.approve(address(bill), depositAmount); bill.deposit(depositAmount, maxPrice, depositor); principalToken.approve(address(bill), 0); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "../lib/IApeRouter02.sol"; import "../lib/IApePair.sol"; abstract contract ApeSwapZapLPMigrator is ReentrancyGuard { using SafeERC20 for IERC20; IApeRouter02 public immutable apeRouter; event LPMigrated( IApePair lp, IApeRouter02 fromRouter, IApeRouter02 toRouter, uint256 amount ); constructor(IApeRouter02 router) { apeRouter = router; } /// @notice Zap non APE-LPs to APE-LPs /// @param router The non APE-LP router /// @param lp LP address to zap /// @param amount Amount of LPs to zap /// @param amountAMinRemove The minimum amount of token0 to receive after removing liquidity /// @param amountBMinRemove The minimum amount of token1 to receive after removing liquidity /// @param amountAMinAdd The minimum amount of token0 to add to APE-LP on add liquidity /// @param amountBMinAdd The minimum amount of token1 to add to APE-LP on add liquidity /// @param deadline Unix timestamp after which the transaction will revert function zapLPMigrator( IApeRouter02 router, IApePair lp, uint256 amount, uint256 amountAMinRemove, uint256 amountBMinRemove, uint256 amountAMinAdd, uint256 amountBMinAdd, uint256 deadline ) external nonReentrant { address token0 = lp.token0(); address token1 = lp.token1(); IERC20(address(lp)).safeTransferFrom(msg.sender, address(this), amount); lp.approve(address(router), amount); (uint256 amountAReceived, uint256 amountBReceived) = router .removeLiquidity( token0, token1, amount, amountAMinRemove, amountBMinRemove, address(this), deadline ); IERC20(token0).approve(address(apeRouter), amountAReceived); IERC20(token1).approve(address(apeRouter), amountBReceived); (uint256 amountASent, uint256 amountBSent, ) = apeRouter.addLiquidity( token0, token1, amountAReceived, amountBReceived, amountAMinAdd, amountBMinAdd, msg.sender, deadline ); if (amountAReceived - amountASent > 0) { IERC20(token0).safeTransfer( msg.sender, amountAReceived - amountASent ); } if (amountBReceived - amountBSent > 0) { IERC20(token1).safeTransfer( msg.sender, amountBReceived - amountBSent ); } emit LPMigrated(lp, router, apeRouter, amount); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; /* ______ ______ / \ / \ | ▓▓▓▓▓▓\ ______ ______ | ▓▓▓▓▓▓\__ __ __ ______ ______ | ▓▓__| ▓▓/ \ / \| ▓▓___\▓▓ \ | \ | \| \ / \ | ▓▓ ▓▓ ▓▓▓▓▓▓\ ▓▓▓▓▓▓\\▓▓ \| ▓▓ | ▓▓ | ▓▓ \▓▓▓▓▓▓\ ▓▓▓▓▓▓\ | ▓▓▓▓▓▓▓▓ ▓▓ | ▓▓ ▓▓ ▓▓_\▓▓▓▓▓▓\ ▓▓ | ▓▓ | ▓▓/ ▓▓ ▓▓ | ▓▓ | ▓▓ | ▓▓ ▓▓__/ ▓▓ ▓▓▓▓▓▓▓▓ \__| ▓▓ ▓▓_/ ▓▓_/ ▓▓ ▓▓▓▓▓▓▓ ▓▓__/ ▓▓ | ▓▓ | ▓▓ ▓▓ ▓▓\▓▓ \\▓▓ ▓▓\▓▓ ▓▓ ▓▓\▓▓ ▓▓ ▓▓ ▓▓ \▓▓ \▓▓ ▓▓▓▓▓▓▓ \▓▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓▓▓▓\▓▓▓▓ \▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ | ▓▓ | ▓▓ | ▓▓ | ▓▓ \▓▓ \▓▓ * App: https://apeswap.finance * Medium: https://ape-swap.medium.com * Twitter: https://twitter.com/ape_swap * Discord: https://discord.com/invite/apeswap * Telegram: https://t.me/ape_swap * Announcements: https://t.me/ape_swap_news * GitHub: https://github.com/ApeSwapFinance */ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; interface IApeSwapZap { function zap( IERC20 _inputToken, uint256 _inputAmount, address[] memory _lpTokens, //[tokenA, tokenB] address[] calldata _path0, address[] calldata _path1, uint256[] memory _minAmountsSwap, //[A, B] uint256[] memory _minAmountsLP, //[amountAMin, amountBMin] address _to, uint256 _deadline ) external; function zapNative( address[] memory _lpTokens, //[tokenA, tokenB] address[] calldata _path0, address[] calldata _path1, uint256[] memory _minAmountsSwap, //[A, B] uint256[] memory _minAmountsLP, //[amountAMin, amountBMin] address _to, uint256 _deadline ) external payable; function getMinAmounts( uint256 _inputAmount, address[] calldata _path0, address[] calldata _path1 ) external view returns ( uint256[2] memory _minAmountsSwap, uint256[2] memory _minAmountsLP ); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.15; /* ______ ______ / \ / \ | ▓▓▓▓▓▓\ ______ ______ | ▓▓▓▓▓▓\__ __ __ ______ ______ | ▓▓__| ▓▓/ \ / \| ▓▓___\▓▓ \ | \ | \| \ / \ | ▓▓ ▓▓ ▓▓▓▓▓▓\ ▓▓▓▓▓▓\\▓▓ \| ▓▓ | ▓▓ | ▓▓ \▓▓▓▓▓▓\ ▓▓▓▓▓▓\ | ▓▓▓▓▓▓▓▓ ▓▓ | ▓▓ ▓▓ ▓▓_\▓▓▓▓▓▓\ ▓▓ | ▓▓ | ▓▓/ ▓▓ ▓▓ | ▓▓ | ▓▓ | ▓▓ ▓▓__/ ▓▓ ▓▓▓▓▓▓▓▓ \__| ▓▓ ▓▓_/ ▓▓_/ ▓▓ ▓▓▓▓▓▓▓ ▓▓__/ ▓▓ | ▓▓ | ▓▓ ▓▓ ▓▓\▓▓ \\▓▓ ▓▓\▓▓ ▓▓ ▓▓\▓▓ ▓▓ ▓▓ ▓▓ \▓▓ \▓▓ ▓▓▓▓▓▓▓ \▓▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓▓▓▓\▓▓▓▓ \▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ | ▓▓ | ▓▓ | ▓▓ | ▓▓ \▓▓ \▓▓ * App: https://apeswap.finance * Medium: https://ape-swap.medium.com * Twitter: https://twitter.com/ape_swap * Discord: https://discord.com/invite/apeswap * Telegram: https://t.me/ape_swap * Announcements: https://t.me/ape_swap_news * GitHub: https://github.com/ApeSwapFinance */ import "./IApeSwapZap.sol"; import "./lib/IApeRouter02.sol"; import "./lib/IApeFactory.sol"; import "./lib/IApePair.sol"; import "./lib/IWETH.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract ApeSwapZap is IApeSwapZap, ReentrancyGuard { using SafeERC20 for IERC20; struct BalanceLocalVars { uint256 amount0; uint256 amount1; } IApeRouter02 public immutable router; IApeFactory public immutable factory; address public immutable WNATIVE; event Zap(address inputToken, uint256 inputAmount, address[] lpTokens); event ZapNative(uint256 inputAmount, address[] lpTokens); constructor(IApeRouter02 _router) { router = _router; factory = IApeFactory(router.factory()); WNATIVE = router.WETH(); } /// @dev The receive method is used as a fallback function in a contract /// and is called when ether is sent to a contract with no calldata. receive() external payable { require( msg.sender == WNATIVE, "ApeSwapZap: Only receive ether from wrapped" ); } /// @notice Zap single token to LP /// @param inputToken Input token /// @param inputAmount Input amount /// @param lpTokens Tokens of LP to zap to /// @param path0 Path from input token to LP token0 /// @param path1 Path from input token to LP token1 /// @param minAmountsSwap The minimum amount of output tokens that must be received for swap /// @param minAmountsLP AmountAMin and amountBMin for adding liquidity /// @param to address to receive LPs /// @param deadline Unix timestamp after which the transaction will revert function zap( IERC20 inputToken, uint256 inputAmount, address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] address to, uint256 deadline ) external override nonReentrant { _zapInternal( inputToken, inputAmount, lpTokens, path0, path1, minAmountsSwap, minAmountsLP, to, deadline ); } /// @notice Zap native token to LP /// @param lpTokens Tokens of LP to zap to /// @param path0 Path from input token to LP token0 /// @param path1 Path from input token to LP token1 /// @param minAmountsSwap The minimum amount of output tokens that must be received for swap /// @param minAmountsLP AmountAMin and amountBMin for adding liquidity /// @param to address to receive LPs /// @param deadline Unix timestamp after which the transaction will revert function zapNative( address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] address to, uint256 deadline ) external payable override nonReentrant { _zapNativeInternal( lpTokens, path0, path1, minAmountsSwap, minAmountsLP, to, deadline ); } /// @notice get min amounts for swaps /// @param inputAmount total input amount for swap /// @param path0 path from input token to LP token0 /// @param path1 path from input token to LP token1 function getMinAmounts( uint256 inputAmount, address[] calldata path0, address[] calldata path1 ) external view override returns ( uint256[2] memory minAmountsSwap, uint256[2] memory minAmountsLP ) { require( path0.length >= 2 || path1.length >= 2, "ApeSwapZap: Needs at least one path" ); uint256 inputAmountHalf = inputAmount / 2; uint256 minAmountSwap0 = inputAmountHalf; if (path0.length != 0) { uint256[] memory amountsOut0 = router.getAmountsOut( inputAmountHalf, path0 ); minAmountSwap0 = amountsOut0[amountsOut0.length - 1]; } uint256 minAmountSwap1 = inputAmountHalf; if (path1.length != 0) { uint256[] memory amountsOut1 = router.getAmountsOut( inputAmountHalf, path1 ); minAmountSwap1 = amountsOut1[amountsOut1.length - 1]; } address token0 = path0.length == 0 ? path1[0] : path0[path0.length - 1]; address token1 = path1.length == 0 ? path0[0] : path1[path1.length - 1]; IApePair lp = IApePair(factory.getPair(token0, token1)); (uint256 reserveA, uint256 reserveB, ) = lp.getReserves(); if (token0 == lp.token1()) { (reserveA, reserveB) = (reserveB, reserveA); } uint256 amountB = router.quote(minAmountSwap0, reserveA, reserveB); minAmountsSwap = [minAmountSwap0, minAmountSwap1]; minAmountsLP = [minAmountSwap0, amountB]; } function _zapInternal( IERC20 inputToken, uint256 inputAmount, address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] address to, uint256 deadline ) internal { uint256 balanceBefore = _getBalance(inputToken); inputToken.safeTransferFrom(msg.sender, address(this), inputAmount); inputAmount = _getBalance(inputToken) - balanceBefore; _zapPrivate( inputToken, inputAmount, lpTokens, path0, path1, minAmountsSwap, minAmountsLP, to, deadline, false ); emit Zap(address(inputToken), inputAmount, lpTokens); } function _zapNativeInternal( address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] address to, uint256 deadline ) internal { (uint256 inputAmount, IERC20 inputToken) = _wrapNative(); _zapPrivate( inputToken, inputAmount, lpTokens, path0, path1, minAmountsSwap, minAmountsLP, to, deadline, true ); emit ZapNative(inputAmount, lpTokens); } /// @notice Wrap the msg.value into the Wrapped Native token /// @return amount Amount of native tokens wrapped /// @return wNative The IERC20 representation of the wrapped asset function _wrapNative() internal returns (uint256 amount, IERC20 wNative) { wNative = IERC20(WNATIVE); amount = msg.value; IWETH(WNATIVE).deposit{value: amount}(); } function _transfer( address token, uint256 amount, bool native ) internal { if (amount == 0) return; if (token == WNATIVE && native) { IWETH(WNATIVE).withdraw(amount); // 2600 COLD_ACCOUNT_ACCESS_COST plus 2300 transfer gas - 1 // Intended to support transfers to contracts, but not allow for further code execution (bool success, ) = msg.sender.call{value: amount, gas: 4899}(""); require(success, "native transfer error"); } else { IERC20(token).safeTransfer(msg.sender, amount); } } /// @notice Swap single token to single token /// @param amountIn Amount of input token to pass in /// @param amountOutMin Min amount of output token to accept /// @param path Path from input token to output token /// @param deadline Unix timestamp after which the transaction will revert /// @return amountOut The final amount of output tokens received function _routerSwap( uint256 amountIn, uint256 amountOutMin, address[] memory path, uint256 deadline ) internal returns (uint256 amountOut) { address outputToken = path[path.length - 1]; uint256 balanceBefore = _getBalance(IERC20(outputToken)); router.swapExactTokensForTokens( amountIn, amountOutMin, path, address(this), deadline ); amountOut = _getBalance(IERC20(outputToken)) - balanceBefore; } function _getBalance(IERC20 token) internal view returns (uint256 balance) { balance = token.balanceOf(address(this)); } function _zapPrivate( IERC20 inputToken, uint256 inputAmount, address[] memory lpTokens, //[tokenA, tokenB] address[] calldata path0, address[] calldata path1, uint256[] memory minAmountsSwap, //[A, B] uint256[] memory minAmountsLP, //[amountAMin, amountBMin] address to, uint256 deadline, bool native ) private { require(to != address(0), "ApeSwapZap: Can't zap to null address"); require( lpTokens.length == 2, "ApeSwapZap: need exactly 2 tokens to form a LP" ); require( factory.getPair(lpTokens[0], lpTokens[1]) != address(0), "ApeSwapZap: Pair doesn't exist" ); BalanceLocalVars memory vars; inputToken.approve(address(router), inputAmount); vars.amount0 = inputAmount / 2; if (lpTokens[0] != address(inputToken)) { require( path0[0] == address(inputToken), "ApeSwapZap: wrong path path0[0]" ); require( path0[path0.length - 1] == lpTokens[0], "ApeSwapZap: wrong path path0[-1]" ); vars.amount0 = _routerSwap( vars.amount0, minAmountsSwap[0], path0, deadline ); } vars.amount1 = inputAmount / 2; if (lpTokens[1] != address(inputToken)) { require( path1[0] == address(inputToken), "ApeSwapZap: wrong path path1[0]" ); require( path1[path1.length - 1] == lpTokens[1], "ApeSwapZap: wrong path path1[-1]" ); vars.amount1 = _routerSwap( vars.amount1, minAmountsSwap[1], path1, deadline ); } IERC20(lpTokens[0]).approve(address(router), vars.amount0); IERC20(lpTokens[1]).approve(address(router), vars.amount1); (uint256 amountA, uint256 amountB, ) = router.addLiquidity( lpTokens[0], lpTokens[1], vars.amount0, vars.amount1, minAmountsLP[0], minAmountsLP[1], to, deadline ); if (lpTokens[0] == WNATIVE) { // Ensure WNATIVE is called last _transfer(lpTokens[1], vars.amount1 - amountB, native); _transfer(lpTokens[0], vars.amount0 - amountA, native); } else { _transfer(lpTokens[0], vars.amount0 - amountA, native); _transfer(lpTokens[1], vars.amount1 - amountB, native); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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"); } } }
// 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); }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"contract IApeRouter02","name":"_router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IApePair","name":"lp","type":"address"},{"indexed":false,"internalType":"contract IApeRouter02","name":"fromRouter","type":"address"},{"indexed":false,"internalType":"contract IApeRouter02","name":"toRouter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LPMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"lpTokens","type":"address[]"}],"name":"Zap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"lpTokens","type":"address[]"}],"name":"ZapNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"contract ICustomBill","name":"bill","type":"address"}],"name":"ZapTBill","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"contract ICustomBill","name":"bill","type":"address"}],"name":"ZapTBillNative","type":"event"},{"inputs":[],"name":"WNATIVE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"apeRouter","outputs":[{"internalType":"contract IApeRouter02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IApeFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address[]","name":"path0","type":"address[]"},{"internalType":"address[]","name":"path1","type":"address[]"}],"name":"getMinAmounts","outputs":[{"internalType":"uint256[2]","name":"minAmountsSwap","type":"uint256[2]"},{"internalType":"uint256[2]","name":"minAmountsLP","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IApeRouter02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address[]","name":"lpTokens","type":"address[]"},{"internalType":"address[]","name":"path0","type":"address[]"},{"internalType":"address[]","name":"path1","type":"address[]"},{"internalType":"uint256[]","name":"minAmountsSwap","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmountsLP","type":"uint256[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"zap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IApeRouter02","name":"router","type":"address"},{"internalType":"contract IApePair","name":"lp","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"amountAMinRemove","type":"uint256"},{"internalType":"uint256","name":"amountBMinRemove","type":"uint256"},{"internalType":"uint256","name":"amountAMinAdd","type":"uint256"},{"internalType":"uint256","name":"amountBMinAdd","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"zapLPMigrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"lpTokens","type":"address[]"},{"internalType":"address[]","name":"path0","type":"address[]"},{"internalType":"address[]","name":"path1","type":"address[]"},{"internalType":"uint256[]","name":"minAmountsSwap","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmountsLP","type":"uint256[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"zapNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"minAmountsSwap","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"contract ICustomBill","name":"bill","type":"address"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"zapSingleAssetTBill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"minAmountsSwap","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"contract ICustomBill","name":"bill","type":"address"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"zapSingleAssetTBillNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address[]","name":"lpTokens","type":"address[]"},{"internalType":"address[]","name":"path0","type":"address[]"},{"internalType":"address[]","name":"path1","type":"address[]"},{"internalType":"uint256[]","name":"minAmountsSwap","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmountsLP","type":"uint256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"contract ICustomBill","name":"bill","type":"address"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"zapTBill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"lpTokens","type":"address[]"},{"internalType":"address[]","name":"path0","type":"address[]"},{"internalType":"address[]","name":"path1","type":"address[]"},{"internalType":"uint256[]","name":"minAmountsSwap","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmountsLP","type":"uint256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"contract ICustomBill","name":"bill","type":"address"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"zapTBillNative","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101006040523480156200001257600080fd5b5060405162003d0d38038062003d0d833981016040819052620000359162000168565b60016000556001600160a01b03811660808190526040805163c45a015560e01b8152905183928392909163c45a0155916004808201926020929091908290030181865afa1580156200008b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b1919062000168565b6001600160a01b031660a0816001600160a01b0316815250506080516001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200010b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000131919062000168565b6001600160a01b0390811660c0529190911660e052506200018f9050565b6001600160a01b03811681146200016557600080fd5b50565b6000602082840312156200017b57600080fd5b815162000188816200014f565b9392505050565b60805160a05160c05160e051613aab62000262600039600081816101ad015281816114f501528181611587015281816115fa015261172201526000818160bb0152818161022c01528181611f3901528181611f5f0152818161298101528181612a9e0152612af501526000818161027301528181610ca301526121800152600081816102fa015281816104b001528181610a3101528181610afd01528181610e2f015281816118fb01528181611b3b015281816122d101528181612735015281816127e5015261286f0152613aab6000f3fe6080604052600436106100ab5760003560e01c8063bf2ac34311610064578063bf2ac3431461024e578063c45a015514610261578063cdf8bec514610295578063dcb0536e146102b5578063f75cf34a146102d5578063f887ea40146102e857600080fd5b806369088487146101485780637486f33014610168578063762800361461018857806392f687781461019b578063a449ef08146101ec578063b381cf401461021a57600080fd5b3661014357336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101415760405162461bcd60e51b815260206004820152602b60248201527f417065537761705a61703a204f6e6c792072656365697665206574686572206660448201526a1c9bdb481ddc985c1c195960aa1b60648201526084015b60405180910390fd5b005b600080fd5b34801561015457600080fd5b50610141610163366004612ded565b61031c565b34801561017457600080fd5b50610141610183366004612fb4565b6105c7565b6101416101963660046130cc565b610613565b3480156101a757600080fd5b506101cf7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101f857600080fd5b5061020c6102073660046131cc565b610988565b6040516101e3929190613268565b34801561022657600080fd5b506101cf7f000000000000000000000000000000000000000000000000000000000000000081565b61014161025c366004613283565b610edc565b34801561026d57600080fd5b506101cf7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a157600080fd5b506101416102b0366004613378565b610f24565b3480156102c157600080fd5b506101416102d03660046134b3565b6112b5565b6101416102e336600461351e565b611794565b3480156102f457600080fd5b506101cf7f000000000000000000000000000000000000000000000000000000000000000081565b60026000540361033e5760405162461bcd60e51b815260040161013890613590565b60026000819055506000826001600160a01b031663dbc162de6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac91906135c7565b9050868660008181106103c1576103c16135e4565b90506020020160208101906103d691906135fa565b6001600160a01b0316896001600160a01b0316148015610437575086866103fe600182613617565b81811061040d5761040d6135e4565b905060200201602081019061042291906135fa565b6001600160a01b0316816001600160a01b0316145b6104535760405162461bcd60e51b81526004016101389061363c565b600061045e8a611a08565b90506104756001600160a01b038b1633308c611a79565b8061047f8b611a08565b6104899190613617565b60405163095ea7b360e01b81529099506001600160a01b038b169063095ea7b3906104da907f0000000000000000000000000000000000000000000000000000000000000000908d90600401613699565b6020604051808303816000875af11580156104f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051d91906136b2565b5061055e89878a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250611aea915050565b5061056b84838533611bdf565b50604080516001600160a01b038c81168252602082018c905286168183015290517f452471abcb188a45e0b1afd12999cf4df9ed51c4b01cf813bbbdabaa9b382cad9181900360600190a1505060016000555050505050505050565b6002600054036105e95760405162461bcd60e51b815260040161013890613590565b60026000556106018b8b8b8b8b8b8b8b8b8b8b611e10565b50506001600055505050505050505050565b6002600054036106355760405162461bcd60e51b815260040161013890613590565b60026000819055506000826001600160a01b031663dbc162de6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561067f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a391906135c7565b9050806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070791906135c7565b6001600160a01b03168b600081518110610723576107236135e4565b60200260200101516001600160a01b03161480156107cd5750806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561077a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079e91906135c7565b6001600160a01b03168b6001815181106107ba576107ba6135e4565b60200260200101516001600160a01b0316145b806108fb5750806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083591906135c7565b6001600160a01b03168b600181518110610851576108516135e4565b60200260200101516001600160a01b03161480156108fb5750806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cc91906135c7565b6001600160a01b03168b6000815181106108e8576108e86135e4565b60200260200101516001600160a01b0316145b6109175760405162461bcd60e51b8152600401610138906136d4565b6109288b8b8b8b8b8b8b308c611ea6565b61093483828433611bdf565b50604080513481526001600160a01b03851660208201527fbba058d4778dd4dfe5b28e159c111e8a68aefcb03e525413f08586f1ab6770d1910160405180910390a150506001600055505050505050505050565b610990612d5c565b610998612d5c565b6002851015806109a9575060028310155b610a015760405162461bcd60e51b815260206004820152602360248201527f417065537761705a61703a204e65656473206174206c65617374206f6e6520706044820152620c2e8d60eb1b6064820152608401610138565b6000610a0e600289613717565b9050808615610adc5760405163d06ca61f60e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d06ca61f90610a6a9086908d908d90600401613739565b600060405180830381865afa158015610a87573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610aaf9190810190613791565b90508060018251610ac09190613617565b81518110610ad057610ad06135e4565b60200260200101519150505b818515610ba85760405163d06ca61f60e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d06ca61f90610b369087908c908c90600401613739565b600060405180830381865afa158015610b53573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b7b9190810190613791565b90508060018251610b8c9190613617565b81518110610b9c57610b9c6135e4565b60200260200101519150505b60008815610be6578989610bbd600182613617565b818110610bcc57610bcc6135e4565b9050602002016020810190610be191906135fa565b610c0e565b87876000818110610bf957610bf96135e4565b9050602002016020810190610c0e91906135fa565b905060008715610c4e578888610c25600182613617565b818110610c3457610c346135e4565b9050602002016020810190610c4991906135fa565b610c76565b8a8a6000818110610c6157610c616135e4565b9050602002016020810190610c7691906135fa565b60405163e6a4390560e01b81526001600160a01b03848116600483015280831660248301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063e6a4390590604401602060405180830381865afa158015610cea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0e91906135c7565b9050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610d51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d75919061382d565b506001600160701b031691506001600160701b03169150826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee91906135c7565b6001600160a01b0316856001600160a01b031603610e0857905b604051632b58577b60e21b81526004810188905260248101839052604481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ad615dec90606401602060405180830381865afa158015610e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea2919061387d565b6040805180820182528a815260208082019a909a5281518083019092529981529788015250959e949d50939b505050505050505050505050565b600260005403610efe5760405162461bcd60e51b815260040161013890613590565b6002600055610f14898989898989898989611ea6565b5050600160005550505050505050565b600260005403610f465760405162461bcd60e51b815260040161013890613590565b60026000819055506000826001600160a01b031663dbc162de6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610f90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb491906135c7565b9050806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101891906135c7565b6001600160a01b03168b600081518110611034576110346135e4565b60200260200101516001600160a01b03161480156110de5750806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561108b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110af91906135c7565b6001600160a01b03168b6001815181106110cb576110cb6135e4565b60200260200101516001600160a01b0316145b8061120c5750806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611122573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114691906135c7565b6001600160a01b03168b600181518110611162576111626135e4565b60200260200101516001600160a01b031614801561120c5750806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dd91906135c7565b6001600160a01b03168b6000815181106111f9576111f96135e4565b60200260200101516001600160a01b0316145b6112285760405162461bcd60e51b8152600401610138906136d4565b61123b8d8d8d8d8d8d8d8d8d308e611e10565b61124783828433611bdf565b507f452471abcb188a45e0b1afd12999cf4df9ed51c4b01cf813bbbdabaa9b382cad8d8d85604051611299939291906001600160a01b0393841681526020810192909252909116604082015260600190565b60405180910390a1505060016000555050505050505050505050565b6002600054036112d75760405162461bcd60e51b815260040161013890613590565b60026000819055506000876001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561131f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134391906135c7565b90506000886001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906135c7565b90506113c06001600160a01b038a1633308b611a79565b60405163095ea7b360e01b81526001600160a01b038a169063095ea7b3906113ee908d908c90600401613699565b6020604051808303816000875af115801561140d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143191906136b2565b50604051635d5155ef60e11b81526001600160a01b0383811660048301528281166024830152604482018a905260648201899052608482018890523060a483015260c4820185905260009182918d169063baa2abde9060e40160408051808303816000875af11580156114a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cc9190613896565b60405163095ea7b360e01b815291935091506001600160a01b0385169063095ea7b39061151f907f0000000000000000000000000000000000000000000000000000000000000000908690600401613699565b6020604051808303816000875af115801561153e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156291906136b2565b5060405163095ea7b360e01b81526001600160a01b0384169063095ea7b3906115b1907f0000000000000000000000000000000000000000000000000000000000000000908590600401613699565b6020604051808303816000875af11580156115d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f491906136b2565b506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e8e33700878787878e8e338f6040518963ffffffff1660e01b81526004016116529897969594939291906138ba565b6060604051808303816000875af1158015611671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116959190613903565b50909250905060006116a78386613617565b11156116cc576116cc336116bb8487613617565b6001600160a01b0389169190611f10565b60006116d88285613617565b11156116fd576116fd336116ec8386613617565b6001600160a01b0388169190611f10565b7fbef8fc428932b971d2badb42f83b58752429ad4733367b71f4bddbd2023b99f88d8f7f00000000000000000000000000000000000000000000000000000000000000008f60405161177794939291906001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b60405180910390a150506001600055505050505050505050505050565b6002600054036117b65760405162461bcd60e51b815260040161013890613590565b60026000908155806117c6611f34565b915091506000846001600160a01b031663dbc162de6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561180c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183091906135c7565b905088886000818110611845576118456135e4565b905060200201602081019061185a91906135fa565b6001600160a01b0316826001600160a01b03161480156118bb57508888611882600182613617565b818110611891576118916135e4565b90506020020160208101906118a691906135fa565b6001600160a01b0316816001600160a01b0316145b6118d75760405162461bcd60e51b81526004016101389061363c565b60405163095ea7b360e01b81526001600160a01b0383169063095ea7b390611925907f0000000000000000000000000000000000000000000000000000000000000000908790600401613699565b6020604051808303816000875af1158015611944573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196891906136b2565b506119a983888b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508c9250611aea915050565b506119b685828633611bdf565b50604080518481526001600160a01b03871660208201527fbba058d4778dd4dfe5b28e159c111e8a68aefcb03e525413f08586f1ab6770d1910160405180910390a15050600160005550505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a73919061387d565b92915050565b6040516001600160a01b0380851660248301528316604482015260648101829052611ae49085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fd5565b50505050565b6000808360018551611afc9190613617565b81518110611b0c57611b0c6135e4565b602002602001015190506000611b2182611a08565b6040516338ed173960e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906338ed173990611b78908a908a908a9030908b90600401613975565b6000604051808303816000875af1158015611b97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bbf9190810190613791565b5080611bca83611a08565b611bd49190613617565b979650505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4a919061387d565b905060008111611ca85760405162461bcd60e51b8152602060048201526024808201527f417065537761705a61705442696c6c733a204e6f7468696e6720746f206465706044820152631bdcda5d60e21b6064820152608401610138565b60405163095ea7b360e01b81526001600160a01b0385169063095ea7b390611cd69088908590600401613699565b6020604051808303816000875af1158015611cf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1991906136b2565b50604051638dbdbe6d60e01b815260048101829052602481018490526001600160a01b038381166044830152861690638dbdbe6d906064016020604051808303816000875af1158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d94919061387d565b5060405163095ea7b360e01b81526001600160a01b0385169063095ea7b390611dc4908890600090600401613699565b6020604051808303816000875af1158015611de3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0791906136b2565b50949350505050565b6000611e1b8c611a08565b9050611e326001600160a01b038d1633308e611a79565b80611e3c8d611a08565b611e469190613617565b9a50611e5d8c8c8c8c8c8c8c8c8c8c8c60006120a7565b7f1fd2bf03b44ce5cb29193cc54927f3fae3203d6bee3b52fa2b41b0ae38d9dd7d8c8c8c604051611e90939291906139b1565b60405180910390a1505050505050505050505050565b600080611eb1611f34565b91509150611eca81838d8d8d8d8d8d8d8d8d60016120a7565b7f2e4eeaaef6f24db22c68d3447461155fb43767e27eefa5655f863218ab23aa04828c604051611efb9291906139e1565b60405180910390a15050505050505050505050565b611f2f8363a9059cbb60e01b8484604051602401611aad929190613699565b505050565b6000807f000000000000000000000000000000000000000000000000000000000000000090503491507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015611fb857600080fd5b505af1158015611fcc573d6000803e3d6000fd5b50505050509091565b600061202a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a769092919063ffffffff16565b805190915015611f2f578080602001905181019061204891906136b2565b611f2f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610138565b6001600160a01b03831661210b5760405162461bcd60e51b815260206004820152602560248201527f417065537761705a61703a2043616e2774207a617020746f206e756c6c206164604482015264647265737360d81b6064820152608401610138565b89516002146121735760405162461bcd60e51b815260206004820152602e60248201527f417065537761705a61703a206e6565642065786163746c79203220746f6b656e60448201526d07320746f20666f726d2061204c560941b6064820152608401610138565b60006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e6a439058c6000815181106121c0576121c06135e4565b60200260200101518d6001815181106121db576121db6135e4565b60200260200101516040518363ffffffff1660e01b81526004016122159291906001600160a01b0392831681529116602082015260400190565b602060405180830381865afa158015612232573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225691906135c7565b6001600160a01b0316036122ac5760405162461bcd60e51b815260206004820152601e60248201527f417065537761705a61703a205061697220646f65736e277420657869737400006044820152606401610138565b60408051808201909152600080825260208201528c6001600160a01b031663095ea7b37f00000000000000000000000000000000000000000000000000000000000000008e6040518363ffffffff1660e01b815260040161230e929190613699565b6020604051808303816000875af115801561232d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061235191906136b2565b5061235d60028d613717565b81528a516001600160a01b038e16908c9060009061237d5761237d6135e4565b60200260200101516001600160a01b03161461252a578c6001600160a01b03168a8a60008181106123b0576123b06135e4565b90506020020160208101906123c591906135fa565b6001600160a01b03161461241b5760405162461bcd60e51b815260206004820152601f60248201527f417065537761705a61703a2077726f6e6720706174682070617468305b305d006044820152606401610138565b8a60008151811061242e5761242e6135e4565b60209081029190910101516001600160a01b03168a8a61244f600182613617565b81811061245e5761245e6135e4565b905060200201602081019061247391906135fa565b6001600160a01b0316146124c95760405162461bcd60e51b815260206004820181905260248201527f417065537761705a61703a2077726f6e6720706174682070617468305b2d315d6044820152606401610138565b6125278160000151876000815181106124e4576124e46135e4565b60200260200101518c8c80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250899250611aea915050565b81525b61253560028d613717565b60208201528a516001600160a01b038e16908c90600190811061255a5761255a6135e4565b60200260200101516001600160a01b03161461270a578c6001600160a01b03168888600081811061258d5761258d6135e4565b90506020020160208101906125a291906135fa565b6001600160a01b0316146125f85760405162461bcd60e51b815260206004820152601f60248201527f417065537761705a61703a2077726f6e6720706174682070617468315b305d006044820152606401610138565b8a60018151811061260b5761260b6135e4565b60209081029190910101516001600160a01b0316888861262c600182613617565b81811061263b5761263b6135e4565b905060200201602081019061265091906135fa565b6001600160a01b0316146126a65760405162461bcd60e51b815260206004820181905260248201527f417065537761705a61703a2077726f6e6720706174682070617468315b2d315d6044820152606401610138565b6127048160200151876001815181106126c1576126c16135e4565b60200260200101518a8a80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250899250611aea915050565b60208201525b8a60008151811061271d5761271d6135e4565b60200260200101516001600160a01b031663095ea7b37f000000000000000000000000000000000000000000000000000000000000000083600001516040518363ffffffff1660e01b8152600401612776929190613699565b6020604051808303816000875af1158015612795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b991906136b2565b508a6001815181106127cd576127cd6135e4565b60200260200101516001600160a01b031663095ea7b37f000000000000000000000000000000000000000000000000000000000000000083602001516040518363ffffffff1660e01b8152600401612826929190613699565b6020604051808303816000875af1158015612845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286991906136b2565b506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e8e337008e6000815181106128af576128af6135e4565b60200260200101518f6001815181106128ca576128ca6135e4565b6020026020010151866000015187602001518c6000815181106128ef576128ef6135e4565b60200260200101518d60018151811061290a5761290a6135e4565b60200260200101518d8d6040518963ffffffff1660e01b81526004016129379897969594939291906138ba565b6060604051808303816000875af1158015612956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061297a9190613903565b50915091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168d6000815181106129bc576129bc6135e4565b60200260200101516001600160a01b031603612a3957612a068d6001815181106129e8576129e86135e4565b6020026020010151828560200151612a009190613617565b86612a8f565b612a348d600081518110612a1c57612a1c6135e4565b6020026020010151838560000151612a009190613617565b612a65565b612a4f8d600081518110612a1c57612a1c6135e4565b612a658d6001815181106129e8576129e86135e4565b505050505050505050505050505050565b6060612a858484600085612c02565b90505b9392505050565b81600003612a9c57505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316148015612ada5750805b15612bee57604051632e1a7d4d60e01b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612b4157600080fd5b505af1158015612b55573d6000803e3d6000fd5b50506040516000925033915061132390859084818181858888f193505050503d8060008114612ba0576040519150601f19603f3d011682016040523d82523d6000602084013e612ba5565b606091505b5050905080611ae45760405162461bcd60e51b81526020600482015260156024820152743730ba34bb32903a3930b739b332b91032b93937b960591b6044820152606401610138565b611f2f6001600160a01b0384163384611f10565b606082471015612c635760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610138565b6001600160a01b0385163b612cba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610138565b600080866001600160a01b03168587604051612cd69190613a26565b60006040518083038185875af1925050503d8060008114612d13576040519150601f19603f3d011682016040523d82523d6000602084013e612d18565b606091505b5091509150611bd482828660608315612d32575081612a88565b825115612d425782518084602001fd5b8160405162461bcd60e51b81526004016101389190613a42565b60405180604001604052806002906020820280368337509192915050565b6001600160a01b0381168114612d8f57600080fd5b50565b8035612d9d81612d7a565b919050565b60008083601f840112612db457600080fd5b5081356001600160401b03811115612dcb57600080fd5b6020830191508360208260051b8501011115612de657600080fd5b9250929050565b60008060008060008060008060e0898b031215612e0957600080fd5b8835612e1481612d7a565b97506020890135965060408901356001600160401b03811115612e3657600080fd5b612e428b828c01612da2565b909750955050606089013593506080890135925060a0890135612e6481612d7a565b8092505060c089013590509295985092959890939650565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612eba57612eba612e7c565b604052919050565b60006001600160401b03821115612edb57612edb612e7c565b5060051b60200190565b600082601f830112612ef657600080fd5b81356020612f0b612f0683612ec2565b612e92565b82815260059290921b84018101918181019086841115612f2a57600080fd5b8286015b84811015612f4e578035612f4181612d7a565b8352918301918301612f2e565b509695505050505050565b600082601f830112612f6a57600080fd5b81356020612f7a612f0683612ec2565b82815260059290921b84018101918181019086841115612f9957600080fd5b8286015b84811015612f4e5780358352918301918301612f9d565b60008060008060008060008060008060006101208c8e031215612fd657600080fd5b612fdf8c612d92565b9a5060208c013599506001600160401b038060408e0135111561300157600080fd5b6130118e60408f01358f01612ee5565b99508060608e0135111561302457600080fd5b6130348e60608f01358f01612da2565b909950975060808d013581101561304a57600080fd5b61305a8e60808f01358f01612da2565b909750955060a08d013581101561307057600080fd5b6130808e60a08f01358f01612f59565b94508060c08e0135111561309357600080fd5b506130a48d60c08e01358e01612f59565b92506130b260e08d01612d92565b91506101008c013590509295989b509295989b9093969950565b6000806000806000806000806000806101008b8d0312156130ec57600080fd5b8a356001600160401b038082111561310357600080fd5b61310f8e838f01612ee5565b9b5060208d013591508082111561312557600080fd5b6131318e838f01612da2565b909b50995060408d013591508082111561314a57600080fd5b6131568e838f01612da2565b909950975060608d013591508082111561316f57600080fd5b61317b8e838f01612f59565b965060808d013591508082111561319157600080fd5b5061319e8d828e01612f59565b94505060a08b013592506131b460c08c01612d92565b915060e08b013590509295989b9194979a5092959850565b6000806000806000606086880312156131e457600080fd5b8535945060208601356001600160401b038082111561320257600080fd5b61320e89838a01612da2565b9096509450604088013591508082111561322757600080fd5b5061323488828901612da2565b969995985093965092949392505050565b8060005b6002811015611ae4578151845260209384019390910190600101613249565b608081016132768285613245565b612a886040830184613245565b600080600080600080600080600060e08a8c0312156132a157600080fd5b89356001600160401b03808211156132b857600080fd5b6132c48d838e01612ee5565b9a5060208c01359150808211156132da57600080fd5b6132e68d838e01612da2565b909a50985060408c01359150808211156132ff57600080fd5b61330b8d838e01612da2565b909850965060608c013591508082111561332457600080fd5b6133308d838e01612f59565b955060808c013591508082111561334657600080fd5b506133538c828d01612f59565b93505061336260a08b01612d92565b915060c08a013590509295985092959850929598565b6000806000806000806000806000806000806101408d8f03121561339b57600080fd5b6133a48d612d92565b9b5060208d01359a506001600160401b0360408e013511156133c557600080fd5b6133d58e60408f01358f01612ee5565b99506001600160401b0360608e013511156133ef57600080fd5b6133ff8e60608f01358f01612da2565b90995097506001600160401b0360808e0135111561341c57600080fd5b61342c8e60808f01358f01612da2565b90975095506001600160401b0360a08e0135111561344957600080fd5b6134598e60a08f01358f01612f59565b94506001600160401b0360c08e0135111561347357600080fd5b6134838e60c08f01358f01612f59565b935060e08d013592506134996101008e01612d92565b91506101208d013590509295989b509295989b509295989b565b600080600080600080600080610100898b0312156134d057600080fd5b88356134db81612d7a565b975060208901356134eb81612d7a565b979a9799505050506040860135956060810135956080820135955060a0820135945060c0820135935060e0909101359150565b60008060008060008060a0878903121561353757600080fd5b86356001600160401b0381111561354d57600080fd5b61355989828a01612da2565b9097509550506020870135935060408701359250606087013561357b81612d7a565b80925050608087013590509295509295509295565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000602082840312156135d957600080fd5b8151612a8881612d7a565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561360c57600080fd5b8135612a8881612d7a565b60008282101561363757634e487b7160e01b600052601160045260246000fd5b500390565b6020808252603d908201527f417065537761705a61705442696c6c733a2057726f6e67207061746820666f7260408201527f20696e707574546f6b656e206f72207072696e636970616c546f6b656e000000606082015260800190565b6001600160a01b03929092168252602082015260400190565b6000602082840312156136c457600080fd5b81518015158114612a8857600080fd5b60208082526023908201527f417065537761705a61703a2057726f6e67204c50207061697220666f722054426040820152621a5b1b60ea1b606082015260800190565b60008261373457634e487b7160e01b600052601260045260246000fd5b500490565b83815260406020808301829052908201839052600090849060608401835b8681101561378557833561376a81612d7a565b6001600160a01b031682529282019290820190600101613757565b50979650505050505050565b600060208083850312156137a457600080fd5b82516001600160401b038111156137ba57600080fd5b8301601f810185136137cb57600080fd5b80516137d9612f0682612ec2565b81815260059190911b820183019083810190878311156137f857600080fd5b928401925b82841015611bd4578351825292840192908401906137fd565b80516001600160701b0381168114612d9d57600080fd5b60008060006060848603121561384257600080fd5b61384b84613816565b925061385960208501613816565b9150604084015163ffffffff8116811461387257600080fd5b809150509250925092565b60006020828403121561388f57600080fd5b5051919050565b600080604083850312156138a957600080fd5b505080516020909101519092909150565b6001600160a01b039889168152968816602088015260408701959095526060860193909352608085019190915260a084015290921660c082015260e08101919091526101000190565b60008060006060848603121561391857600080fd5b8351925060208401519150604084015190509250925092565b600081518084526020808501945080840160005b8381101561396a5781516001600160a01b031687529582019590820190600101613945565b509495945050505050565b85815284602082015260a06040820152600061399460a0830186613931565b6001600160a01b0394909416606083015250608001529392505050565b60018060a01b03841681528260208201526060604082015260006139d86060830184613931565b95945050505050565b828152604060208201526000612a856040830184613931565b60005b83811015613a155781810151838201526020016139fd565b83811115611ae45750506000910152565b60008251613a388184602087016139fa565b9190910192915050565b6020815260008251806020840152613a618160408501602087016139fa565b601f01601f1916919091016040019291505056fea264697066735822122092da0c2e62009f172765f71b2ee95af5e1c131599799ee659cb811645f24517864736f6c634300080f00330000000000000000000000007d13268144adcdbebdf94f654085cc15502849ff
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007d13268144adcdbebdf94f654085cc15502849ff
-----Decoded View---------------
Arg [0] : _router (address): 0x7d13268144adcdbebdf94f654085cc15502849ff
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000007d13268144adcdbebdf94f654085cc15502849ff
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.