moonwalkerswap-v2-periphery
Version:
Moonwalkerswap v2 periphery
1,004 lines (1,003 loc) • 640 kB
JSON
{
"contractName": "MoonwalkerswapV2Library",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.6.6+commit.6c089d02\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2Library.sol\":\"MoonwalkerswapV2Library\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2Library.sol\":{\"keccak256\":\"0x159bee476db809637551ce5ad20be89ad14ea04cb5150cd0c0ec857e81d82c24\",\"urls\":[\"bzz-raw://41d88c1b2583bf07daf655dfebdae4ac77e8ee10b96ec860666f0dd5bfabdaab\",\"dweb:/ipfs/QmNi6c4r9JoJRbkvmB5bbmDKgwXTyuqoHLVESAekem3quu\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/SafeMath.sol\":{\"keccak256\":\"0x27f0ea82f879b3b01387b583e6d9d0ec858dca3b22b0aad173f8fbda06e761e1\",\"urls\":[\"bzz-raw://0db9cf37793eb7035f0bfced36323d240f0212150009c39a3a108701d9b50b6c\",\"dweb:/ipfs/QmUAdiG9XNcieXkKfiMB49zQqD34FbXFE15csV2KQzwEqg\"]},\"moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol\":{\"keccak256\":\"0x4c888477bfd9725859e9136902f4e0e2b00c1f60fa640083226cb04a2e6e2b2d\",\"urls\":[\"bzz-raw://6bdfa268dbce3f14b7a324c84094d2aa4b51764a344c61eb7e7d179ca54f6861\",\"dweb:/ipfs/QmcGAFVuybBuNyp8Woza32E8T1Dsh9nrrCgecmHEazFTx6\"]}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e38d66b94cc1535f2a2d2ede4f71672ca4027560fc7dce472b98e3086b55be6564736f6c63430006060033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e38d66b94cc1535f2a2d2ede4f71672ca4027560fc7dce472b98e3086b55be6564736f6c63430006060033",
"immutableReferences": {},
"sourceMap": "127:4411:10:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24",
"deployedSourceMap": "127:4411:10:-:0;;;;;;12:1:-1;9;2:12",
"source": "pragma solidity >=0.5.0;\n\nimport 'moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol';\n\nimport \"./SafeMath.sol\";\n\nlibrary MoonwalkerswapV2Library {\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, 'MoonwalkerswapV2Library: IDENTICAL_ADDRESSES');\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), 'MoonwalkerswapV2Library: 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,) = IMoonwalkerPair(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, 'MoonwalkerswapV2Library: INSUFFICIENT_AMOUNT');\n require(reserveA > 0 && reserveB > 0, 'MoonwalkerswapV2Library: 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, 'MoonwalkerswapV2Library: INSUFFICIENT_INPUT_AMOUNT');\n require(reserveIn > 0 && reserveOut > 0, 'MoonwalkerswapV2Library: 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, 'MoonwalkerswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');\n require(reserveIn > 0 && reserveOut > 0, 'MoonwalkerswapV2Library: 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, 'MoonwalkerswapV2Library: 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, 'MoonwalkerswapV2Library: 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}\n",
"sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2Library.sol",
"ast": {
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2Library.sol",
"exportedSymbols": {
"MoonwalkerswapV2Library": [
4719
]
},
"id": 4720,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4249,
"literals": [
"solidity",
">=",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:24:10"
},
{
"absolutePath": "moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol",
"file": "moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol",
"id": 4250,
"nodeType": "ImportDirective",
"scope": 4720,
"sourceUnit": 8545,
"src": "26:73:10",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/SafeMath.sol",
"file": "./SafeMath.sol",
"id": 4251,
"nodeType": "ImportDirective",
"scope": 4720,
"sourceUnit": 5368,
"src": "101:24:10",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 4719,
"linearizedBaseContracts": [
4719
],
"name": "MoonwalkerswapV2Library",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 4254,
"libraryName": {
"contractScope": null,
"id": 4252,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5367,
"src": "171:8:10",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$5367",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "165:24:10",
"typeName": {
"id": 4253,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "184:4:10",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"body": {
"id": 4297,
"nodeType": "Block",
"src": "402:252:10",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4268,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4266,
"name": "tokenA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4256,
"src": "420:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"id": 4267,
"name": "tokenB",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4258,
"src": "430:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "420:16:10",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4d6f6f6e77616c6b65727377617056324c6962726172793a204944454e544943414c5f414444524553534553",
"id": 4269,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "438:46:10",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_88d4bd4e78e181d7e781d7701d740e37990447986926ed2a13a369d668d3c29b",
"typeString": "literal_string \"MoonwalkerswapV2Library: IDENTICAL_ADDRESSES\""
},
"value": "MoonwalkerswapV2Library: IDENTICAL_ADDRESSES"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_88d4bd4e78e181d7e781d7701d740e37990447986926ed2a13a369d668d3c29b",
"typeString": "literal_string \"MoonwalkerswapV2Library: IDENTICAL_ADDRESSES\""
}
],
"id": 4265,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "412:7:10",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4270,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "412:73:10",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4271,
"nodeType": "ExpressionStatement",
"src": "412:73:10"
},
{
"expression": {
"argumentTypes": null,
"id": 4285,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 4272,
"name": "token0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4261,
"src": "496:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4273,
"name": "token1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4263,
"src": "504:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"id": 4274,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "495:16:10",
"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": 4277,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4275,
"name": "tokenA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4256,
"src": "514:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 4276,
"name": "tokenB",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4258,
"src": "523:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "514:15:10",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 4281,
"name": "tokenB",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4258,
"src": "552:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4282,
"name": "tokenA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4256,
"src": "560:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"id": 4283,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "551:16:10",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_address_$_t_address_$",
"typeString": "tuple(address,address)"
}
},
"id": 4284,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "Conditional",
"src": "514:53:10",
"trueExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 4278,
"name": "tokenA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4256,
"src": "533:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4279,
"name": "tokenB",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4258,
"src": "541:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"id": 4280,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "532:16:10",
"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": "495:72:10",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4286,
"nodeType": "ExpressionStatement",
"src": "495:72:10"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4293,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4288,
"name": "token0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4261,
"src": "585:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 4291,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "603:1:10",
"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": 4290,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "595:7:10",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 4289,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "595:7:10",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 4292,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "595:10:10",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "585:20:10",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4d6f6f6e77616c6b65727377617056324c6962726172793a205a45524f5f41444452455353",
"id": 4294,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "607:39:10",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_0644e380931049dc0e0c796b9e762f3168227c19994e8d2f33aa95fc29099d71",
"typeString": "literal_string \"MoonwalkerswapV2Library: ZERO_ADDRESS\""
},
"value": "MoonwalkerswapV2Library: ZERO_ADDRESS"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_0644e380931049dc0e0c796b9e762f3168227c19994e8d2f33aa95fc29099d71",
"typeString": "literal_string \"MoonwalkerswapV2Library: ZERO_ADDRESS\""
}
],
"id": 4287,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "577:7:10",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4295,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "577:70:10",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4296,
"nodeType": "ExpressionStatement",
"src": "577:70:10"
}
]
},
"documentation": null,
"id": 4298,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sortTokens",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 4259,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4256,
"mutability": "mutable",
"name": "tokenA",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 4298,
"src": "315:14:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4255,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "315:7:10",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4258,
"mutability": "mutable",
"name": "tokenB",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 4298,
"src": "331:14:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4257,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "331:7:10",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "314:32:10"
},
"returnParameters": {
"id": 4264,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4261,
"mutability": "mutable",
"name": "token0",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 4298,
"src": "370:14:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4260,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "370:7:10",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4263,
"mutability": "mutable",
"name": "token1",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 4298,
"src": "386:14:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4262,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "386:7:10",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "369:32:10"
},
"scope": 4719,
"src": "295:359:10",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 4342,
"nodeType": "Block",
"src": "846:367:10",
"statements": [
{
"assignments": [
4310,
4312
],
"declarations": [
{
"constant": false,
"id": 4310,
"mutability": "mutable",
"name": "token0",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 4342,
"src": "857:14:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4309,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "857:7:10",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4312,
"mutability": "mutable",
"name": "token1",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 4342,
"src": "873:14:10",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4311,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "873:7:10",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4317,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4314,
"name": "tokenA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4302,
"src": "902:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4315,
"name": "tokenB",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4304,
"src": "910:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4313,
"name": "sortTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4298,
"src": "891:10:10",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$returns$_t_address_$_t_address_$",
"typeString": "function (address,address) pure returns (address,address)"
}
},
"id": 4316,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "891:26:10",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_address_$_t_address_$",
"typeString": "tuple(address,address)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "856:61:10"
},
{
"expression": {
"argumentTypes": null,
"id": 4340,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4318,
"name": "pair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4307,
"src": "927:4:10",
"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": 4326,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "991:7:10",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9",
"typeString": "literal_string (contains invalid UTF-8 sequence at position 0)"
},
"value": null
},
{
"argumentTypes": null,
"id": 4327,
"name": "factory",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4300,
"src": "1016:7:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4331,
"name": "token0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4310,
"src": "1068:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4332,
"name": "token1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4312,
"src": "1076:6:10",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"id": 4329,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -1,
"src": "1051:3:10",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 4330,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodePacked",