Source Code
Overview
MATIC Balance
0 MATIC
Token Holdings
More Info
ContractCreator:
Multichain Info
N/A
Latest 7 from a total of 7 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Swap | 45949539 | 42 days ago | IN | 0 MATIC | 0.00036538 | ||||
Set Exchange Rou... | 34056481 | 357 days ago | IN | 0 MATIC | 0.00006105 | ||||
Set Exchange Rou... | 34056386 | 357 days ago | IN | 0 MATIC | 0.00007636 | ||||
Set Exchange Rou... | 31861633 | 414 days ago | IN | 0 MATIC | 0.00312215 | ||||
Set Exchange Rou... | 31861603 | 414 days ago | IN | 0 MATIC | 0.00005256 | ||||
Set Exchange Rou... | 31861596 | 414 days ago | IN | 0 MATIC | 0.0029261 | ||||
0x60806040 | 31861112 | 414 days ago | IN | Contract Creation | 0 MATIC | 0.2056941 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x4936D406...B270012d4 The constructor portion of the code might be different and could alter the actual behaviour of the contract
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) ) { if ( IUniswapV2Factory(liquidityPoolFactory).getPair(_inputToken, wrappedNativeToken) == address(0) || IUniswapV2Factory(liquidityPoolFactory).getPair(wrappedNativeToken, _outputToken) == address(0) ) { return (false, 0); } address[] memory path = new address[](3); path[0] = _inputToken; path[1] = wrappedNativeToken; path[2] = _outputToken; uint[] memory result = IUniswapV2Router02(exchangeRouter).getAmountsIn(_outputAmount, path); return (true, result[0]); } else { 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 address liquidityPool = IUniswapV2Factory(liquidityPoolFactory).getPair(_inputToken, _outputToken); if ( liquidityPool == address(0) ) { if ( IUniswapV2Factory(liquidityPoolFactory).getPair(_inputToken, wrappedNativeToken) == address(0) || IUniswapV2Factory(liquidityPoolFactory).getPair(wrappedNativeToken, _outputToken) == address(0) ) { return (false, 0); } address[] memory path = new address[](3); path[0] = _inputToken; path[1] = wrappedNativeToken; path[2] = _outputToken; uint[] memory result = IUniswapV2Router02(exchangeRouter).getAmountsOut(_inputAmount, path); return (true, result[2]); } else { 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) { if (_path.length == 2) { address liquidityPool = IUniswapV2Factory(liquidityPoolFactory).getPair(_path[0], _path[1]); if (liquidityPool == address(0)) { address[] memory thePath = new address[](3); thePath[0] = _path[0]; thePath[1] = wrappedNativeToken; thePath[2] = _path[1]; _path = thePath; } } 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"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063b23e4fc611610066578063b23e4fc6146101ef578063df71d7f3146101f7578063e75d75d51461020a578063f2fde38b1461021d576100ea565b80638da5cb5b1461019a5780639b4bca24146101ab578063b0bbcd88146101ce576100ea565b80631cb85818116100c85780631cb8581814610142578063715018a614610155578063838b7ccb1461015d5780638988307414610170576100ea565b806306fdde03146100ef5780631580b5e51461010d57806317fcb39b14610117575b600080fd5b6100f7610230565b6040516101049190611efc565b60405180910390f35b6101156102be565b005b60055461012a906001600160a01b031681565b6040516001600160a01b039091168152602001610104565b60035461012a906001600160a01b031681565b610115610399565b61011561016b366004611c32565b6103c5565b61018361017e366004611d58565b61055e565b604080519215158352602083019190915201610104565b6000546001600160a01b031661012a565b6101be6101b9366004611c71565b6109a8565b6040519015158152602001610104565b6101e16101dc366004611d99565b610af0565b604051610104929190611ee1565b61011561133a565b610183610205366004611d58565b61140c565b60045461012a906001600160a01b031681565b61011561022b366004611c32565b6118f5565b6002805461023d90612092565b80601f016020809104026020016040519081016040528092919081815260200182805461026990612092565b80156102b65780601f1061028b576101008083540402835291602001916102b6565b820191906000526020600020905b81548152906001019060200180831161029957829003601f168201915b505050505081565b6000546001600160a01b031633146102f15760405162461bcd60e51b81526004016102e890611f4f565b60405180910390fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561033f57600080fd5b505afa158015610353573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103779190611c55565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146103c35760405162461bcd60e51b81526004016102e890611f4f565b565b806001600160a01b0381166103ec5760405162461bcd60e51b81526004016102e890611f84565b6000546001600160a01b031633146104165760405162461bcd60e51b81526004016102e890611f4f565b600380546001600160a01b0319166001600160a01b0384811691909117918290556040805163c45a015560e01b81529051929091169163c45a015591600480820192602092909190829003018186803b15801561047257600080fd5b505afa158015610486573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104aa9190611c55565b600480546001600160a01b0319166001600160a01b03928316178155600354604080516315ab88c960e31b81529051919093169263ad5c46489281810192602092909190829003018186803b15801561050257600080fd5b505afa158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a9190611c55565b600580546001600160a01b0319166001600160a01b03929092169190911790555050565b600080836001600160a01b0381166105885760405162461bcd60e51b81526004016102e890611f84565b836001600160a01b0381166105af5760405162461bcd60e51b81526004016102e890611f84565b6004805460405163e6a4390560e01b81526000926001600160a01b039092169163e6a43905916105e3918b918b9101611e89565b60206040518083038186803b1580156105fb57600080fd5b505afa15801561060f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106339190611c55565b90506001600160a01b038116610919576004805460055460405163e6a4390560e01b81526000936001600160a01b039384169363e6a439059361067d938e93919092169101611e89565b60206040518083038186803b15801561069557600080fd5b505afa1580156106a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cd9190611c55565b6001600160a01b0316148061077057506004805460055460405163e6a4390560e01b81526000936001600160a01b039384169363e6a4390593610715939116918c9101611e89565b60206040518083038186803b15801561072d57600080fd5b505afa158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107659190611c55565b6001600160a01b0316145b1561078257600080945094505061099e565b604080516003808252608082019092526000916020820160608036833701905050905087816000815181106107c757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260055482519116908290600190811061080657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050868160028151811061084857634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526003546040516307c0329d60e21b81526000929190911690631f00ca749061088c908d908690600401611fb9565b60006040518083038186803b1580156108a457600080fd5b505afa1580156108b8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108e09190810190611cac565b905060018160008151811061090557634e487b7160e01b600052603260045260246000fd5b60200260200101519650965050505061099e565b604080516002808252606082018352600092602083019080368337019050509050878160008151811061095c57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050868160018151811061084857634e487b7160e01b600052603260045260246000fd5b5050935093915050565b6000806002835110156109bf576000915050610aeb565b60005b600184516109d0919061207b565b811015610ae45760045484516001600160a01b039091169063e6a4390590869084908110610a0e57634e487b7160e01b600052603260045260246000fd5b602002602001015186846001610a249190612063565b81518110610a4257634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b8152600401610a67929190611e89565b60206040518083038186803b158015610a7f57600080fd5b505afa158015610a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab79190611c55565b91506001600160a01b038216610ad257600092505050610aeb565b80610adc816120cd565b9150506109c2565b5060019150505b919050565b6000606060026001541415610b475760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102e8565b6002600155846001600160a01b038116610b735760405162461bcd60e51b81526004016102e890611f84565b865160021415610d945760045487516000916001600160a01b03169063e6a43905908a908490610bb357634e487b7160e01b600052603260045260246000fd5b60200260200101518a600181518110610bdc57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b8152600401610c01929190611e89565b60206040518083038186803b158015610c1957600080fd5b505afa158015610c2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c519190611c55565b90506001600160a01b038116610d9257604080516003808252608082019092526000916020820160608036833701905050905088600081518110610ca557634e487b7160e01b600052603260045260246000fd5b602002602001015181600081518110610cce57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600554825191169082906001908110610d0d57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505088600181518110610d4e57634e487b7160e01b600052603260045260246000fd5b602002602001015181600281518110610d7757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015297505b505b6000610da38a8a8a8989611990565b909450905083156113275787600081518110610dcf57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166323b872dd610dec3390565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260448101849052606401602060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e729190611d3c565b5087600081518110610e9457634e487b7160e01b600052603260045260246000fd5b602090810291909101015160035460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b390604401602060405180830381600087803b158015610eec57600080fd5b505af1158015610f00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f249190611d3c565b5084158015610f7f575060055488516001600160a01b03909116908990610f4d9060019061207b565b81518110610f6b57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b1561101557600354604051634401edf760e11b81526001600160a01b0390911690638803dbee90610fbc908c908e908d908d908d90600401611fd2565b600060405180830381600087803b158015610fd657600080fd5b505af1158015610fea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110129190810190611cac565b92505b8415801561106e575060055488516001600160a01b0390911690899061103d9060019061207b565b8151811061105b57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316145b1561110457600354604051632512eca560e11b81526001600160a01b0390911690634a25d94a906110ab908c908e908d908d908d90600401611fd2565b600060405180830381600087803b1580156110c557600080fd5b505af11580156110d9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111019190810190611cac565b92505b6001851515148015611162575060055488516001600160a01b039091169089906111309060019061207b565b8151811061114e57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b156111f8576003546040516338ed173960e01b81526001600160a01b03909116906338ed17399061119f908d908d908d908d908d90600401611fd2565b600060405180830381600087803b1580156111b957600080fd5b505af11580156111cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111f59190810190611cac565b92505b6001851515148015611255575060055488516001600160a01b039091169089906112249060019061207b565b8151811061124257634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316145b156112eb576003546040516318cbafe560e01b81526001600160a01b03909116906318cbafe590611292908d908d908d908d908d90600401611fd2565b600060405180830381600087803b1580156112ac57600080fd5b505af11580156112c0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112e89190810190611cac565b92505b7fe1010d0ab476908054981d12fbb96915efcceb8d57a09ae8ca62f4bda731837388848960405161131e93929190611ea3565b60405180910390a15b5050600180559097909650945050505050565b6000546001600160a01b031633146113645760405162461bcd60e51b81526004016102e890611f4f565b600360009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156113b257600080fd5b505afa1580156113c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ea9190611c55565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b600080836001600160a01b0381166114365760405162461bcd60e51b81526004016102e890611f84565b836001600160a01b03811661145d5760405162461bcd60e51b81526004016102e890611f84565b6004805460405163e6a4390560e01b81526000926001600160a01b039092169163e6a4390591611491918b918b9101611e89565b60206040518083038186803b1580156114a957600080fd5b505afa1580156114bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e19190611c55565b90506001600160a01b0381166117b3576004805460055460405163e6a4390560e01b81526000936001600160a01b039384169363e6a439059361152b938e93919092169101611e89565b60206040518083038186803b15801561154357600080fd5b505afa158015611557573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157b9190611c55565b6001600160a01b0316148061161e57506004805460055460405163e6a4390560e01b81526000936001600160a01b039384169363e6a43905936115c3939116918c9101611e89565b60206040518083038186803b1580156115db57600080fd5b505afa1580156115ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116139190611c55565b6001600160a01b0316145b1561163057600080945094505061099e565b6040805160038082526080820190925260009160208201606080368337019050509050878160008151811061167557634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526005548251911690829060019081106116b457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505086816002815181106116f657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260035460405163d06ca61f60e01b8152600092919091169063d06ca61f9061173a908d908690600401611fb9565b60006040518083038186803b15801561175257600080fd5b505afa158015611766573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261178e9190810190611cac565b905060018160028151811061090557634e487b7160e01b600052603260045260246000fd5b60408051600280825260608201835260009260208301908036833701905050905087816000815181106117f657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050868160018151811061183857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260035460405163d06ca61f60e01b8152600092919091169063d06ca61f9061187c908d908690600401611fb9565b60006040518083038186803b15801561189457600080fd5b505afa1580156118a8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118d09190810190611cac565b905060018160018151811061090557634e487b7160e01b600052603260045260246000fd5b6000546001600160a01b0316331461191f5760405162461bcd60e51b81526004016102e890611f4f565b6001600160a01b0381166119845760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102e8565b61198d81611b6d565b50565b600080428410156119a657506000905080611b63565b6119af856109a8565b6119be57506000905080611b63565b60035460405163d06ca61f60e01b81526000916001600160a01b03169063d06ca61f906119f1908b908a90600401611fb9565b60006040518083038186803b158015611a0957600080fd5b505afa158015611a1d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a459190810190611cac565b90508060018751611a56919061207b565b81518110611a7457634e487b7160e01b600052603260045260246000fd5b6020026020010151871115611a90576000809250925050611b63565b60018415151415611aa8576001889250925050611b63565b6003546040516307c0329d60e21b81526000916001600160a01b031690631f00ca7490611adb908b908b90600401611fb9565b60006040518083038186803b158015611af357600080fd5b505afa158015611b07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b2f9190810190611cac565b9050600181600081518110611b5457634e487b7160e01b600052603260045260246000fd5b60200260200101519350935050505b9550959350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600082601f830112611bcd578081fd5b81356020611be2611bdd8361203f565b61200e565b8281528181019085830183850287018401881015611bfe578586fd5b855b85811015611c25578135611c1381612114565b84529284019290840190600101611c00565b5090979650505050505050565b600060208284031215611c43578081fd5b8135611c4e81612114565b9392505050565b600060208284031215611c66578081fd5b8151611c4e81612114565b600060208284031215611c82578081fd5b813567ffffffffffffffff811115611c98578182fd5b611ca484828501611bbd565b949350505050565b60006020808385031215611cbe578182fd5b825167ffffffffffffffff811115611cd4578283fd5b8301601f81018513611ce4578283fd5b8051611cf2611bdd8261203f565b8181528381019083850185840285018601891015611d0e578687fd5b8694505b83851015611d30578051835260019490940193918501918501611d12565b50979650505050505050565b600060208284031215611d4d578081fd5b8151611c4e81612129565b600080600060608486031215611d6c578182fd5b833592506020840135611d7e81612114565b91506040840135611d8e81612114565b809150509250925092565b60008060008060008060c08789031215611db1578182fd5b8635955060208701359450604087013567ffffffffffffffff811115611dd5578283fd5b611de189828a01611bbd565b9450506060870135611df281612114565b92506080870135915060a0870135611e0981612129565b809150509295509295509295565b6000815180845260208085019450808401835b83811015611e4f5781516001600160a01b031687529582019590820190600101611e2a565b509495945050505050565b6000815180845260208085019450808401835b83811015611e4f57815187529582019590820190600101611e6d565b6001600160a01b0392831681529116602082015260400190565b600060608252611eb66060830186611e17565b8281036020840152611ec88186611e5a565b91505060018060a01b0383166040830152949350505050565b6000831515825260406020830152611ca46040830184611e5a565b6000602080835283518082850152825b81811015611f2857858101830151858201604001528201611f0c565b81811115611f395783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f556e69737761705632436f6e6e6563746f723a207a65726f2061646472657373604082015260600190565b600083825260406020830152611ca46040830184611e17565b600086825285602083015260a06040830152611ff160a0830186611e17565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715612037576120376120fe565b604052919050565b600067ffffffffffffffff821115612059576120596120fe565b5060209081020190565b60008219821115612076576120766120e8565b500190565b60008282101561208d5761208d6120e8565b500390565b6002810460018216806120a657607f821691505b602082108114156120c757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156120e1576120e16120e8565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461198d57600080fd5b801515811461198d57600080fdfea264697066735822122069d38cc0ee074e36774d66630dc9fa71e809652daf72a7816377e09f2f99cba164736f6c63430008020033
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.