@sonicxchain/soxswap-periphery
Version:
Peripheral smart contracts for interacting with Soxswap
1,094 lines • 129 kB
JSON
{
"contractName": "SoxswapOracleLibrary",
"abi": [],
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a72305820cb7c0fe5ca76c701281eb735189c710832a2d714df04b2e2c8996fdf8fcb81690029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a72305820cb7c0fe5ca76c701281eb735189c710832a2d714df04b2e2c8996fdf8fcb81690029",
"sourceMap": "277:1464:6:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24",
"deployedSourceMap": "277:1464:6:-;;;;;;;;",
"source": "pragma solidity >=0.4.23 <0.6.0;\r\n\r\nimport '@sonicxchain/soxswap-core/contracts/interfaces/ISoxswapPair.sol';\r\nimport '@sonicxchain/soxswap-lib/contracts/libraries/FixedPoint.sol';\r\n\r\n// library with helper methods for oracles that are concerned with computing average prices\r\nlibrary SoxswapOracleLibrary {\r\n using FixedPoint for *;\r\n\r\n // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]\r\n function currentBlockTimestamp() internal view returns (uint32) {\r\n return uint32(block.timestamp % 2 ** 32);\r\n }\r\n\r\n // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.\r\n function currentCumulativePrices(\r\n address pair\r\n ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {\r\n blockTimestamp = currentBlockTimestamp();\r\n price0Cumulative = ISoxswapPair(pair).price0CumulativeLast();\r\n price1Cumulative = ISoxswapPair(pair).price1CumulativeLast();\r\n\r\n // if time has elapsed since the last update on the pair, mock the accumulated price values\r\n (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = ISoxswapPair(pair).getReserves();\r\n if (blockTimestampLast != blockTimestamp) {\r\n // subtraction overflow is desired\r\n uint32 timeElapsed = blockTimestamp - blockTimestampLast;\r\n // addition overflow is desired\r\n // counterfactual\r\n price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;\r\n // counterfactual\r\n price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;\r\n }\r\n }\r\n}\r\n",
"sourcePath": "D:/40_SonicX_DEX/soxswap-periphery/contracts/libraries/SoxswapOracleLibrary.sol",
"ast": {
"absolutePath": "/D/40_SonicX_DEX/soxswap-periphery/contracts/libraries/SoxswapOracleLibrary.sol",
"exportedSymbols": {
"SoxswapOracleLibrary": [
3147
]
},
"id": 3148,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3045,
"literals": [
"solidity",
">=",
"0.4",
".23",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:6"
},
{
"absolutePath": "@sonicxchain/soxswap-core/contracts/interfaces/ISoxswapPair.sol",
"file": "@sonicxchain/soxswap-core/contracts/interfaces/ISoxswapPair.sol",
"id": 3046,
"nodeType": "ImportDirective",
"scope": 3148,
"sourceUnit": 3517,
"src": "36:73:6",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@sonicxchain/soxswap-lib/contracts/libraries/FixedPoint.sol",
"file": "@sonicxchain/soxswap-lib/contracts/libraries/FixedPoint.sol",
"id": 3047,
"nodeType": "ImportDirective",
"scope": 3148,
"sourceUnit": 4187,
"src": "111:69:6",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 3147,
"linearizedBaseContracts": [
3147
],
"name": "SoxswapOracleLibrary",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 3049,
"libraryName": {
"contractScope": null,
"id": 3048,
"name": "FixedPoint",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4186,
"src": "319:10:6",
"typeDescriptions": {
"typeIdentifier": "t_contract$_FixedPoint_$4186",
"typeString": "library FixedPoint"
}
},
"nodeType": "UsingForDirective",
"src": "313:23:6",
"typeName": null
},
{
"body": {
"id": 3063,
"nodeType": "Block",
"src": "521:59:6",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3060,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 3055,
"name": "block",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4564,
"src": "546:5:6",
"typeDescriptions": {
"typeIdentifier": "t_magic_block",
"typeString": "block"
}
},
"id": 3056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "timestamp",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "546:15:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "%",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_rational_4294967296_by_1",
"typeString": "int_const 4294967296"
},
"id": 3059,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"hexValue": "32",
"id": 3057,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "564:1:6",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"nodeType": "BinaryOperation",
"operator": "**",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3332",
"id": 3058,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "569:2:6",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_32_by_1",
"typeString": "int_const 32"
},
"value": "32"
},
"src": "564:7:6",
"typeDescriptions": {
"typeIdentifier": "t_rational_4294967296_by_1",
"typeString": "int_const 4294967296"
}
},
"src": "546:25:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 3054,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "539:6:6",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint32_$",
"typeString": "type(uint32)"
},
"typeName": "uint32"
},
"id": 3061,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "539:33:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"functionReturnParameters": 3053,
"id": 3062,
"nodeType": "Return",
"src": "532:40:6"
}
]
},
"documentation": null,
"id": 3064,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentBlockTimestamp",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3050,
"nodeType": "ParameterList",
"parameters": [],
"src": "487:2:6"
},
"returnParameters": {
"id": 3053,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3052,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 3064,
"src": "513:6:6",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 3051,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "513:6:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "512:8:6"
},
"scope": 3147,
"src": "457:123:6",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 3145,
"nodeType": "Block",
"src": "841:897:6",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3078,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3075,
"name": "blockTimestamp",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3073,
"src": "852:14:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 3076,
"name": "currentBlockTimestamp",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3064,
"src": "869:21:6",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_uint32_$",
"typeString": "function () view returns (uint32)"
}
},
"id": 3077,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "869:23:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"src": "852:40:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"id": 3079,
"nodeType": "ExpressionStatement",
"src": "852:40:6"
},
{
"expression": {
"argumentTypes": null,
"id": 3086,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3080,
"name": "price0Cumulative",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3069,
"src": "903:16:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3082,
"name": "pair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3066,
"src": "935:4:6",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 3081,
"name": "ISoxswapPair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3516,
"src": "922:12:6",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISoxswapPair_$3516_$",
"typeString": "type(contract ISoxswapPair)"
}
},
"id": 3083,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "922:18:6",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISoxswapPair_$3516",
"typeString": "contract ISoxswapPair"
}
},
"id": 3084,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "price0CumulativeLast",
"nodeType": "MemberAccess",
"referencedDeclaration": 3463,
"src": "922:39:6",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 3085,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "922:41:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "903:60:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3087,
"nodeType": "ExpressionStatement",
"src": "903:60:6"
},
{
"expression": {
"argumentTypes": null,
"id": 3094,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3088,
"name": "price1Cumulative",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3071,
"src": "974:16:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3090,
"name": "pair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3066,
"src": "1006:4:6",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 3089,
"name": "ISoxswapPair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3516,
"src": "993:12:6",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISoxswapPair_$3516_$",
"typeString": "type(contract ISoxswapPair)"
}
},
"id": 3091,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "993:18:6",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISoxswapPair_$3516",
"typeString": "contract ISoxswapPair"
}
},
"id": 3092,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "price1CumulativeLast",
"nodeType": "MemberAccess",
"referencedDeclaration": 3468,
"src": "993:39:6",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 3093,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "993:41:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "974:60:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3095,
"nodeType": "ExpressionStatement",
"src": "974:60:6"
},
{
"assignments": [
3097,
3099,
3101
],
"declarations": [
{
"constant": false,
"id": 3097,
"name": "reserve0",
"nodeType": "VariableDeclaration",
"scope": 3145,
"src": "1149:16:6",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
},
"typeName": {
"id": 3096,
"name": "uint112",
"nodeType": "ElementaryTypeName",
"src": "1149:7:6",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 3099,
"name": "reserve1",
"nodeType": "VariableDeclaration",
"scope": 3145,
"src": "1167:16:6",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
},
"typeName": {
"id": 3098,
"name": "uint112",
"nodeType": "ElementaryTypeName",
"src": "1167:7:6",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 3101,
"name": "blockTimestampLast",
"nodeType": "VariableDeclaration",
"scope": 3145,
"src": "1185:25:6",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 3100,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1185:6:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 3107,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3103,
"name": "pair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3066,
"src": "1227:4:6",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 3102,
"name": "ISoxswapPair",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3516,
"src": "1214:12:6",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISoxswapPair_$3516_$",
"typeString": "type(contract ISoxswapPair)"
}
},
"id": 3104,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1214:18:6",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISoxswapPair_$3516",
"typeString": "contract ISoxswapPair"
}
},
"id": 3105,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "getReserves",
"nodeType": "MemberAccess",
"referencedDeclaration": 3458,
"src": "1214:30:6",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint112_$_t_uint112_$_t_uint32_$",
"typeString": "function () view external returns (uint112,uint112,uint32)"
}
},
"id": 3106,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1214:32:6",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint112_$_t_uint112_$_t_uint32_$",
"typeString": "tuple(uint112,uint112,uint32)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1148:98:6"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"id": 3110,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3108,
"name": "blockTimestampLast",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3101,
"src": "1261:18:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"id": 3109,
"name": "blockTimestamp",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3073,
"src": "1283:14:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"src": "1261:36:6",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 3144,
"nodeType": "IfStatement",
"src": "1257:474:6",
"trueBody": {
"id": 3143,
"nodeType": "Block",
"src": "1299:432:6",
"statements": [
{
"assignments": [
3112
],
"declarations": [
{
"constant": false,
"id": 3112,
"name": "timeElapsed",
"nodeType": "VariableDeclaration",
"scope": 3143,
"src": "1362:18:6",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 3111,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1362:6:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 3116,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"id": 3115,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3113,
"name": "blockTimestamp",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3073,
"src": "1383:14:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 3114,
"name": "blockTimestampLast",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3101,
"src": "1400:18:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"src": "1383:35:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1362:56:6"
},
{
"expression": {
"argumentTypes": null,
"id": 3128,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3117,
"name": "price0Cumulative",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3069,
"src": "1509:16:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3127,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3121,
"name": "reserve1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3099,
"src": "1554:8:6",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
},
{
"argumentTypes": null,
"id": 3122,
"name": "reserve0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3097,
"src": "1564:8:6",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint112",
"typeString": "uint112"
},
{
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
],
"expression": {
"argumentTypes": null,
"id": 3119,
"name": "FixedPoint",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4186,
"src": "1534:10:6",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FixedPoint_$4186_$",
"typeString": "type(library FixedPoint)"
}
},
"id": 3120,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "fraction",
"nodeType": "MemberAccess",
"referencedDeclaration": 4136,
"src": "1534:19:6",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint112_$_t_uint112_$returns$_t_struct$_uq112x112_$3718_memory_ptr_$",
"typeString": "function (uint112,uint112) pure returns (struct FixedPoint.uq112x112 memory)"
}
},
"id": 3123,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1534:39:6",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$3718_memory_ptr",
"typeString": "struct FixedPoint.uq112x112 memory"
}
},
"id": 3124,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "_x",
"nodeType": "MemberAccess",
"referencedDeclaration": 3717,
"src": "1534:42:6",
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
],
"id": 3118,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1529:4:6",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": "uint"
},
"id": 3125,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1529:48:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 3126,
"name": "timeElapsed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3112,
"src": "1580:11:6",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"src": "1529:62:6",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1509:82:6",
"typeDescriptions": {
"typeIdentifier": "t_ui