UNPKG

@oikos/swap

Version:
1,345 lines (1,344 loc) 345 kB
{ "contractName": "IUniswapExchange", "abi": [ { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "buyer", "type": "address" }, { "indexed": true, "name": "eth_sold", "type": "uint256" }, { "indexed": true, "name": "tokens_bought", "type": "uint256" } ], "name": "TokenPurchase", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "buyer", "type": "address" }, { "indexed": true, "name": "tokens_sold", "type": "uint256" }, { "indexed": true, "name": "eth_bought", "type": "uint256" } ], "name": "EthPurchase", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "provider", "type": "address" }, { "indexed": true, "name": "eth_amount", "type": "uint256" }, { "indexed": true, "name": "token_amount", "type": "uint256" } ], "name": "AddLiquidity", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "provider", "type": "address" }, { "indexed": true, "name": "eth_amount", "type": "uint256" }, { "indexed": true, "name": "token_amount", "type": "uint256" } ], "name": "RemoveLiquidity", "type": "event" }, { "constant": true, "inputs": [ { "name": "input_amount", "type": "uint256" }, { "name": "input_reserve", "type": "uint256" }, { "name": "output_reserve", "type": "uint256" } ], "name": "getInputPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "output_amount", "type": "uint256" }, { "name": "input_reserve", "type": "uint256" }, { "name": "output_reserve", "type": "uint256" } ], "name": "getOutputPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "min_tokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ], "name": "ethToTokenSwapInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "min_tokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" } ], "name": "ethToTokenTransferInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_bought", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ], "name": "ethToTokenSwapOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_bought", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" } ], "name": "ethToTokenTransferOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_sold", "type": "uint256" }, { "name": "min_eth", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ], "name": "tokenToEthSwapInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_sold", "type": "uint256" }, { "name": "min_eth", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" } ], "name": "tokenToEthTransferInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "eth_bought", "type": "uint256" }, { "name": "max_tokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ], "name": "tokenToEthSwapOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "eth_bought", "type": "uint256" }, { "name": "max_tokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" } ], "name": "tokenToEthTransferOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_sold", "type": "uint256" }, { "name": "min_tokens_bought", "type": "uint256" }, { "name": "min_eth_bought", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "token_addr", "type": "address" } ], "name": "tokenToTokenSwapInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_sold", "type": "uint256" }, { "name": "min_tokens_bought", "type": "uint256" }, { "name": "min_eth_bought", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" }, { "name": "token_addr", "type": "address" } ], "name": "tokenToTokenTransferInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_bought", "type": "uint256" }, { "name": "max_tokens_sold", "type": "uint256" }, { "name": "max_eth_sold", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "token_addr", "type": "address" } ], "name": "tokenToTokenSwapOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_bought", "type": "uint256" }, { "name": "max_tokens_sold", "type": "uint256" }, { "name": "max_eth_sold", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" }, { "name": "token_addr", "type": "address" } ], "name": "tokenToTokenTransferOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_sold", "type": "uint256" }, { "name": "min_tokens_bought", "type": "uint256" }, { "name": "min_eth_bought", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "exchange_addr", "type": "address" } ], "name": "tokenToExchangeSwapInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_sold", "type": "uint256" }, { "name": "min_tokens_bought", "type": "uint256" }, { "name": "min_eth_bought", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" }, { "name": "exchange_addr", "type": "address" } ], "name": "tokenToExchangeTransferInput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_bought", "type": "uint256" }, { "name": "max_tokens_sold", "type": "uint256" }, { "name": "max_eth_sold", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "exchange_addr", "type": "address" } ], "name": "tokenToExchangeSwapOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "tokens_bought", "type": "uint256" }, { "name": "max_tokens_sold", "type": "uint256" }, { "name": "max_eth_sold", "type": "uint256" }, { "name": "deadline", "type": "uint256" }, { "name": "recipient", "type": "address" }, { "name": "exchange_addr", "type": "address" } ], "name": "tokenToExchangeTransferOutput", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "name": "eth_sold", "type": "uint256" } ], "name": "getEthToTokenInputPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "tokens_bought", "type": "uint256" } ], "name": "getEthToTokenOutputPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "tokens_sold", "type": "uint256" } ], "name": "getTokenToEthInputPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "eth_bought", "type": "uint256" } ], "name": "getTokenToEthOutputPrice", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "tokenAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "factoryAddress", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "min_liquidity", "type": "uint256" }, { "name": "max_tokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ], "name": "addLiquidity", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "amount", "type": "uint256" }, { "name": "min_eth", "type": "uint256" }, { "name": "min_tokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ], "name": "removeLiquidity", "outputs": [ { "name": "", "type": "uint256" }, { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "pragma solidity ^0.5.0;\n\ninterface IUniswapExchange {\n event TokenPurchase(address indexed buyer, uint256 indexed eth_sold, uint256 indexed tokens_bought);\n event EthPurchase(address indexed buyer, uint256 indexed tokens_sold, uint256 indexed eth_bought);\n event AddLiquidity(address indexed provider, uint256 indexed eth_amount, uint256 indexed token_amount);\n event RemoveLiquidity(address indexed provider, uint256 indexed eth_amount, uint256 indexed token_amount);\n\n /**\n * @notice Convert ETH to Tokens.\n * @dev User specifies exact input (msg.value).\n * @dev User cannot specify minimum output or deadline.\n */\n function () external payable;\n\n /**\n * @dev Pricing function for converting between ETH && Tokens.\n * @param input_amount Amount of ETH or Tokens being sold.\n * @param input_reserve Amount of ETH or Tokens (input type) in exchange reserves.\n * @param output_reserve Amount of ETH or Tokens (output type) in exchange reserves.\n * @return Amount of ETH or Tokens bought.\n */\n function getInputPrice(uint256 input_amount, uint256 input_reserve, uint256 output_reserve) external view returns (uint256);\n\n /**\n * @dev Pricing function for converting between ETH && Tokens.\n * @param output_amount Amount of ETH or Tokens being bought.\n * @param input_reserve Amount of ETH or Tokens (input type) in exchange reserves.\n * @param output_reserve Amount of ETH or Tokens (output type) in exchange reserves.\n * @return Amount of ETH or Tokens sold.\n */\n function getOutputPrice(uint256 output_amount, uint256 input_reserve, uint256 output_reserve) external view returns (uint256);\n\n\n /** \n * @notice Convert ETH to Tokens.\n * @dev User specifies exact input (msg.value) && minimum output.\n * @param min_tokens Minimum Tokens bought.\n * @param deadline Time after which this transaction can no longer be executed.\n * @return Amount of Tokens bought.\n */ \n function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) external payable returns (uint256);\n\n /** \n * @notice Convert ETH to Tokens && transfers Tokens to recipient.\n * @dev User specifies exact input (msg.value) && minimum output\n * @param min_tokens Minimum Tokens bought.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output Tokens.\n * @return Amount of Tokens bought.\n */\n function ethToTokenTransferInput(uint256 min_tokens, uint256 deadline, address recipient) external payable returns(uint256);\n\n\n /** \n * @notice Convert ETH to Tokens.\n * @dev User specifies maximum input (msg.value) && exact output.\n * @param tokens_bought Amount of tokens bought.\n * @param deadline Time after which this transaction can no longer be executed.\n * @return Amount of ETH sold.\n */\n function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline) external payable returns(uint256);\n /** \n * @notice Convert ETH to Tokens && transfers Tokens to recipient.\n * @dev User specifies maximum input (msg.value) && exact output.\n * @param tokens_bought Amount of tokens bought.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output Tokens.\n * @return Amount of ETH sold.\n */\n function ethToTokenTransferOutput(uint256 tokens_bought, uint256 deadline, address recipient) external payable returns (uint256);\n\n /** \n * @notice Convert Tokens to ETH.\n * @dev User specifies exact input && minimum output.\n * @param tokens_sold Amount of Tokens sold.\n * @param min_eth Minimum ETH purchased.\n * @param deadline Time after which this transaction can no longer be executed.\n * @return Amount of ETH bought.\n */\n function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256);\n\n /** \n * @notice Convert Tokens to ETH && transfers ETH to recipient.\n * @dev User specifies exact input && minimum output.\n * @param tokens_sold Amount of Tokens sold.\n * @param min_eth Minimum ETH purchased.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output ETH.\n * @return Amount of ETH bought.\n */\n function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address recipient) external returns (uint256);\n\n /** \n * @notice Convert Tokens to ETH.\n * @dev User specifies maximum input && exact output.\n * @param eth_bought Amount of ETH purchased.\n * @param max_tokens Maximum Tokens sold.\n * @param deadline Time after which this transaction can no longer be executed.\n * @return Amount of Tokens sold.\n */\n function tokenToEthSwapOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline) external returns (uint256);\n\n /**\n * @notice Convert Tokens to ETH && transfers ETH to recipient.\n * @dev User specifies maximum input && exact output.\n * @param eth_bought Amount of ETH purchased.\n * @param max_tokens Maximum Tokens sold.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output ETH.\n * @return Amount of Tokens sold.\n */\n function tokenToEthTransferOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline, address recipient) external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (token_addr).\n * @dev User specifies exact input && minimum output.\n * @param tokens_sold Amount of Tokens sold.\n * @param min_tokens_bought Minimum Tokens (token_addr) purchased.\n * @param min_eth_bought Minimum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param token_addr The address of the token being purchased.\n * @return Amount of Tokens (token_addr) bought.\n */\n function tokenToTokenSwapInput(\n uint256 tokens_sold, \n uint256 min_tokens_bought, \n uint256 min_eth_bought, \n uint256 deadline, \n address token_addr) \n external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (token_addr) && transfers\n * Tokens (token_addr) to recipient.\n * @dev User specifies exact input && minimum output.\n * @param tokens_sold Amount of Tokens sold.\n * @param min_tokens_bought Minimum Tokens (token_addr) purchased.\n * @param min_eth_bought Minimum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output ETH.\n * @param token_addr The address of the token being purchased.\n * @return Amount of Tokens (token_addr) bought.\n */\n function tokenToTokenTransferInput(\n uint256 tokens_sold, \n uint256 min_tokens_bought, \n uint256 min_eth_bought, \n uint256 deadline, \n address recipient, \n address token_addr) \n external returns (uint256);\n\n\n /**\n * @notice Convert Tokens (token) to Tokens (token_addr).\n * @dev User specifies maximum input && exact output.\n * @param tokens_bought Amount of Tokens (token_addr) bought.\n * @param max_tokens_sold Maximum Tokens (token) sold.\n * @param max_eth_sold Maximum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param token_addr The address of the token being purchased.\n * @return Amount of Tokens (token) sold.\n */\n function tokenToTokenSwapOutput(\n uint256 tokens_bought, \n uint256 max_tokens_sold, \n uint256 max_eth_sold, \n uint256 deadline, \n address token_addr) \n external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (token_addr) && transfers\n * Tokens (token_addr) to recipient.\n * @dev User specifies maximum input && exact output.\n * @param tokens_bought Amount of Tokens (token_addr) bought.\n * @param max_tokens_sold Maximum Tokens (token) sold.\n * @param max_eth_sold Maximum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output ETH.\n * @param token_addr The address of the token being purchased.\n * @return Amount of Tokens (token) sold.\n */\n function tokenToTokenTransferOutput(\n uint256 tokens_bought, \n uint256 max_tokens_sold, \n uint256 max_eth_sold, \n uint256 deadline, \n address recipient, \n address token_addr) \n external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (exchange_addr.token).\n * @dev Allows trades through contracts that were not deployed from the same factory.\n * @dev User specifies exact input && minimum output.\n * @param tokens_sold Amount of Tokens sold.\n * @param min_tokens_bought Minimum Tokens (token_addr) purchased.\n * @param min_eth_bought Minimum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param exchange_addr The address of the exchange for the token being purchased.\n * @return Amount of Tokens (exchange_addr.token) bought.\n */\n function tokenToExchangeSwapInput(\n uint256 tokens_sold, \n uint256 min_tokens_bought, \n uint256 min_eth_bought, \n uint256 deadline, \n address exchange_addr) \n external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (exchange_addr.token) && transfers\n * Tokens (exchange_addr.token) to recipient.\n * @dev Allows trades through contracts that were not deployed from the same factory.\n * @dev User specifies exact input && minimum output.\n * @param tokens_sold Amount of Tokens sold.\n * @param min_tokens_bought Minimum Tokens (token_addr) purchased.\n * @param min_eth_bought Minimum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output ETH.\n * @param exchange_addr The address of the exchange for the token being purchased.\n * @return Amount of Tokens (exchange_addr.token) bought.\n */\n function tokenToExchangeTransferInput(\n uint256 tokens_sold, \n uint256 min_tokens_bought, \n uint256 min_eth_bought, \n uint256 deadline, \n address recipient, \n address exchange_addr) \n external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (exchange_addr.token).\n * @dev Allows trades through contracts that were not deployed from the same factory.\n * @dev User specifies maximum input && exact output.\n * @param tokens_bought Amount of Tokens (token_addr) bought.\n * @param max_tokens_sold Maximum Tokens (token) sold.\n * @param max_eth_sold Maximum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param exchange_addr The address of the exchange for the token being purchased.\n * @return Amount of Tokens (token) sold.\n */\n function tokenToExchangeSwapOutput(\n uint256 tokens_bought, \n uint256 max_tokens_sold, \n uint256 max_eth_sold, \n uint256 deadline, \n address exchange_addr) \n external returns (uint256);\n\n /**\n * @notice Convert Tokens (token) to Tokens (exchange_addr.token) && transfers\n * Tokens (exchange_addr.token) to recipient.\n * @dev Allows trades through contracts that were not deployed from the same factory.\n * @dev User specifies maximum input && exact output.\n * @param tokens_bought Amount of Tokens (token_addr) bought.\n * @param max_tokens_sold Maximum Tokens (token) sold.\n * @param max_eth_sold Maximum ETH purchased as intermediary.\n * @param deadline Time after which this transaction can no longer be executed.\n * @param recipient The address that receives output ETH.\n * @param exchange_addr The address of the exchange for the token being purchased.\n * @return Amount of Tokens (token) sold.\n */\n function tokenToExchangeTransferOutput(\n uint256 tokens_bought, \n uint256 max_tokens_sold, \n uint256 max_eth_sold, \n uint256 deadline, \n address recipient, \n address exchange_addr) \n external returns (uint256);\n\n\n /***********************************|\n | Getter Functions |\n |__________________________________*/\n\n /**\n * @notice external price function for ETH to Token trades with an exact input.\n * @param eth_sold Amount of ETH sold.\n * @return Amount of Tokens that can be bought with input ETH.\n */\n function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256);\n\n /**\n * @notice external price function for ETH to Token trades with an exact output.\n * @param tokens_bought Amount of Tokens bought.\n * @return Amount of ETH needed to buy output Tokens.\n */\n function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256);\n\n /**\n * @notice external price function for Token to ETH trades with an exact input.\n * @param tokens_sold Amount of Tokens sold.\n * @return Amount of ETH that can be bought with input Tokens.\n */\n function getTokenToEthInputPrice(uint256 tokens_sold) external view returns (uint256);\n\n /**\n * @notice external price function for Token to ETH trades with an exact output.\n * @param eth_bought Amount of output ETH.\n * @return Amount of Tokens needed to buy output ETH.\n */\n function getTokenToEthOutputPrice(uint256 eth_bought) external view returns (uint256);\n\n /** \n * @return Address of Token that is sold on this exchange.\n */\n function tokenAddress() external view returns (address);\n\n /**\n * @return Address of factory that created this exchange.\n */\n function factoryAddress() external view returns (address);\n\n\n /***********************************|\n | Liquidity Functions |\n |__________________________________*/\n\n /** \n * @notice Deposit ETH && Tokens (token) at current ratio to mint UNI tokens.\n * @dev min_liquidity does nothing when total UNI supply is 0.\n * @param min_liquidity Minimum number of UNI sender will mint if total UNI supply is greater than 0.\n * @param max_tokens Maximum number of tokens deposited. Deposits max amount if total UNI supply is 0.\n * @param deadline Time after which this transaction can no longer be executed.\n * @return The amount of UNI minted.\n */\n function addLiquidity(uint256 min_liquidity, uint256 max_tokens, uint256 deadline) external payable returns (uint256);\n\n /**\n * @dev Burn UNI tokens to withdraw ETH && Tokens at current ratio.\n * @param amount Amount of UNI burned.\n * @param min_eth Minimum ETH withdrawn.\n * @param min_tokens Minimum Tokens withdrawn.\n * @param deadline Time after which this transaction can no longer be executed.\n * @return The amount of ETH && Tokens withdrawn.\n */\n function removeLiquidity(uint256 amount, uint256 min_eth, uint256 min_tokens, uint256 deadline) external returns (uint256, uint256);\n}", "sourcePath": "/home/binyu/Desktop/Synthetix/prod/swap-solidity/contracts/merged/IUniswapExchange.sol", "ast": { "absolutePath": "/home/binyu/Desktop/Synthetix/prod/swap-solidity/contracts/merged/IUniswapExchange.sol", "exportedSymbols": { "IUniswapExchange": [ 1255 ] }, "id": 1256, "nodeType": "SourceUnit", "nodes": [ { "id": 917, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:5" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "interface", "documentation": null, "fullyImplemented": false, "id": 1255, "linearizedBaseContracts": [ 1255 ], "name": "IUniswapExchange", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 925, "name": "TokenPurchase", "nodeType": "EventDefinition", "parameters": { "id": 924, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 919, "indexed": true, "name": "buyer", "nodeType": "VariableDeclaration", "scope": 925, "src": "76:21:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 918, "name": "address", "nodeType": "ElementaryTypeName", "src": "76:7:5", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 921, "indexed": true, "name": "eth_sold", "nodeType": "VariableDeclaration", "scope": 925, "src": "99:24:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 920, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "99:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 923, "indexed": true, "name": "tokens_bought", "nodeType": "VariableDeclaration", "scope": 925, "src": "125:29:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 922, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "125:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "75:80:5" }, "src": "56:100:5" }, { "anonymous": false, "documentation": null, "id": 933, "name": "EthPurchase", "nodeType": "EventDefinition", "parameters": { "id": 932, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 927, "indexed": true, "name": "buyer", "nodeType": "VariableDeclaration", "scope": 933, "src": "177:21:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 926, "name": "address", "nodeType": "ElementaryTypeName", "src": "177:7:5", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 929, "indexed": true, "name": "tokens_sold", "nodeType": "VariableDeclaration", "scope": 933, "src": "200:27:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 928, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "200:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 931, "indexed": true, "name": "eth_bought", "nodeType": "VariableDeclaration", "scope": 933, "src": "229:26:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 930, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "229:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "176:80:5" }, "src": "159:98:5" }, { "anonymous": false, "documentation": null, "id": 941, "name": "AddLiquidity", "nodeType": "EventDefinition", "parameters": { "id": 940, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 935, "indexed": true, "name": "provider", "nodeType": "VariableDeclaration", "scope": 941, "src": "279:24:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 934, "name": "address", "nodeType": "ElementaryTypeName", "src": "279:7:5", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 937, "indexed": true, "name": "eth_amount", "nodeType": "VariableDeclaration", "scope": 941, "src": "305:26:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 936, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "305:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 939, "indexed": true, "name": "token_amount", "nodeType": "VariableDeclaration", "scope": 941, "src": "333:28:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 938, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "333:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "278:84:5" }, "src": "260:103:5" }, { "anonymous": false, "documentation": null, "id": 949, "name": "RemoveLiquidity", "nodeType": "EventDefinition", "parameters": { "id": 948, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 943, "indexed": true, "name": "provider", "nodeType": "VariableDeclaration", "scope": 949, "src": "388:24:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 942, "name": "address", "nodeType": "ElementaryTypeName", "src": "388:7:5", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 945, "indexed": true, "name": "eth_amount", "nodeType": "VariableDeclaration", "scope": 949, "src": "414:26:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 944, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "414:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 947, "indexed": true, "name": "token_amount", "nodeType": "VariableDeclaration", "scope": 949, "src": "442:28:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 946, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "442:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "387:84:5" }, "src": "366:106:5" }, { "body": null, "documentation": "@notice Convert ETH to Tokens.\n@dev User specifies exact input (msg.value).\n@dev User cannot specify minimum output or deadline.", "id": 952, "implemented": false, "kind": "fallback", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 950, "nodeType": "ParameterList", "parameters": [], "src": "642:2:5" }, "returnParameters": { "id": 951, "nodeType": "ParameterList", "parameters": [], "src": "661:0:5" }, "scope": 1255, "src": "633:29:5", "stateMutability": "payable", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@dev Pricing function for converting between ETH && Tokens.\n@param input_amount Amount of ETH or Tokens being sold.\n@param input_reserve Amount of ETH or Tokens (input type) in exchange reserves.\n@param output_reserve Amount of ETH or Tokens (output type) in exchange reserves.\n@return Amount of ETH or Tokens bought.", "id": 963, "implemented": false, "kind": "function", "modifiers": [], "name": "getInputPrice", "nodeType": "FunctionDefinition", "parameters": { "id": 959, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 954, "name": "input_amount", "nodeType": "VariableDeclaration", "scope": 963, "src": "1043:20:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 953, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1043:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 956, "name": "input_reserve", "nodeType": "VariableDeclaration", "scope": 963, "src": "1065:21:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 955, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1065:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256"