@levelk/token-price-oracles
Version:
tools for creating token price data feeds and oracles that integrate with on-chain dex's
1,181 lines • 95.5 kB
JSON
{
"contractName": "ExchangeAdapterMock",
"abi": [
{
"inputs": [
{
"name": "tokenAddresses",
"type": "address[]"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"constant": false,
"inputs": [
{
"name": "token1",
"type": "address"
},
{
"name": "token2",
"type": "address"
},
{
"name": "price",
"type": "uint256"
}
],
"name": "setPriceForTokenPair",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "token1",
"type": "address"
},
{
"name": "token2",
"type": "address"
}
],
"name": "getPriceForTokenPair",
"outputs": [
{
"name": "price",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "token1",
"type": "address"
},
{
"name": "token2",
"type": "address"
}
],
"name": "tokenPairExists",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405161046c38038061046c8339810180604052810190808051820192919050505060008090505b81518110156100bd576001600080848481518110151561005557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610039565b505061039e806100ce6000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806357e057041461005c5780635aaaa795146100c9578063d6e7444d14610140575b600080fd5b34801561006857600080fd5b506100c7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506101bb565b005b3480156100d557600080fd5b5061012a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610241565b6040518082815260200191505060405180910390f35b34801561014c57600080fd5b506101a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102c8565b604051808215151515815260200191505060405180910390f35b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561036a57506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b9050929150505600a165627a7a72305820168ce79cf0ec520b7ace26d94af2cc1c92f315b22cfe755c3bd545ba1aa4e8120029",
"deployedBytecode": "0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806357e057041461005c5780635aaaa795146100c9578063d6e7444d14610140575b600080fd5b34801561006857600080fd5b506100c7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506101bb565b005b3480156100d557600080fd5b5061012a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610241565b6040518082815260200191505060405180910390f35b34801561014c57600080fd5b506101a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102c8565b604051808215151515815260200191505060405180910390f35b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561036a57506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b9050929150505600a165627a7a72305820168ce79cf0ec520b7ace26d94af2cc1c92f315b22cfe755c3bd545ba1aa4e8120029",
"sourceMap": "92:756:9:-;;;257:153;8:9:-1;5:2;;;30:1;27;20:12;5:2;257:153:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;305:6;314:1;305:10;;301:105;321:14;:21;317:1;:25;301:105;;;395:4;357:16;:35;374:14;389:1;374:17;;;;;;;;;;;;;;;;;;357:35;;;;;;;;;;;;;;;;:42;;;;;;;;;;;;;;;;;;344:3;;;;;;;301:105;;;257:153;;92:756;;;;;;",
"deployedSourceMap": "92:756:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;414:125;;8:9:-1;5:2;;;30:1;27;20:12;5:2;414:125:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;543:145;;8:9:-1;5:2;;;30:1;27;20:12;5:2;543:145:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;692:154;;8:9:-1;5:2;;;30:1;27;20:12;5:2;692:154:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;414:125;529:5;494:16;:24;511:6;494:24;;;;;;;;;;;;;;;:32;519:6;494:32;;;;;;;;;;;;;;;:40;;;;414:125;;;:::o;543:145::-;626:10;651:16;:24;668:6;651:24;;;;;;;;;;;;;;;:32;676:6;651:32;;;;;;;;;;;;;;;;644:39;;543:145;;;;:::o;692:154::-;770:4;789:16;:24;806:6;789:24;;;;;;;;;;;;;;;;;;;;;;;;;:52;;;;;817:16;:24;834:6;817:24;;;;;;;;;;;;;;;;;;;;;;;;;789:52;782:59;;692:154;;;;:::o",
"source": "pragma solidity >=0.4.24;\n\nimport \"../../contracts/ExchangeAdapters/IExchangeAdapter.sol\";\n\ncontract ExchangeAdapterMock is IExchangeAdapter {\n\n mapping(address => bool) mock_tokenExists;\n mapping(address => mapping(address => uint)) mock_tokenPrices;\n\n constructor(address[] tokenAddresses) {\n for(uint i = 0; i < tokenAddresses.length; i++) {\n mock_tokenExists[tokenAddresses[i]] = true;\n }\n }\n\n function setPriceForTokenPair(address token1, address token2, uint price) {\n mock_tokenPrices[token1][token2] = price;\n }\n\n function getPriceForTokenPair(address token1, address token2) public view returns (uint price) {\n return mock_tokenPrices[token1][token2];\n }\n\n function tokenPairExists(address token1, address token2) public view returns (bool) {\n return mock_tokenExists[token1] && mock_tokenExists[token2];\n }\n}\n",
"sourcePath": "/Users/mfcalvanese/dev/eth/token-price-oracles/test/mocks/ExchangeAdapterMock.sol",
"ast": {
"absolutePath": "/Users/mfcalvanese/dev/eth/token-price-oracles/test/mocks/ExchangeAdapterMock.sol",
"exportedSymbols": {
"ExchangeAdapterMock": [
1356
]
},
"id": 1357,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1262,
"literals": [
"solidity",
">=",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:25:9"
},
{
"absolutePath": "/Users/mfcalvanese/dev/eth/token-price-oracles/contracts/ExchangeAdapters/IExchangeAdapter.sol",
"file": "../../contracts/ExchangeAdapters/IExchangeAdapter.sol",
"id": 1263,
"nodeType": "ImportDirective",
"scope": 1357,
"sourceUnit": 641,
"src": "27:63:9",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 1264,
"name": "IExchangeAdapter",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 640,
"src": "124:16:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IExchangeAdapter_$640",
"typeString": "contract IExchangeAdapter"
}
},
"id": 1265,
"nodeType": "InheritanceSpecifier",
"src": "124:16:9"
}
],
"contractDependencies": [
640
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 1356,
"linearizedBaseContracts": [
1356,
640
],
"name": "ExchangeAdapterMock",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 1269,
"name": "mock_tokenExists",
"nodeType": "VariableDeclaration",
"scope": 1356,
"src": "146:41:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"typeName": {
"id": 1268,
"keyType": {
"id": 1266,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "154:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "146:24:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"valueType": {
"id": 1267,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "165:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1275,
"name": "mock_tokenPrices",
"nodeType": "VariableDeclaration",
"scope": 1356,
"src": "191:61:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$",
"typeString": "mapping(address => mapping(address => uint256))"
},
"typeName": {
"id": 1274,
"keyType": {
"id": 1270,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "199:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "191:44:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$",
"typeString": "mapping(address => mapping(address => uint256))"
},
"valueType": {
"id": 1273,
"keyType": {
"id": 1271,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "218:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "210:24:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 1272,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "229:4:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
}
},
"value": null,
"visibility": "internal"
},
{
"body": {
"id": 1302,
"nodeType": "Block",
"src": "295:115:9",
"statements": [
{
"body": {
"id": 1300,
"nodeType": "Block",
"src": "349:57:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 1298,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 1292,
"name": "mock_tokenExists",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1269,
"src": "357:16:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
}
},
"id": 1296,
"indexExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 1293,
"name": "tokenAddresses",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1278,
"src": "374:14:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_memory_ptr",
"typeString": "address[] memory"
}
},
"id": 1295,
"indexExpression": {
"argumentTypes": null,
"id": 1294,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1282,
"src": "389:1:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "374:17:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "357:35:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 1297,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "395:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "357:42:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 1299,
"nodeType": "ExpressionStatement",
"src": "357:42:9"
}
]
},
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1288,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1285,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1282,
"src": "317:1:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1286,
"name": "tokenAddresses",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1278,
"src": "321:14:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_memory_ptr",
"typeString": "address[] memory"
}
},
"id": 1287,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "321:21:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "317:25:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 1301,
"initializationExpression": {
"assignments": [
1282
],
"declarations": [
{
"constant": false,
"id": 1282,
"name": "i",
"nodeType": "VariableDeclaration",
"scope": 1303,
"src": "305:6:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1281,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "305:4:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 1284,
"initialValue": {
"argumentTypes": null,
"hexValue": "30",
"id": 1283,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "314:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"nodeType": "VariableDeclarationStatement",
"src": "305:10:9"
},
"loopExpression": {
"expression": {
"argumentTypes": null,
"id": 1290,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "++",
"prefix": false,
"src": "344:3:9",
"subExpression": {
"argumentTypes": null,
"id": 1289,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1282,
"src": "344:1:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1291,
"nodeType": "ExpressionStatement",
"src": "344:3:9"
},
"nodeType": "ForStatement",
"src": "301:105:9"
}
]
},
"documentation": null,
"id": 1303,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1279,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1278,
"name": "tokenAddresses",
"nodeType": "VariableDeclaration",
"scope": 1303,
"src": "269:24:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_memory_ptr",
"typeString": "address[]"
},
"typeName": {
"baseType": {
"id": 1276,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "269:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 1277,
"length": null,
"nodeType": "ArrayTypeName",
"src": "269:9:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage_ptr",
"typeString": "address[]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "268:26:9"
},
"payable": false,
"returnParameters": {
"id": 1280,
"nodeType": "ParameterList",
"parameters": [],
"src": "295:0:9"
},
"scope": 1356,
"src": "257:153:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 1320,
"nodeType": "Block",
"src": "488:51:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 1318,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 1312,
"name": "mock_tokenPrices",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1275,
"src": "494:16:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$",
"typeString": "mapping(address => mapping(address => uint256))"
}
},
"id": 1315,
"indexExpression": {
"argumentTypes": null,
"id": 1313,
"name": "token1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1305,
"src": "511:6:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "494:24:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 1316,
"indexExpression": {
"argumentTypes": null,
"id": 1314,
"name": "token2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1307,
"src": "519:6:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "494:32:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 1317,
"name": "price",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1309,
"src": "529:5:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "494:40:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1319,
"nodeType": "ExpressionStatement",
"src": "494:40:9"
}
]
},
"documentation": null,
"id": 1321,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "setPriceForTokenPair",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1310,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1305,
"name": "token1",
"nodeType": "VariableDeclaration",
"scope": 1321,
"src": "444:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1304,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "444:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1307,
"name": "token2",
"nodeType": "VariableDeclaration",
"scope": 1321,
"src": "460:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1306,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "460:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1309,
"name": "price",
"nodeType": "VariableDeclaration",
"scope": 1321,
"src": "476:10:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1308,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "476:4:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "443:44:9"
},
"payable": false,
"returnParameters": {
"id": 1311,
"nodeType": "ParameterList",
"parameters": [],
"src": "488:0:9"
},
"scope": 1356,
"src": "414:125:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 1336,
"nodeType": "Block",
"src": "638:50:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 1330,
"name": "mock_tokenPrices",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1275,
"src": "651:16:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$",
"typeString": "mapping(address => mapping(address => uint256))"
}
},
"id": 1332,
"indexExpression": {
"argumentTypes": null,
"id": 1331,
"name": "token1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1323,
"src": "668:6:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "651:24:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 1334,
"indexExpression": {
"argumentTypes": null,
"id": 1333,
"name": "token2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1325,
"src": "676:6:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "651:32:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1329,
"id": 1335,
"nodeType": "Return",
"src": "644:39:9"
}
]
},
"documentation": null,
"id": 1337,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "getPriceForTokenPair",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1326,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1323,
"name": "token1",
"nodeType": "VariableDeclaration",
"scope": 1337,
"src": "573:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1322,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "573:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1325,
"name": "token2",
"nodeType": "VariableDeclaration",
"scope": 1337,
"src": "589:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1324,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "589:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "572:32:9"
},
"payable": false,
"returnParameters": {
"id": 1329,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1328,
"name": "price",
"nodeType": "VariableDeclaration",
"scope": 1337,
"src": "626:10:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1327,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "626:4:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "625:12:9"
},
"scope": 1356,
"src": "543:145:9",
"stateMutability": "view",
"superFunction": 630,
"visibility": "public"
},
{
"body": {
"id": 1354,
"nodeType": "Block",
"src": "776:70:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 1352,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 1346,
"name": "mock_tokenExists",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1269,
"src": "789:16:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
}
},
"id": 1348,
"indexExpression": {
"argumentTypes": null,
"id": 1347,
"name": "token1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1339,
"src": "806:6:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "789:24:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 1349,
"name": "mock_tokenExists",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1269,
"src": "817:16:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
}
},
"id": 1351,
"indexExpression": {
"argumentTypes": null,
"id": 1350,
"name": "token2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1341,
"src": "834:6:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "817:24:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "789:52:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 1345,
"id": 1353,
"nodeType": "Return",
"src": "782:59:9"
}
]
},
"documentation": null,
"id": 1355,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "tokenPairExists",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1342,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1339,
"name": "token1",
"nodeType": "VariableDeclaration",
"scope": 1355,
"src": "717:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1338,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "717:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1341,
"name": "token2",
"nodeType": "VariableDeclaration",
"scope": 1355,
"src": "733:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1340,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "733:7:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visib