UNPKG

hardlydifficult-eth

Version:

A collection of reusable contracts and Javascript helpers for Ethereum.

1,011 lines (1,010 loc) 639 kB
{ "contractName": "UniswapV2Library", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/protocols/Uniswap/UniswapV2Library.sol\":\"UniswapV2Library\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://526dc85e1f9b9b45830e202568d267d93dde7a4fcccf4ad7798dadcd92304d3c\",\"dweb:/ipfs/QmaoXMB972J3cSDLtBq3xBo4jLwqD2uzXTwujtSPqkYVhR\"]},\"@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol\":{\"keccak256\":\"0x7c9bc70e5996c763e02ff38905282bc24fb242b0ef2519a003b36824fc524a4b\",\"urls\":[\"bzz-raw://85d5ad2dd23ee127f40907a12865a1e8cb5828814f6f2480285e1827dd72dedf\",\"dweb:/ipfs/QmayKQWJgWmr46DqWseADyUanmqxh662hPNdAkdHRjiQQH\"]},\"project:/contracts/protocols/Uniswap/UniswapV2Library.sol\":{\"keccak256\":\"0x65165b942a31dbf2bbd457075244dc8de9914d1b242568a26e310e12d824e8b9\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8e2724628228ef70e3df52f2fa11a3f6825ff9427af700988d051f3d7dad740c\",\"dweb:/ipfs/QmUo6akdzoDwSdtrbVB75BGAA9qE2KCuURVrisTTHiWnCY\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ad6b8e9cf60822754e51c659c783d32cde23903ade7d2d1043958972b5ebef0064736f6c634300060a0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ad6b8e9cf60822754e51c659c783d32cde23903ade7d2d1043958972b5ebef0064736f6c634300060a0033", "immutableReferences": {}, "sourceMap": "341:4333:15:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "341:4333:15:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: GPL-3.0\n// Original source: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol\n// Modified to unpin solidity version\npragma solidity >=0.5.0;\n\nimport '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';\nimport '@openzeppelin/contracts/math/SafeMath.sol';\n\nlibrary UniswapV2Library {\n using SafeMath for uint;\n\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');\n }\n\n // calculates the CREATE2 address for a pair without making any external calls\n function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {\n (address token0, address token1) = sortTokens(tokenA, tokenB);\n pair = address(uint(keccak256(abi.encodePacked(\n hex'ff',\n factory,\n keccak256(abi.encodePacked(token0, token1)),\n hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash\n ))));\n }\n\n // fetches and sorts the reserves for a pair\n function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {\n (address token0,) = sortTokens(tokenA, tokenB);\n (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n }\n\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {\n require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');\n require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n amountB = amountA.mul(reserveB) / reserveA;\n }\n\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {\n require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');\n require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n uint amountInWithFee = amountIn.mul(997);\n uint numerator = amountInWithFee.mul(reserveOut);\n uint denominator = reserveIn.mul(1000).add(amountInWithFee);\n amountOut = numerator / denominator;\n }\n\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {\n require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');\n require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n uint numerator = reserveIn.mul(amountOut).mul(1000);\n uint denominator = reserveOut.sub(amountOut).mul(997);\n amountIn = (numerator / denominator).add(1);\n }\n\n // performs chained getAmountOut calculations on any number of pairs\n function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {\n require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');\n amounts = new uint[](path.length);\n amounts[0] = amountIn;\n for (uint i; i < path.length - 1; i++) {\n (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);\n }\n }\n\n // performs chained getAmountIn calculations on any number of pairs\n function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {\n require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');\n amounts = new uint[](path.length);\n amounts[amounts.length - 1] = amountOut;\n for (uint i = path.length - 1; i > 0; i--) {\n (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);\n }\n }\n}", "sourcePath": "/home/circleci/repo/contracts/protocols/Uniswap/UniswapV2Library.sol", "ast": { "absolutePath": "project:/contracts/protocols/Uniswap/UniswapV2Library.sol", "exportedSymbols": { "UniswapV2Library": [ 3629 ] }, "id": 3630, "license": "GPL-3.0", "nodeType": "SourceUnit", "nodes": [ { "id": 3159, "literals": [ "solidity", ">=", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "195:24:15" }, { "absolutePath": "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol", "file": "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol", "id": 3160, "nodeType": "ImportDirective", "scope": 3630, "sourceUnit": 1685, "src": "221:66:15", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "file": "@openzeppelin/contracts/math/SafeMath.sol", "id": 3161, "nodeType": "ImportDirective", "scope": 3630, "sourceUnit": 355, "src": "288:51:15", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 3629, "linearizedBaseContracts": [ 3629 ], "name": "UniswapV2Library", "nodeType": "ContractDefinition", "nodes": [ { "id": 3164, "libraryName": { "contractScope": null, "id": 3162, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 354, "src": "378:8:15", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$354", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "372:24:15", "typeName": { "id": 3163, "name": "uint", "nodeType": "ElementaryTypeName", "src": "391:4:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "body": { "id": 3207, "nodeType": "Block", "src": "609:238:15", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 3178, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3176, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3166, "src": "627:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "id": 3177, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3168, "src": "637:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "627:16:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553", "id": 3179, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "645:39:15", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_4ddc3ca35a8b7ccaa016ab70252fdf3396ded4f4fd8375f95b1e9d99790fcdca", "typeString": "literal_string \"UniswapV2Library: IDENTICAL_ADDRESSES\"" }, "value": "UniswapV2Library: IDENTICAL_ADDRESSES" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_4ddc3ca35a8b7ccaa016ab70252fdf3396ded4f4fd8375f95b1e9d99790fcdca", "typeString": "literal_string \"UniswapV2Library: IDENTICAL_ADDRESSES\"" } ], "id": 3175, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "619:7:15", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 3180, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "619:66:15", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3181, "nodeType": "ExpressionStatement", "src": "619:66:15" }, { "expression": { "argumentTypes": null, "id": 3195, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 3182, "name": "token0", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3171, "src": "696:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3183, "name": "token1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3173, "src": "704:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 3184, "isConstant": false, "isInlineArray": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "TupleExpression", "src": "695:16:15", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_address_$_t_address_$", "typeString": "tuple(address,address)" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 3187, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3185, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3166, "src": "714:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 3186, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3168, "src": "723:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "714:15:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 3191, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3168, "src": "752:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3192, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3166, "src": "760:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 3193, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "751:16:15", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_address_$_t_address_$", "typeString": "tuple(address,address)" } }, "id": 3194, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "714:53:15", "trueExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 3188, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3166, "src": "733:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3189, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3168, "src": "741:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 3190, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "732:16:15", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_address_$_t_address_$", "typeString": "tuple(address,address)" } }, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_address_$_t_address_$", "typeString": "tuple(address,address)" } }, "src": "695:72:15", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3196, "nodeType": "ExpressionStatement", "src": "695:72:15" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 3203, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3198, "name": "token0", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3171, "src": "785:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 3201, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "803:1:15", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 3200, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "795:7:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 3199, "name": "address", "nodeType": "ElementaryTypeName", "src": "795:7:15", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 3202, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "795:10:15", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "785:20:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "556e697377617056324c6962726172793a205a45524f5f41444452455353", "id": 3204, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "807:32:15", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_db0dda5a73ac3122e17df097fa2cbce2c5161b45d20c7d6cf363d3b147392c83", "typeString": "literal_string \"UniswapV2Library: ZERO_ADDRESS\"" }, "value": "UniswapV2Library: ZERO_ADDRESS" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_db0dda5a73ac3122e17df097fa2cbce2c5161b45d20c7d6cf363d3b147392c83", "typeString": "literal_string \"UniswapV2Library: ZERO_ADDRESS\"" } ], "id": 3197, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "777:7:15", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 3205, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "777:63:15", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3206, "nodeType": "ExpressionStatement", "src": "777:63:15" } ] }, "documentation": null, "id": 3208, "implemented": true, "kind": "function", "modifiers": [], "name": "sortTokens", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 3169, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3166, "mutability": "mutable", "name": "tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3208, "src": "522:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3165, "name": "address", "nodeType": "ElementaryTypeName", "src": "522:7:15", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3168, "mutability": "mutable", "name": "tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3208, "src": "538:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3167, "name": "address", "nodeType": "ElementaryTypeName", "src": "538:7:15", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "521:32:15" }, "returnParameters": { "id": 3174, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3171, "mutability": "mutable", "name": "token0", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3208, "src": "577:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3170, "name": "address", "nodeType": "ElementaryTypeName", "src": "577:7:15", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3173, "mutability": "mutable", "name": "token1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3208, "src": "593:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3172, "name": "address", "nodeType": "ElementaryTypeName", "src": "593:7:15", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "576:32:15" }, "scope": 3629, "src": "502:345:15", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 3252, "nodeType": "Block", "src": "1039:367:15", "statements": [ { "assignments": [ 3220, 3222 ], "declarations": [ { "constant": false, "id": 3220, "mutability": "mutable", "name": "token0", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3252, "src": "1050:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3219, "name": "address", "nodeType": "ElementaryTypeName", "src": "1050:7:15", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3222, "mutability": "mutable", "name": "token1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3252, "src": "1066:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3221, "name": "address", "nodeType": "ElementaryTypeName", "src": "1066:7:15", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "id": 3227, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 3224, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3212, "src": "1095:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3225, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3214, "src": "1103:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 3223, "name": "sortTokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3208, "src": "1084:10:15", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$returns$_t_address_$_t_address_$", "typeString": "function (address,address) pure returns (address,address)" } }, "id": 3226, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1084:26:15", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_address_$_t_address_$", "typeString": "tuple(address,address)" } }, "nodeType": "VariableDeclarationStatement", "src": "1049:61:15" }, { "expression": { "argumentTypes": null, "id": 3250, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 3228, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3217, "src": "1120:4:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "ff", "id": 3236, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1184:7:15", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9", "typeString": "literal_string (contains invalid UTF-8 sequence at position 0)" }, "value": null }, { "argumentTypes": null, "id": 3237, "name": "factory", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3210, "src": "1209:7:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 3241, "name": "token0", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3220, "src": "1261:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3242, "name": "token1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3222, "src": "1269:6:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "id": 3239, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -1, "src": "1244:3:15", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 3240, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "encodePacked", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1244:16:15", "typeDescriptions": { "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", "typeString": "function () pure returns (bytes memory)"