UNPKG

@daostack/upgrades

Version:
301 lines (300 loc) 11 kB
{ "fileName": "WithLibrary.sol", "contractName": "WithLibraryMock", "source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\nlibrary MyLibrary {\n function answer() external pure returns(uint256) {\n return 42;\n }\n}\n\ncontract WithLibraryMock {\n function reply() external pure returns(uint256) {\n return MyLibrary.answer();\n }\n}", "sourcePath": "contracts/mocks/WithLibrary.sol", "sourceMap": "152:115:25:-:0;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "152:115:25:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;181:84;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;220:7;242:9;:16;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;235:25;;;;181:84;;:::o", "abi": [ { "inputs": [], "name": "reply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" } ], "ast": { "absolutePath": "contracts/mocks/WithLibrary.sol", "exportedSymbols": { "MyLibrary": [ 5136 ], "WithLibraryMock": [ 5147 ] }, "id": 5148, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 5127, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:25" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 5136, "linearizedBaseContracts": [ 5136 ], "name": "MyLibrary", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 5134, "nodeType": "Block", "src": "128:20:25", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "3432", "id": 5132, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "141:2:25", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_42_by_1", "typeString": "int_const 42" }, "value": "42" }, "functionReturnParameters": 5131, "id": 5133, "nodeType": "Return", "src": "134:9:25" } ] }, "documentation": null, "functionSelector": "85bb7d69", "id": 5135, "implemented": true, "kind": "function", "modifiers": [], "name": "answer", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5128, "nodeType": "ParameterList", "parameters": [], "src": "94:2:25" }, "returnParameters": { "id": 5131, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5130, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5135, "src": "119:7:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5129, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "119:7:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "118:9:25" }, "scope": 5136, "src": "79:69:25", "stateMutability": "pure", "virtual": false, "visibility": "external" } ], "scope": 5148, "src": "57:93:25" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 5147, "linearizedBaseContracts": [ 5147 ], "name": "WithLibraryMock", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 5145, "nodeType": "Block", "src": "229:36:25", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 5141, "name": "MyLibrary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5136, "src": "242:9:25", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_MyLibrary_$5136_$", "typeString": "type(library MyLibrary)" } }, "id": 5142, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "answer", "nodeType": "MemberAccess", "referencedDeclaration": 5135, "src": "242:16:25", "typeDescriptions": { "typeIdentifier": "t_function_delegatecall_pure$__$returns$_t_uint256_$", "typeString": "function () pure returns (uint256)" } }, "id": 5143, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "242:18:25", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 5140, "id": 5144, "nodeType": "Return", "src": "235:25:25" } ] }, "documentation": null, "functionSelector": "6e393975", "id": 5146, "implemented": true, "kind": "function", "modifiers": [], "name": "reply", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5137, "nodeType": "ParameterList", "parameters": [], "src": "195:2:25" }, "returnParameters": { "id": 5140, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5139, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5146, "src": "220:7:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5138, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "220:7:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "219:9:25" }, "scope": 5147, "src": "181:84:25", "stateMutability": "pure", "virtual": false, "visibility": "external" } ], "scope": 5148, "src": "152:115:25" } ], "src": "0:267:25" }, "bytecode": "0x60806040523480156100115760006000fd5b50610017565b61010e806100266000396000f3fe608060405234801560105760006000fd5b5060043610602c5760003560e01c80636e39397514603257602c565b60006000fd5b6038604e565b6040518082815260200191505060405180910390f35b600073__MyLibrary_____________________________6385bb7d696040518163ffffffff1660e01b815260040160206040518083038186803b15801560945760006000fd5b505af415801560a8573d600060003e3d6000fd5b505050506040513d602081101560be5760006000fd5b8101908080519060200190929190505050905060d5565b9056fea2646970667358221220c6ecf2a9d5d32a9ec29e3c14174fc8d76c11ecb859584e1cc08f6102d79ebad064736f6c634300060a0033", "deployedBytecode": "0x608060405234801560105760006000fd5b5060043610602c5760003560e01c80636e39397514603257602c565b60006000fd5b6038604e565b6040518082815260200191505060405180910390f35b600073__MyLibrary_____________________________6385bb7d696040518163ffffffff1660e01b815260040160206040518083038186803b15801560945760006000fd5b505af415801560a8573d600060003e3d6000fd5b505050506040513d602081101560be5760006000fd5b8101908080519060200190929190505050905060d5565b9056fea2646970667358221220c6ecf2a9d5d32a9ec29e3c14174fc8d76c11ecb859584e1cc08f6102d79ebad064736f6c634300060a0033", "compiler": { "name": "solc", "version": "0.6.10+commit.00c0fcaf.Emscripten.clang", "optimizer": {}, "evmVersion": "constantinople" } }