moonwalkerswap-v1-core
Version:
Moonwalkerswap v1 core
1,167 lines (1,166 loc) • 79.1 kB
JSON
{
"contractName": "SafeCast",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Safe casting methods\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Contains methods for safely casting between types\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol\":\"SafeCast\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol\":{\"keccak256\":\"0x4a12ab60fdb663b341bb3a2f5c6631ba40b7b6fa9d131c9540b60dbb4196a27e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d55e89b639f5ea027798cf3f246f38209308e812b8e568d19aa487bcdc8008a0\",\"dweb:/ipfs/QmfRWZGxKK21EgQea2PLxgJ6aypEbQjQSotHiruXGmKVm6\"]}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a112879d0d9f1861d41e24664555f1692f52ce2429d1ae0da4e4e620bb15e4d264736f6c63430007060033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a112879d0d9f1861d41e24664555f1692f52ce2429d1ae0da4e4e620bb15e4d264736f6c63430007060033",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "152:882:25:-:0;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "152:882:25:-:0;;;;;;;;",
"source": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n",
"sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol",
"ast": {
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol",
"exportedSymbols": {
"SafeCast": [
5150
]
},
"id": 5151,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 5082,
"literals": [
"solidity",
">=",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "32:24:25"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 5083,
"nodeType": "StructuredDocumentation",
"src": "58:94:25",
"text": "@title Safe casting methods\n @notice Contains methods for safely casting between types"
},
"fullyImplemented": true,
"id": 5150,
"linearizedBaseContracts": [
5150
],
"name": "SafeCast",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 5103,
"nodeType": "Block",
"src": "408:47:25",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5100,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"components": [
{
"id": 5097,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 5092,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5089,
"src": "427:1:25",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 5095,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5086,
"src": "439:1:25",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 5094,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "431:7:25",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint160_$",
"typeString": "type(uint160)"
},
"typeName": {
"id": 5093,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "431:7:25",
"typeDescriptions": {}
}
},
"id": 5096,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "431:10:25",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "427:14:25",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 5098,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "426:16:25",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 5099,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5086,
"src": "446:1:25",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "426:21:25",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 5091,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "418:7:25",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 5101,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "418:30:25",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5102,
"nodeType": "ExpressionStatement",
"src": "418:30:25"
}
]
},
"documentation": {
"id": 5084,
"nodeType": "StructuredDocumentation",
"src": "175:164:25",
"text": "@notice Cast a uint256 to a uint160, revert on overflow\n @param y The uint256 to be downcasted\n @return z The downcasted integer, now type uint160"
},
"id": 5104,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "toUint160",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5087,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5086,
"mutability": "mutable",
"name": "y",
"nodeType": "VariableDeclaration",
"scope": 5104,
"src": "363:9:25",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5085,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "363:7:25",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "362:11:25"
},
"returnParameters": {
"id": 5090,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5089,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"scope": 5104,
"src": "397:9:25",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 5088,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "397:7:25",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
}
],
"src": "396:11:25"
},
"scope": 5150,
"src": "344:111:25",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 5124,
"nodeType": "Block",
"src": "700:46:25",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 5121,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"components": [
{
"id": 5118,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 5113,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5110,
"src": "719:1:25",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 5116,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5107,
"src": "730:1:25",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_int256",
"typeString": "int256"
}
],
"id": 5115,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "723:6:25",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_int128_$",
"typeString": "type(int128)"
},
"typeName": {
"id": 5114,
"name": "int128",
"nodeType": "ElementaryTypeName",
"src": "723:6:25",
"typeDescriptions": {}
}
},
"id": 5117,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "723:9:25",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
},
"src": "719:13:25",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
}
],
"id": 5119,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "718:15:25",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 5120,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5107,
"src": "737:1:25",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "718:20:25",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 5112,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "710:7:25",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 5122,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "710:29:25",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5123,
"nodeType": "ExpressionStatement",
"src": "710:29:25"
}
]
},
"documentation": {
"id": 5105,
"nodeType": "StructuredDocumentation",
"src": "461:173:25",
"text": "@notice Cast a int256 to a int128, revert on overflow or underflow\n @param y The int256 to be downcasted\n @return z The downcasted integer, now type int128"
},
"id": 5125,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "toInt128",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5108,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5107,
"mutability": "mutable",
"name": "y",
"nodeType": "VariableDeclaration",
"scope": 5125,
"src": "657:8:25",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 5106,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "657:6:25",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "656:10:25"
},
"returnParameters": {
"id": 5111,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5110,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"scope": 5125,
"src": "690:8:25",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
},
"typeName": {
"id": 5109,
"name": "int128",
"nodeType": "ElementaryTypeName",
"src": "690:6:25",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
},
"visibility": "internal"
}
],
"src": "689:10:25"
},
"scope": 5150,
"src": "639:107:25",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 5148,
"nodeType": "Block",
"src": "973:59:25",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5138,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 5134,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5128,
"src": "991:1:25",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"commonType": {
"typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1",
"typeString": "int_const 5789...(69 digits omitted)...9968"
},
"id": 5137,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"hexValue": "32",
"id": 5135,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "995:1:25",
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"nodeType": "BinaryOperation",
"operator": "**",
"rightExpression": {
"hexValue": "323535",
"id": 5136,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "998:3:25",
"typeDescriptions": {
"typeIdentifier": "t_rational_255_by_1",
"typeString": "int_const 255"
},
"value": "255"
},
"src": "995:6:25",
"typeDescriptions": {
"typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1",
"typeString": "int_const 5789...(69 digits omitted)...9968"
}
},
"src": "991:10:25",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 5133,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "983:7:25",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 5139,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "983:19:25",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5140,
"nodeType": "ExpressionStatement",
"src": "983:19:25"
},
{
"expression": {
"id": 5146,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 5141,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5131,
"src": "1012:1:25",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 5144,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5128,
"src": "1023:1:25",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 5143,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1016:6:25",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_int256_$",
"typeString": "type(int256)"
},
"typeName": {
"id": 5142,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "1016:6:25",
"typeDescriptions": {}
}
},
"id": 5145,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1016:9:25",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "1012:13:25",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"id": 5147,
"nodeType": "ExpressionStatement",
"src": "1012:13:25"
}
]
},
"documentation": {
"id": 5126,
"nodeType": "StructuredDocumentation",
"src": "752:154:25",
"text": "@notice Cast a uint256 to a int256, revert on overflow\n @param y The uint256 to be casted\n @return z The casted integer, now type int256"
},
"id": 5149,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "toInt256",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5129,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5128,
"mutability": "mutable",
"name": "y",
"nodeType": "VariableDeclaration",
"scope": 5149,
"src": "929:9:25",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5127,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "929:7:25",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "928:11:25"
},
"returnParameters": {
"id": 5132,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5131,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"scope": 5149,
"src": "963:8:25",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 5130,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "963:6:25",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "962:10:25"
},
"scope": 5150,
"src": "911:121:25",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
}
],
"scope": 5151,
"src": "152:882:25"
}
],
"src": "32:1003:25"
},
"legacyAST": {
"attributes": {
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol",
"exportedSymbols": {
"SafeCast": [
5150
]
},
"license": "MIT"
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.5",
".0"
]
},
"id": 5082,
"name": "PragmaDirective",
"src": "32:24:25"
},
{
"attributes": {
"abstract": false,
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"fullyImplemented": true,
"linearizedBaseContracts": [
5150
],
"name": "SafeCast",
"scope": 5151
},
"children": [
{
"attributes": {
"text": "@title Safe casting methods\n @notice Contains methods for safely casting between types"
},
"id": 5083,
"name": "StructuredDocumentation",
"src": "58:94:25"
},
{
"attributes": {
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "toUint160",
"scope": 5150,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
"children": [
{
"attributes": {
"text": "@notice Cast a uint256 to a uint160, revert on overflow\n @param y The uint256 to be downcasted\n @return z The downcasted integer, now type uint160"
},
"id": 5084,
"name": "StructuredDocumentation",
"src": "175:164:25"
},
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "y",
"scope": 5104,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 5085,
"name": "ElementaryTypeName",
"src": "363:7:25"
}
],
"id": 5086,
"name": "VariableDeclaration",
"src": "363:9:25"
}
],
"id": 5087,
"name": "ParameterList",
"src": "362:11:25"
},
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "z",
"scope": 5104,
"stateVariable": false,
"storageLocation": "default",
"type": "uint160",
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint160",
"type": "uint160"
},
"id": 5088,
"name": "ElementaryTypeName",
"src": "397:7:25"
}
],
"id": 5089,
"name": "VariableDeclaration",
"src": "397:9:25"
}
],
"id": 5090,
"name": "ParameterList",
"src": "396:11:25"
},
{
"children": [
{
"children": [
{
"attributes": {
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"tryCall": false,
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"type": "function (bool) pure",
"value": "require"
},
"id": 5091,
"name": "Identifier",
"src": "418:7:25"
},
{
"attributes": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "==",
"type": "bool"
},
"children": [
{
"attributes": {
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"type": "uint160"
},
"children": [
{
"attributes": {
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint160"
},
"children": [
{
"attributes": {
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5089,
"type": "uint160",
"value": "z"
},
"id": 5092,
"name": "Identifier",
"src": "427:1:25"
},
{
"attributes": {
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"tryCall": false,
"type": "uint160",
"type_conversion": true
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"type": "type(uint160)"
},
"children": [
{
"attributes": {
"name": "uint160"
},
"id": 5093,
"name": "ElementaryTypeName",
"src": "431:7:25"
}
],
"id": 5094,
"name": "ElementaryTypeNameExpression",
"src": "431:7:25"
},
{
"attributes": {
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5086,