Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
[ Download CSV Export ]
Contract Name:
UniswapV2Connector
Compiler Version
v0.8.2+commit.661d1103
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; import "./interfaces/IExchangeConnector.sol"; import "../uniswap/v2-periphery/interfaces/IUniswapV2Router02.sol"; import "../uniswap/v2-core/interfaces/IUniswapV2Pair.sol"; import "../uniswap/v2-core/interfaces/IUniswapV2Factory.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract UniswapV2Connector is IExchangeConnector, Ownable, ReentrancyGuard { modifier nonZeroAddress(address _address) { require(_address != address(0), "UniswapV2Connector: zero address"); _; } string public override name; address public override exchangeRouter; address public override liquidityPoolFactory; address public override wrappedNativeToken; /// @notice This contract is used for interacting with UniswapV2 contract /// @param _name Name of the underlying DEX /// @param _exchangeRouter Address of the DEX router contract constructor(string memory _name, address _exchangeRouter) { name = _name; exchangeRouter = _exchangeRouter; liquidityPoolFactory = IUniswapV2Router02(exchangeRouter).factory(); wrappedNativeToken = IUniswapV2Router02(exchangeRouter).WETH(); } function renounceOwnership() public virtual override onlyOwner {} /// @notice Setter for exchange router /// @dev Gets address of liquidity pool factory from new exchange router /// @param _exchangeRouter Address of the new exchange router contract function setExchangeRouter(address _exchangeRouter) external nonZeroAddress(_exchangeRouter) override onlyOwner { exchangeRouter = _exchangeRouter; liquidityPoolFactory = IUniswapV2Router02(exchangeRouter).factory(); wrappedNativeToken = IUniswapV2Router02(exchangeRouter).WETH(); } /// @notice Setter for liquidity pool factory /// @dev Gets address from exchange router function setLiquidityPoolFactory() external override onlyOwner { liquidityPoolFactory = IUniswapV2Router02(exchangeRouter).factory(); } /// @notice Setter for wrapped native token /// @dev Gets address from exchange router function setWrappedNativeToken() external override onlyOwner { wrappedNativeToken = IUniswapV2Router02(exchangeRouter).WETH(); } /// @notice Returns required input amount to get desired output amount /// @dev Returns (false, 0) if liquidity pool of inputToken-outputToken doesn't exist /// Returns (false, 0) if desired output amount is greater than or equal to output reserve /// @param _outputAmount Desired output amount /// @param _inputToken Address of the input token /// @param _outputToken Address of the output token function getInputAmount( uint _outputAmount, address _inputToken, address _outputToken ) external view nonZeroAddress(_inputToken) nonZeroAddress(_outputToken) override returns (bool, uint) { // Checks that the liquidity pool exists address liquidityPool = IUniswapV2Factory(liquidityPoolFactory).getPair(_inputToken, _outputToken); if ( liquidityPool == address(0) ) { return (false, 0); } // Gets reserve of output token and checks that enough output token exists address token0 = IUniswapV2Pair(liquidityPool).token0(); (uint reserveIn, uint reserveOut, /*timestamp*/) = IUniswapV2Pair(liquidityPool).getReserves(); if (token0 == _inputToken) { if (_outputAmount >= reserveOut) { return (false, 0); } } else { if (_outputAmount >= reserveIn) { return (false, 0); } } address[] memory path = new address[](2); path[0] = _inputToken; path[1] = _outputToken; uint[] memory result = IUniswapV2Router02(exchangeRouter).getAmountsIn(_outputAmount, path); return (true, result[0]); } /// @notice Returns amount of output token that user receives /// @dev Returns (false, 0) if liquidity pool of inputToken-outputToken doesn't exist /// @param _inputAmount Amount of input token /// @param _inputToken Address of the input token /// @param _outputToken Address of the output token function getOutputAmount( uint _inputAmount, address _inputToken, address _outputToken ) external view nonZeroAddress(_inputToken) nonZeroAddress(_outputToken) override returns (bool, uint) { // Checks that the liquidity pool exists if ( IUniswapV2Factory(liquidityPoolFactory).getPair(_inputToken, _outputToken) == address(0) ) { return (false, 0); } address[] memory path = new address[](2); path[0] = _inputToken; path[1] = _outputToken; uint[] memory result = IUniswapV2Router02(exchangeRouter).getAmountsOut(_inputAmount, path); return (true, result[1]); } /// @notice Exchanges input token for output token through exchange router /// @dev Checks exchange conditions before exchanging /// We assume that the input token is not WETH (it is teleBTC) /// @param _inputAmount Amount of input token /// @param _outputAmount Amount of output token /// @param _path List of tokens that are used for exchanging /// @param _to Receiver address /// @param _deadline Deadline of exchanging tokens /// @param _isFixedToken True if the input token amount is fixed /// @return _result True if the exchange is successful /// @return _amounts Amounts of tokens that are involved in exchanging function swap( uint256 _inputAmount, uint256 _outputAmount, address[] memory _path, address _to, uint256 _deadline, bool _isFixedToken ) external nonReentrant nonZeroAddress(_to) override returns (bool _result, uint[] memory _amounts) { uint neededInputAmount; (_result, neededInputAmount) = _checkExchangeConditions( _inputAmount, _outputAmount, _path, _deadline, _isFixedToken ); if (_result) { // Gets tokens from user IERC20(_path[0]).transferFrom(_msgSender(), address(this), neededInputAmount); // Gives allowance to exchange router IERC20(_path[0]).approve(exchangeRouter, neededInputAmount); if (_isFixedToken == false && _path[_path.length-1] != wrappedNativeToken) { _amounts = IUniswapV2Router02(exchangeRouter).swapTokensForExactTokens( _outputAmount, _inputAmount, _path, _to, _deadline ); } if (_isFixedToken == false && _path[_path.length-1] == wrappedNativeToken) { _amounts = IUniswapV2Router02(exchangeRouter).swapTokensForExactETH( _outputAmount, _inputAmount, _path, _to, _deadline ); } if (_isFixedToken == true && _path[_path.length-1] != wrappedNativeToken) { _amounts = IUniswapV2Router02(exchangeRouter).swapExactTokensForTokens( _inputAmount, _outputAmount, _path, _to, _deadline ); } if (_isFixedToken == true && _path[_path.length-1] == wrappedNativeToken) { _amounts = IUniswapV2Router02(exchangeRouter).swapExactTokensForETH( _inputAmount, _outputAmount, _path, _to, _deadline ); } emit Swap(_path, _amounts, _to); } } /// @notice Returns true if the exchange path is valid /// @param _path List of tokens that are used for exchanging function isPathValid(address[] memory _path) public view override returns (bool _result) { address liquidityPool; // Checks that path length is greater than one if (_path.length < 2) { return false; } for (uint i = 0; i < _path.length - 1; i++) { liquidityPool = IUniswapV2Factory(liquidityPoolFactory).getPair(_path[i], _path[i + 1]); if (liquidityPool == address(0)) { return false; } } return true; } /// @notice Checks if exchanging can happen successfully /// @dev Avoids reverting the execution by exchange router /// @param _inputAmount Amount of input token /// @param _outputAmount Amount of output token /// @param _path List of tokens that are used for exchanging /// @param _deadline Deadline of exchanging tokens /// @param _isFixedToken True if the input token amount is fixed /// @return True if exchange conditions are satisfied /// @return Needed amount of input token function _checkExchangeConditions( uint256 _inputAmount, uint256 _outputAmount, address[] memory _path, uint256 _deadline, bool _isFixedToken ) private view returns (bool, uint) { // Checks deadline has not passed if (_deadline < block.timestamp) { return (false, 0); } // Checks that the liquidity pool exists if (!isPathValid(_path)) { return (false, 0); } // Finds maximum output amount uint[] memory outputResult = IUniswapV2Router02(exchangeRouter).getAmountsOut( _inputAmount, _path ); // Checks that exchanging is possible or not if (_outputAmount > outputResult[_path.length - 1]) { return (false, 0); } else { if (_isFixedToken == true) { return (true, _inputAmount); } else { uint[] memory inputResult = IUniswapV2Router02(exchangeRouter).getAmountsIn( _outputAmount, _path ); return (true, inputResult[0]); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; interface IExchangeConnector { // Events event Swap(address[] path, uint[] amounts, address receiver); // Read-only functions function name() external view returns (string memory); function exchangeRouter() external view returns (address); function liquidityPoolFactory() external view returns (address); function wrappedNativeToken() external view returns (address); function getInputAmount( uint _outputAmount, address _inputToken, address _outputToken ) external view returns (bool, uint); function getOutputAmount( uint _inputAmount, address _inputToken, address _outputToken ) external view returns (bool, uint); // State-changing functions function setExchangeRouter(address _exchangeRouter) external; function setLiquidityPoolFactory() external; function setWrappedNativeToken() external; function swap( uint256 _inputAmount, uint256 _outputAmount, address[] memory _path, address _to, uint256 _deadline, bool _isFixedToken ) external returns (bool, uint[] memory); function isPathValid(address[] memory _path) external view returns(bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IUniswapV2Factory { 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; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT 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 make 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; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() 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 addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, 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 removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); 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 removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); 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 swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"address","name":"_exchangeRouter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"Swap","type":"event"},{"inputs":[],"name":"exchangeRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_outputAmount","type":"uint256"},{"internalType":"address","name":"_inputToken","type":"address"},{"internalType":"address","name":"_outputToken","type":"address"}],"name":"getInputAmount","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"address","name":"_inputToken","type":"address"},{"internalType":"address","name":"_outputToken","type":"address"}],"name":"getOutputAmount","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"isPathValid","outputs":[{"internalType":"bool","name":"_result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPoolFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_exchangeRouter","type":"address"}],"name":"setExchangeRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setLiquidityPoolFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setWrappedNativeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"uint256","name":"_outputAmount","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bool","name":"_isFixedToken","type":"bool"}],"name":"swap","outputs":[{"internalType":"bool","name":"_result","type":"bool"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedNativeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620020b8380380620020b88339810160408190526200003491620002e5565b6200003f33620001ae565b60018055815162000058906002906020850190620001fe565b50600380546001600160a01b0319166001600160a01b0383811691909117918290556040805163c45a015560e01b81529051929091169163c45a015591600480820192602092909190829003018186803b158015620000b657600080fd5b505afa158015620000cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000f19190620002c1565b600480546001600160a01b0319166001600160a01b03928316178155600354604080516315ab88c960e31b81529051919093169263ad5c46489281810192602092909190829003018186803b1580156200014a57600080fd5b505afa1580156200015f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001859190620002c1565b600580546001600160a01b0319166001600160a01b039290921691909117905550620004239050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8280546200020c90620003d0565b90600052602060002090601f0160209004810192826200023057600085556200027b565b82601f106200024b57805160ff19168380011785556200027b565b828001600101855582156200027b579182015b828111156200027b5782518255916020019190600101906200025e565b50620002899291506200028d565b5090565b5b808211156200028957600081556001016200028e565b80516001600160a01b0381168114620002bc57600080fd5b919050565b600060208284031215620002d3578081fd5b620002de82620002a4565b9392505050565b60008060408385031215620002f8578081fd5b82516001600160401b03808211156200030f578283fd5b818501915085601f83011262000323578283fd5b8151818111156200033857620003386200040d565b604051601f8201601f19908116603f011681019083821181831017156200036357620003636200040d565b816040528281526020935088848487010111156200037f578586fd5b8591505b82821015620003a2578482018401518183018501529083019062000383565b82821115620003b357858484830101525b9550620003c5915050858201620002a4565b925050509250929050565b600281046001821680620003e557607f821691505b602082108114156200040757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b611c8580620004336000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063b23e4fc611610066578063b23e4fc6146101ef578063df71d7f3146101f7578063e75d75d51461020a578063f2fde38b1461021d576100ea565b80638da5cb5b1461019a5780639b4bca24146101ab578063b0bbcd88146101ce576100ea565b80631cb85818116100c85780631cb8581814610142578063715018a614610155578063838b7ccb1461015d5780638988307414610170576100ea565b806306fdde03146100ef5780631580b5e51461010d57806317fcb39b14610117575b600080fd5b6100f7610230565b6040516101049190611a14565b60405180910390f35b6101156102be565b005b60055461012a906001600160a01b031681565b6040516001600160a01b039091168152602001610104565b60035461012a906001600160a01b031681565b610115610399565b61011561016b366004611721565b6103c5565b61018361017e366004611895565b61055e565b604080519215158352602083019190915201610104565b6000546001600160a01b031661012a565b6101be6101b9366004611760565b610924565b6040519015158152602001610104565b6101e16101dc3660046118cb565b610a81565b6040516101049291906119f9565b6101156110aa565b610183610205366004611895565b61117c565b60045461012a906001600160a01b031681565b61011561022b366004611721565b6113cd565b6002805461023d90611baa565b80601f016020809104026020016040519081016040528092919081815260200182805461026990611baa565b80156102b65780601f1061028b576101008083540402835291602001916102b6565b820191906000526020600020905b81548152906001019060200180831161029957829003601f168201915b505050505081565b6000546001600160a01b031633146102f15760405162461bcd60e51b81526004016102e890611a67565b60405180910390fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561033f57600080fd5b505afa158015610353573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103779190611744565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146103c35760405162461bcd60e51b81526004016102e890611a67565b565b806001600160a01b0381166103ec5760405162461bcd60e51b81526004016102e890611a9c565b6000546001600160a01b031633146104165760405162461bcd60e51b81526004016102e890611a67565b600380546001600160a01b0319166001600160a01b0384811691909117918290556040805163c45a015560e01b81529051929091169163c45a015591600480820192602092909190829003018186803b15801561047257600080fd5b505afa158015610486573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104aa9190611744565b600480546001600160a01b0319166001600160a01b03928316178155600354604080516315ab88c960e31b81529051919093169263ad5c46489281810192602092909190829003018186803b15801561050257600080fd5b505afa158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a9190611744565b600580546001600160a01b0319166001600160a01b03929092169190911790555050565b600080836001600160a01b0381166105885760405162461bcd60e51b81526004016102e890611a9c565b836001600160a01b0381166105af5760405162461bcd60e51b81526004016102e890611a9c565b6004805460405163e6a4390560e01b81526001600160a01b038981169382019390935287831660248201526000929091169063e6a439059060440160206040518083038186803b15801561060257600080fd5b505afa158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a9190611744565b90506001600160a01b03811661065757600080945094505061091a565b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561069257600080fd5b505afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca9190611744565b9050600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561070857600080fd5b505afa15801561071c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107409190611847565b506001600160701b031691506001600160701b03169150896001600160a01b0316836001600160a01b0316141561078d57808b1061078857600080975097505050505061091a565b6107a4565b818b106107a457600080975097505050505061091a565b6040805160028082526060820183526000926020830190803683370190505090508a816000815181106107e757634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050898160018151811061082957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506000600360009054906101000a90046001600160a01b03166001600160a01b0316631f00ca748e846040518363ffffffff1660e01b815260040161088e929190611ad1565b60006040518083038186803b1580156108a657600080fd5b505afa1580156108ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108e2919081019061179b565b905060018160008151811061090757634e487b7160e01b600052603260045260246000fd5b6020026020010151995099505050505050505b5050935093915050565b60008060028351101561093b576000915050610a7c565b60005b6001845161094c9190611b93565b811015610a755760045484516001600160a01b039091169063e6a439059086908490811061098a57634e487b7160e01b600052603260045260246000fd5b6020026020010151868460016109a09190611b7b565b815181106109be57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b81526004016109f89291906001600160a01b0392831681529116602082015260400190565b60206040518083038186803b158015610a1057600080fd5b505afa158015610a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a489190611744565b91506001600160a01b038216610a6357600092505050610a7c565b80610a6d81611be5565b91505061093e565b5060019150505b919050565b6000606060026001541415610ad85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102e8565b6002600155846001600160a01b038116610b045760405162461bcd60e51b81526004016102e890611a9c565b6000610b138a8a8a8989611468565b909450905083156110975787600081518110610b3f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166323b872dd610b5c3390565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260448101849052606401602060405180830381600087803b158015610baa57600080fd5b505af1158015610bbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be2919061182b565b5087600081518110610c0457634e487b7160e01b600052603260045260246000fd5b602090810291909101015160035460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b390604401602060405180830381600087803b158015610c5c57600080fd5b505af1158015610c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c94919061182b565b5084158015610cef575060055488516001600160a01b03909116908990610cbd90600190611b93565b81518110610cdb57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b15610d8557600354604051634401edf760e11b81526001600160a01b0390911690638803dbee90610d2c908c908e908d908d908d90600401611aea565b600060405180830381600087803b158015610d4657600080fd5b505af1158015610d5a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d82919081019061179b565b92505b84158015610dde575060055488516001600160a01b03909116908990610dad90600190611b93565b81518110610dcb57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316145b15610e7457600354604051632512eca560e11b81526001600160a01b0390911690634a25d94a90610e1b908c908e908d908d908d90600401611aea565b600060405180830381600087803b158015610e3557600080fd5b505af1158015610e49573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e71919081019061179b565b92505b6001851515148015610ed2575060055488516001600160a01b03909116908990610ea090600190611b93565b81518110610ebe57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b15610f68576003546040516338ed173960e01b81526001600160a01b03909116906338ed173990610f0f908d908d908d908d908d90600401611aea565b600060405180830381600087803b158015610f2957600080fd5b505af1158015610f3d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f65919081019061179b565b92505b6001851515148015610fc5575060055488516001600160a01b03909116908990610f9490600190611b93565b81518110610fb257634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316145b1561105b576003546040516318cbafe560e01b81526001600160a01b03909116906318cbafe590611002908d908d908d908d908d90600401611aea565b600060405180830381600087803b15801561101c57600080fd5b505af1158015611030573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611058919081019061179b565b92505b7fe1010d0ab476908054981d12fbb96915efcceb8d57a09ae8ca62f4bda731837388848960405161108e939291906119bb565b60405180910390a15b5050600180559097909650945050505050565b6000546001600160a01b031633146110d45760405162461bcd60e51b81526004016102e890611a67565b600360009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561112257600080fd5b505afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a9190611744565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b600080836001600160a01b0381166111a65760405162461bcd60e51b81526004016102e890611a9c565b836001600160a01b0381166111cd5760405162461bcd60e51b81526004016102e890611a9c565b6004805460405163e6a4390560e01b81526001600160a01b038981169382019390935287831660248201526000929091169063e6a439059060440160206040518083038186803b15801561122057600080fd5b505afa158015611234573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112589190611744565b6001600160a01b03161415611273576000809350935061091a565b60408051600280825260608201835260009260208301908036833701905050905086816000815181106112b657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505085816001815181106112f857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260035460405163d06ca61f60e01b8152600092919091169063d06ca61f9061133c908c908690600401611ad1565b60006040518083038186803b15801561135457600080fd5b505afa158015611368573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611390919081019061179b565b90506001816001815181106113b557634e487b7160e01b600052603260045260246000fd5b60200260200101519550955050505050935093915050565b6000546001600160a01b031633146113f75760405162461bcd60e51b81526004016102e890611a67565b6001600160a01b03811661145c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102e8565b61146581611645565b50565b6000804284101561147e5750600090508061163b565b61148785610924565b6114965750600090508061163b565b60035460405163d06ca61f60e01b81526000916001600160a01b03169063d06ca61f906114c9908b908a90600401611ad1565b60006040518083038186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261151d919081019061179b565b9050806001875161152e9190611b93565b8151811061154c57634e487b7160e01b600052603260045260246000fd5b602002602001015187111561156857600080925092505061163b565b6001841515141561158057600188925092505061163b565b6003546040516307c0329d60e21b81526000916001600160a01b031690631f00ca74906115b3908b908b90600401611ad1565b60006040518083038186803b1580156115cb57600080fd5b505afa1580156115df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611607919081019061179b565b905060018160008151811061162c57634e487b7160e01b600052603260045260246000fd5b60200260200101519350935050505b9550959350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600082601f8301126116a5578081fd5b813560206116ba6116b583611b57565b611b26565b82815281810190858301838502870184018810156116d6578586fd5b855b858110156116fd5781356116eb81611c2c565b845292840192908401906001016116d8565b5090979650505050505050565b80516001600160701b0381168114610a7c57600080fd5b600060208284031215611732578081fd5b813561173d81611c2c565b9392505050565b600060208284031215611755578081fd5b815161173d81611c2c565b600060208284031215611771578081fd5b813567ffffffffffffffff811115611787578182fd5b61179384828501611695565b949350505050565b600060208083850312156117ad578182fd5b825167ffffffffffffffff8111156117c3578283fd5b8301601f810185136117d3578283fd5b80516117e16116b582611b57565b81815283810190838501858402850186018910156117fd578687fd5b8694505b8385101561181f578051835260019490940193918501918501611801565b50979650505050505050565b60006020828403121561183c578081fd5b815161173d81611c41565b60008060006060848603121561185b578182fd5b6118648461170a565b92506118726020850161170a565b9150604084015163ffffffff8116811461188a578182fd5b809150509250925092565b6000806000606084860312156118a9578283fd5b8335925060208401356118bb81611c2c565b9150604084013561188a81611c2c565b60008060008060008060c087890312156118e3578182fd5b8635955060208701359450604087013567ffffffffffffffff811115611907578283fd5b61191389828a01611695565b945050606087013561192481611c2c565b92506080870135915060a087013561193b81611c41565b809150509295509295509295565b6000815180845260208085019450808401835b838110156119815781516001600160a01b03168752958201959082019060010161195c565b509495945050505050565b6000815180845260208085019450808401835b838110156119815781518752958201959082019060010161199f565b6000606082526119ce6060830186611949565b82810360208401526119e0818661198c565b91505060018060a01b0383166040830152949350505050565b6000831515825260406020830152611793604083018461198c565b6000602080835283518082850152825b81811015611a4057858101830151858201604001528201611a24565b81811115611a515783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f556e69737761705632436f6e6e6563746f723a207a65726f2061646472657373604082015260600190565b6000838252604060208301526117936040830184611949565b600086825285602083015260a06040830152611b0960a0830186611949565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b4f57611b4f611c16565b604052919050565b600067ffffffffffffffff821115611b7157611b71611c16565b5060209081020190565b60008219821115611b8e57611b8e611c00565b500190565b600082821015611ba557611ba5611c00565b500390565b600281046001821680611bbe57607f821691505b60208210811415611bdf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611bf957611bf9611c00565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461146557600080fd5b801515811461146557600080fdfea2646970667358221220fae36b70a99da0d51e88a8a97bc19a31d96df479292035a67fc4a4c7447914d364736f6c6343000802003300000000000000000000000000000000000000000000000000000000000000400000000000000000000000008954afa98594b838bda56fe4c12a09d7739d179b000000000000000000000000000000000000000000000000000000000000000b517569636b737761705632000000000000000000000000000000000000000000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000400000000000000000000000008954afa98594b838bda56fe4c12a09d7739d179b000000000000000000000000000000000000000000000000000000000000000b517569636b737761705632000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): QuickswapV2
Arg [1] : _exchangeRouter (address): 0x8954afa98594b838bda56fe4c12a09d7739d179b
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000008954afa98594b838bda56fe4c12a09d7739d179b
Arg [2] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [3] : 517569636b737761705632000000000000000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|