From c2dd1043ef9b8dd9db0eafca96e5e006e856d4c0 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Wed, 21 Nov 2018 14:28:47 +0530 Subject: [PATCH 01/14] Initialize remix solidity resolve repository --- remix-resolve/README.md | 1 + remix-resolve/package.json | 38 ++++++++++++ remix-resolve/src/combineSource.js | 42 +++++++++++++ remix-resolve/src/index.js | 12 ++++ remix-resolve/src/resolve.js | 94 +++++++++++++++++++++++++++++ remix-resolve/src/resolveImports.js | 94 +++++++++++++++++++++++++++++ remix-resolve/tests/test.js | 0 7 files changed, 281 insertions(+) create mode 100644 remix-resolve/README.md create mode 100644 remix-resolve/package.json create mode 100644 remix-resolve/src/combineSource.js create mode 100644 remix-resolve/src/index.js create mode 100644 remix-resolve/src/resolve.js create mode 100644 remix-resolve/src/resolveImports.js create mode 100644 remix-resolve/tests/test.js diff --git a/remix-resolve/README.md b/remix-resolve/README.md new file mode 100644 index 0000000000..50fa6aa353 --- /dev/null +++ b/remix-resolve/README.md @@ -0,0 +1 @@ +## Remix resolve engine diff --git a/remix-resolve/package.json b/remix-resolve/package.json new file mode 100644 index 0000000000..8ef46af502 --- /dev/null +++ b/remix-resolve/package.json @@ -0,0 +1,38 @@ +{ + "name": "remix-resolve", + "version": "0.0.1", + "description": "Solidity import resolver engine", + "main": "./src/index.js", + "bin": { + "remix-tests": "./bin/remix-resolve" + }, + "scripts": { + "lint": "standard", + "test": "standard && mocha tests/ -t 300000" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ethereum/remix-tests.git" + }, + "keywords": [ + "solidity", + "remix", + "resolve", + "import" + ], + "author": "Remix Team", + "license": "MIT", + "standard": { + "ignore": [ + "tests/" + ] + }, + "devDependencies": { + "mocha": "^5.1.0", + "standard": "^12.0.1" + }, + "dependencies": { + "url": "^0.11.0", + "valid-url": "^1.0.9" + } +} diff --git a/remix-resolve/src/combineSource.js b/remix-resolve/src/combineSource.js new file mode 100644 index 0000000000..3565bd8985 --- /dev/null +++ b/remix-resolve/src/combineSource.js @@ -0,0 +1,42 @@ +const url = require('url') +const validUrl = require('valid-url') +const resolve = require('./resolve.js') +/* +combineSource(//basepath, //sources object) +*/ +const combineSource = async function (rootpath, sources) { + let fn, importLine, ir + var matches = [] + ir = /^(?:import){1}(.+){0,1}\s['"](.+)['"];/gm + let match = null + for (const fileName of Object.keys(sources)) { + const source = sources[fileName].content + while ((match = ir.exec(source))) { + matches.push(match) + } + for (let match of matches) { + importLine = match[0] + const extra = match[1] ? match[1] : '' + if (validUrl.isUri(rootpath)) { + fn = url.resolve(rootpath, match[2]) + } else { + fn = match[2] + } + try { + // resolve anything other than remix_tests.sol & tests.sol + if (fn.localeCompare('remix_tests.sol') !== 0 && fn.localeCompare('tests.sol') !== 0) { + let subSorce = {} + const response = await resolve(rootpath, fn) + sources[fileName].content = sources[fileName].content.replace(importLine, 'import' + extra + ' \'' + response.filename + '\';') + subSorce[response.filename] = { content: response.content } + sources = Object.assign(await combineSource(response.rootpath, subSorce), sources) + } + } catch (e) { + throw e + } + } + } + return sources +} + +module.exports = { combineSource } diff --git a/remix-resolve/src/index.js b/remix-resolve/src/index.js new file mode 100644 index 0000000000..eaa3b1d1ed --- /dev/null +++ b/remix-resolve/src/index.js @@ -0,0 +1,12 @@ +/* +const rr = require('remix-resolve') +const fileContent = rr.resolve('https://github.com/ethereum/greeter.sol') +const input = rr.combineSource({ 'greeter.sol': content }) +*/ +const resolve = require('./resolve.js') +const combineSource = require('./combineSource.js') + +module.exports = { + resolve: resolve, + combineSource: combineSource +} diff --git a/remix-resolve/src/resolve.js b/remix-resolve/src/resolve.js new file mode 100644 index 0000000000..d50727534d --- /dev/null +++ b/remix-resolve/src/resolve.js @@ -0,0 +1,94 @@ +const axios = require('axios') +const path = require('path') +const fs = require('fs') + +const handleGithubCall = async function (fullpath, repoPath, path, filename, fileRoot) { + const data = await axios({ + method: 'get', + url: 'https://api.github.com/repos/' + repoPath + '/contents/' + path, + responseType: 'json' + }).then(function (response) { + if ('content' in response.data) { + const buf = Buffer.from(response.data.content, 'base64') + fileRoot = fullpath.substring(0, fullpath.lastIndexOf('/')) + fileRoot = fileRoot + '/' + const resp = { filename, content: buf.toString('UTF-8'), fileRoot } + return resp + } else { + throw Error('Content not received!') + } + }) + return data +} +const handleNodeModulesImport = async function (pathString, filename, fileRoot) { + const o = { encoding: 'UTF-8' } + var modulesDir = fileRoot + + while (true) { + var p = path.join(modulesDir, 'node_modules', pathString, filename) + try { + const content = fs.readFileSync(p, o) + fileRoot = path.join(modulesDir, 'node_modules', pathString) + const response = { filename, content, fileRoot } + return response + } catch (err) { + console.log(err) + } + + // Recurse outwards until impossible + var oldModulesDir = modulesDir + modulesDir = path.join(modulesDir, '..') + if (modulesDir === oldModulesDir) { + break + } + } +} +const handleLocalImport = async function (pathString, filename, fileRoot) { + // if no relative/absolute path given then search in node_modules folder + if (pathString && pathString.indexOf('.') !== 0 && pathString.indexOf('/') !== 0) { + return handleNodeModulesImport(pathString, filename, fileRoot) + } else { + const o = { encoding: 'UTF-8' } + const p = pathString ? path.resolve(fileRoot, pathString, filename) : path.resolve(fileRoot, filename) + const content = fs.readFileSync(p, o) + fileRoot = pathString ? path.resolve(fileRoot, pathString) : fileRoot + const response = { filename, content, fileRoot } + return response + } +} +const getHandlers = async function () { + return [ + { + type: 'local', + match: /(^(?!(?:http:\/\/)|(?:https:\/\/)?(?:www.)?(?:github.com)))(^\/*[\w+-_/]*\/)*?(\w+\.sol)/g, + handle: async (match, fileRoot) => { const data = await handleLocalImport(match[2], match[3], fileRoot); return data } + }, + { + type: 'github', + match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)(.*\/(\w+\.sol))/g, + handle: async (match, fileRoot) => { + const data = await handleGithubCall(match[0], match[3], match[4], match[5], fileRoot) + return data + } + } + ] +} +const resolve = async function (fileRoot, sourcePath) { + const handlers = await getHandlers() + let response = {} + for (const handler of handlers) { + try { + // here we are trying to find type of import path github/swarm/ipfs/local + const match = handler.match.exec(sourcePath) + if (match) { + response = await handler.handle(match, fileRoot) + break + } + } catch (e) { + throw e + } + } + return response +} + +module.exports = { resolve } diff --git a/remix-resolve/src/resolveImports.js b/remix-resolve/src/resolveImports.js new file mode 100644 index 0000000000..229e3a25e7 --- /dev/null +++ b/remix-resolve/src/resolveImports.js @@ -0,0 +1,94 @@ +const axios = require('axios') +const path = require('path') +const fs = require('fs') + +const handleGithubCall = async function (fullpath, repoPath, path, filename, fileRoot) { + const data = await axios({ + method: 'get', + url: 'https://api.github.com/repos/' + repoPath + '/contents/' + path, + responseType: 'json' + }).then(function (response) { + if ('content' in response.data) { + const buf = Buffer.from(response.data.content, 'base64') + fileRoot = fullpath.substring(0, fullpath.lastIndexOf('/')) + fileRoot = fileRoot + '/' + const resp = { filename, content: buf.toString('UTF-8'), fileRoot } + return resp + } else { + throw Error('Content not received!') + } + }) + return data +} +const handleNodeModulesImport = async function (pathString, filename, fileRoot) { + const o = { encoding: 'UTF-8' } + var modulesDir = fileRoot + + while (true) { + var p = path.join(modulesDir, 'node_modules', pathString, filename) + try { + const content = fs.readFileSync(p, o) + fileRoot = path.join(modulesDir, 'node_modules', pathString) + const response = { filename, content, fileRoot } + return response + } catch (err) { + console.log(err) + } + + // Recurse outwards until impossible + var oldModulesDir = modulesDir + modulesDir = path.join(modulesDir, '..') + if (modulesDir === oldModulesDir) { + break + } + } +} +const handleLocalImport = async function (pathString, filename, fileRoot) { + // if no relative/absolute path given then search in node_modules folder + if (pathString && pathString.indexOf('.') !== 0 && pathString.indexOf('/') !== 0) { + return handleNodeModulesImport(pathString, filename, fileRoot) + } else { + const o = { encoding: 'UTF-8' } + const p = pathString ? path.resolve(fileRoot, pathString, filename) : path.resolve(fileRoot, filename) + const content = fs.readFileSync(p, o) + fileRoot = pathString ? path.resolve(fileRoot, pathString) : fileRoot + const response = { filename, content, fileRoot } + return response + } +} +const getHandlers = async function () { + return [ + { + type: 'local', + match: /(^(?!(?:http:\/\/)|(?:https:\/\/)?(?:www.)?(?:github.com)))(^\/*[\w+-_/]*\/)*?(\w+\.sol)/g, + handle: async (match, fileRoot) => { const data = await handleLocalImport(match[2], match[3], fileRoot); return data } + }, + { + type: 'github', + match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)(.*\/(\w+\.sol))/g, + handle: async (match, fileRoot) => { + const data = await handleGithubCall(match[0], match[3], match[4], match[5], fileRoot) + return data + } + } + ] +} +const resolveImports = async function (fileRoot, sourcePath) { + const handlers = await getHandlers() + let response = {} + for (const handler of handlers) { + try { + // here we are trying to find type of import path github/swarm/ipfs/local + const match = handler.match.exec(sourcePath) + if (match) { + response = await handler.handle(match, fileRoot) + break + } + } catch (e) { + throw e + } + } + return response +} + +module.exports = { resolveImports } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js new file mode 100644 index 0000000000..e69de29bb2 From 5b053113ca4fb458b3541aa24a607fdad03aefbb Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Wed, 21 Nov 2018 17:29:57 +0530 Subject: [PATCH 02/14] tests for remix-resolve --- remix-resolve/package.json | 9 +-- remix-resolve/src/combineSource.js | 2 +- remix-resolve/src/resolve.js | 2 +- remix-resolve/src/resolveImports.js | 94 ----------------------------- remix-resolve/tests/test.js | 37 ++++++++++++ 5 files changed, 44 insertions(+), 100 deletions(-) delete mode 100644 remix-resolve/src/resolveImports.js diff --git a/remix-resolve/package.json b/remix-resolve/package.json index 8ef46af502..4e65982b4e 100644 --- a/remix-resolve/package.json +++ b/remix-resolve/package.json @@ -27,12 +27,13 @@ "tests/" ] }, + "dependencies": { + "axios": "^0.18.0", + "url": "^0.11.0", + "valid-url": "^1.0.9" + }, "devDependencies": { "mocha": "^5.1.0", "standard": "^12.0.1" }, - "dependencies": { - "url": "^0.11.0", - "valid-url": "^1.0.9" - } } diff --git a/remix-resolve/src/combineSource.js b/remix-resolve/src/combineSource.js index 3565bd8985..68f1947082 100644 --- a/remix-resolve/src/combineSource.js +++ b/remix-resolve/src/combineSource.js @@ -39,4 +39,4 @@ const combineSource = async function (rootpath, sources) { return sources } -module.exports = { combineSource } +module.exports = combineSource diff --git a/remix-resolve/src/resolve.js b/remix-resolve/src/resolve.js index d50727534d..0584aebba6 100644 --- a/remix-resolve/src/resolve.js +++ b/remix-resolve/src/resolve.js @@ -91,4 +91,4 @@ const resolve = async function (fileRoot, sourcePath) { return response } -module.exports = { resolve } +module.exports = resolve diff --git a/remix-resolve/src/resolveImports.js b/remix-resolve/src/resolveImports.js deleted file mode 100644 index 229e3a25e7..0000000000 --- a/remix-resolve/src/resolveImports.js +++ /dev/null @@ -1,94 +0,0 @@ -const axios = require('axios') -const path = require('path') -const fs = require('fs') - -const handleGithubCall = async function (fullpath, repoPath, path, filename, fileRoot) { - const data = await axios({ - method: 'get', - url: 'https://api.github.com/repos/' + repoPath + '/contents/' + path, - responseType: 'json' - }).then(function (response) { - if ('content' in response.data) { - const buf = Buffer.from(response.data.content, 'base64') - fileRoot = fullpath.substring(0, fullpath.lastIndexOf('/')) - fileRoot = fileRoot + '/' - const resp = { filename, content: buf.toString('UTF-8'), fileRoot } - return resp - } else { - throw Error('Content not received!') - } - }) - return data -} -const handleNodeModulesImport = async function (pathString, filename, fileRoot) { - const o = { encoding: 'UTF-8' } - var modulesDir = fileRoot - - while (true) { - var p = path.join(modulesDir, 'node_modules', pathString, filename) - try { - const content = fs.readFileSync(p, o) - fileRoot = path.join(modulesDir, 'node_modules', pathString) - const response = { filename, content, fileRoot } - return response - } catch (err) { - console.log(err) - } - - // Recurse outwards until impossible - var oldModulesDir = modulesDir - modulesDir = path.join(modulesDir, '..') - if (modulesDir === oldModulesDir) { - break - } - } -} -const handleLocalImport = async function (pathString, filename, fileRoot) { - // if no relative/absolute path given then search in node_modules folder - if (pathString && pathString.indexOf('.') !== 0 && pathString.indexOf('/') !== 0) { - return handleNodeModulesImport(pathString, filename, fileRoot) - } else { - const o = { encoding: 'UTF-8' } - const p = pathString ? path.resolve(fileRoot, pathString, filename) : path.resolve(fileRoot, filename) - const content = fs.readFileSync(p, o) - fileRoot = pathString ? path.resolve(fileRoot, pathString) : fileRoot - const response = { filename, content, fileRoot } - return response - } -} -const getHandlers = async function () { - return [ - { - type: 'local', - match: /(^(?!(?:http:\/\/)|(?:https:\/\/)?(?:www.)?(?:github.com)))(^\/*[\w+-_/]*\/)*?(\w+\.sol)/g, - handle: async (match, fileRoot) => { const data = await handleLocalImport(match[2], match[3], fileRoot); return data } - }, - { - type: 'github', - match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)(.*\/(\w+\.sol))/g, - handle: async (match, fileRoot) => { - const data = await handleGithubCall(match[0], match[3], match[4], match[5], fileRoot) - return data - } - } - ] -} -const resolveImports = async function (fileRoot, sourcePath) { - const handlers = await getHandlers() - let response = {} - for (const handler of handlers) { - try { - // here we are trying to find type of import path github/swarm/ipfs/local - const match = handler.match.exec(sourcePath) - if (match) { - response = await handler.handle(match, fileRoot) - break - } - } catch (e) { - throw e - } - } - return response -} - -module.exports = { resolveImports } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index e69de29bb2..3d15fa829c 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -0,0 +1,37 @@ +const rr = require('../src/index.js') +const assert = require('assert') +const fs = require('fs') + +describe('testRunner', function () { + describe('#combineSource', function() { + describe('test with beforeAll', function () { + let filename = 'tests/examples_1/greeter.sol' + let tests = [], results = {} + + before(function (done) { + const content = fs.readFileSync('../remix-resolve/tests/example_1/greeter.sol') + var sources = [] + sources['greeter.sol'] = content + rr.combineSource('/home/0mkar/Karma/remix/remix-resolve/tests/example_1/greeter.sol', sources) + }) + + it('should 1 passing test', function () { + assert.equal(results.passingNum, 2) + }) + + it('should 1 failing test', function () { + assert.equal(results.failureNum, 2) + }) + + it('should returns 5 messages', function () { + assert.deepEqual(tests, [ + { type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' }, + { type: 'testFailure', value: 'Should trigger one fail', time: 1, context: 'MyTest', errMsg: 'the test 1 fails' }, + { type: 'testPass', value: 'Should trigger one pass', time: 1, context: 'MyTest'}, + { type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' }, + { type: 'testFailure', value: 'Initial value should be200', time: 1, context: 'MyTest', errMsg: 'function returned false' } + ]) + }) + }) + }) +}) From 19a0d34db355d8518912eb83960ed77a542df00f Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Wed, 21 Nov 2018 17:48:36 +0530 Subject: [PATCH 03/14] add tests --- remix-resolve/tests/example_1/greeter.sol | 17 +++++++++++++++++ remix-resolve/tests/example_1/mortal.sol | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 remix-resolve/tests/example_1/greeter.sol create mode 100644 remix-resolve/tests/example_1/mortal.sol diff --git a/remix-resolve/tests/example_1/greeter.sol b/remix-resolve/tests/example_1/greeter.sol new file mode 100644 index 0000000000..8425568af9 --- /dev/null +++ b/remix-resolve/tests/example_1/greeter.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.5.0; +import "./mortal.sol"; + +contract Greeter is Mortal { + /* Define variable greeting of the type string */ + string greeting; + + /* This runs when the contract is executed */ + constructor(string memory _greeting) public { + greeting = _greeting; + } + + /* Main function */ + function greet() public view returns (string memory) { + return greeting; + } +} diff --git a/remix-resolve/tests/example_1/mortal.sol b/remix-resolve/tests/example_1/mortal.sol new file mode 100644 index 0000000000..e1a1fa4de8 --- /dev/null +++ b/remix-resolve/tests/example_1/mortal.sol @@ -0,0 +1,12 @@ +pragma solidity ^0.5.0; + +contract Mortal { + /* Define variable owner of the type address */ + address payable owner; + + /* This function is executed at initialization and sets the owner of the contract */ + function mortal() public { owner = msg.sender; } + + /* Function to recover the funds on the contract */ + function kill() public { if (msg.sender == owner) selfdestruct(owner); } +} From 27ed38fdf3e24c809eb6800ebdeabfe5dfc04569 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Sun, 25 Nov 2018 11:23:44 +0530 Subject: [PATCH 04/14] pass tests, add I/O spec --- remix-resolve/README.md | 13 +++++++++++++ remix-resolve/package.json | 2 +- remix-resolve/tests/test.js | 28 +++++++++++++--------------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/remix-resolve/README.md b/remix-resolve/README.md index 50fa6aa353..3fadaf5d72 100644 --- a/remix-resolve/README.md +++ b/remix-resolve/README.md @@ -1 +1,14 @@ ## Remix resolve engine + +**Input** +```json +[ 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport "./mortal.sol";\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' } ] +``` + +**Output** +```json +{ + 'mortal.sol': { content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, + 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' } +} +``` diff --git a/remix-resolve/package.json b/remix-resolve/package.json index 4e65982b4e..5c12ce63c6 100644 --- a/remix-resolve/package.json +++ b/remix-resolve/package.json @@ -35,5 +35,5 @@ "devDependencies": { "mocha": "^5.1.0", "standard": "^12.0.1" - }, + } } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 3d15fa829c..25c8990dbd 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -9,28 +9,26 @@ describe('testRunner', function () { let tests = [], results = {} before(function (done) { - const content = fs.readFileSync('../remix-resolve/tests/example_1/greeter.sol') + const content = fs.readFileSync('../remix-resolve/tests/example_1/greeter.sol').toString() var sources = [] - sources['greeter.sol'] = content - rr.combineSource('/home/0mkar/Karma/remix/remix-resolve/tests/example_1/greeter.sol', sources) + sources['greeter.sol'] = { 'content': content } + rr.combineSource('/home/0mkar/Karma/remix/remix-resolve/tests/example_1/', sources) + .then(sources => { + results = sources + done() + }) + .catch(e => { + throw e + }) }) it('should 1 passing test', function () { - assert.equal(results.passingNum, 2) - }) - - it('should 1 failing test', function () { - assert.equal(results.failureNum, 2) + assert.equal(Object.keys(results).length, 2) }) it('should returns 5 messages', function () { - assert.deepEqual(tests, [ - { type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' }, - { type: 'testFailure', value: 'Should trigger one fail', time: 1, context: 'MyTest', errMsg: 'the test 1 fails' }, - { type: 'testPass', value: 'Should trigger one pass', time: 1, context: 'MyTest'}, - { type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' }, - { type: 'testFailure', value: 'Initial value should be200', time: 1, context: 'MyTest', errMsg: 'function returned false' } - ]) + assert.deepEqual(results, { 'mortal.sol':{ content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, + 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' }}) }) }) }) From 94a1edf22bfe8f613671e70cfb054c046238482d Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Sun, 25 Nov 2018 20:57:57 +0530 Subject: [PATCH 05/14] update path of test contracts --- remix-resolve/tests/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 25c8990dbd..0291d7a7b0 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -12,7 +12,7 @@ describe('testRunner', function () { const content = fs.readFileSync('../remix-resolve/tests/example_1/greeter.sol').toString() var sources = [] sources['greeter.sol'] = { 'content': content } - rr.combineSource('/home/0mkar/Karma/remix/remix-resolve/tests/example_1/', sources) + rr.combineSource('../remix-resolve/tests/example_1/', sources) .then(sources => { results = sources done() @@ -26,7 +26,7 @@ describe('testRunner', function () { assert.equal(Object.keys(results).length, 2) }) - it('should returns 5 messages', function () { + it('should returns 2 contracts with content', function () { assert.deepEqual(results, { 'mortal.sol':{ content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' }}) }) From 45cd8f5d4469d20a06bd6ec5a9021e07b0a55463 Mon Sep 17 00:00:00 2001 From: Omkara <0mkar@protonmail.com> Date: Mon, 26 Nov 2018 10:36:11 +0530 Subject: [PATCH 06/14] add github import tests. ## First commit from Etheratom office ## --- .../tests/example_2/github_import.sol | 6 ++++ remix-resolve/tests/test.js | 36 ++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 remix-resolve/tests/example_2/github_import.sol diff --git a/remix-resolve/tests/example_2/github_import.sol b/remix-resolve/tests/example_2/github_import.sol new file mode 100644 index 0000000000..a4c65bc169 --- /dev/null +++ b/remix-resolve/tests/example_2/github_import.sol @@ -0,0 +1,6 @@ +pragma solidity ^0.5.0; +import 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol'; + +contract SimpleMath { + using SafeMath for uint; +} diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 0291d7a7b0..7197213b1c 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -4,12 +4,12 @@ const fs = require('fs') describe('testRunner', function () { describe('#combineSource', function() { - describe('test with beforeAll', function () { - let filename = 'tests/examples_1/greeter.sol' + describe('test example_1 [local imports]]', function () { + let filename = '../remix-resolve/tests/example_1/greeter.sol' let tests = [], results = {} before(function (done) { - const content = fs.readFileSync('../remix-resolve/tests/example_1/greeter.sol').toString() + const content = fs.readFileSync(filename).toString() var sources = [] sources['greeter.sol'] = { 'content': content } rr.combineSource('../remix-resolve/tests/example_1/', sources) @@ -26,10 +26,38 @@ describe('testRunner', function () { assert.equal(Object.keys(results).length, 2) }) - it('should returns 2 contracts with content', function () { + it('should returns 2 contracts with specified content', function () { assert.deepEqual(results, { 'mortal.sol':{ content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' }}) }) }) + + describe('test example_2 [github imports]', function () { + let filename = '../remix-resolve/tests/example_2/github_import.sol' + let tests = [], results = {} + + before(function (done) { + const content = fs.readFileSync(filename).toString() + var sources = [] + sources['greeter.sol'] = { 'content': content } + rr.combineSource('../remix-resolve/tests/example_2/', sources) + .then(sources => { + results = sources + done() + }) + .catch(e => { + throw e + }) + }) + + it('should 1 passing test', function () { + assert.equal(Object.keys(results).length, 2) + }) + + it('should returns 2 contracts with specified content', function () { + assert.deepEqual(results, { 'SafeMath.sol': { content: 'pragma solidity ^0.4.24;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Gas optimization: this is cheaper than requiring \'a\' not being zero, but the\n \/\/ benefit is lost if \'b\' is also tested.\n \/\/ See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n \/\/ assert(a == b * c + a % b); \/\/ There is no case in which this doesn\'t hold\n\n return c;\n }\n\n \/**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n *\/\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n \/**\n * @dev Divides two numbers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n *\/\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n' }, + 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' }}) + }) + }) }) }) From 22471bf25d2db9c70957275ac4569d08f683c9b3 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Mon, 26 Nov 2018 22:27:15 +0530 Subject: [PATCH 07/14] Add test for successful compilation test --- remix-resolve/package.json | 5 +++-- remix-resolve/tests/test.js | 41 +++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/remix-resolve/package.json b/remix-resolve/package.json index 5c12ce63c6..9f79b4e506 100644 --- a/remix-resolve/package.json +++ b/remix-resolve/package.json @@ -4,7 +4,7 @@ "description": "Solidity import resolver engine", "main": "./src/index.js", "bin": { - "remix-tests": "./bin/remix-resolve" + "remix-resolve": "./bin/remix-resolve" }, "scripts": { "lint": "standard", @@ -12,7 +12,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/ethereum/remix-tests.git" + "url": "git+https://github.com/ethereum/remix.git" }, "keywords": [ "solidity", @@ -29,6 +29,7 @@ }, "dependencies": { "axios": "^0.18.0", + "solc": "^0.5.0", "url": "^0.11.0", "valid-url": "^1.0.9" }, diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 7197213b1c..1ad974db12 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -1,6 +1,7 @@ const rr = require('../src/index.js') const assert = require('assert') const fs = require('fs') +const solc = require('solc') describe('testRunner', function () { describe('#combineSource', function() { @@ -39,7 +40,7 @@ describe('testRunner', function () { before(function (done) { const content = fs.readFileSync(filename).toString() var sources = [] - sources['greeter.sol'] = { 'content': content } + sources['github_import.sol'] = { 'content': content } rr.combineSource('../remix-resolve/tests/example_2/', sources) .then(sources => { results = sources @@ -56,8 +57,44 @@ describe('testRunner', function () { it('should returns 2 contracts with specified content', function () { assert.deepEqual(results, { 'SafeMath.sol': { content: 'pragma solidity ^0.4.24;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Gas optimization: this is cheaper than requiring \'a\' not being zero, but the\n \/\/ benefit is lost if \'b\' is also tested.\n \/\/ See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n \/\/ assert(a == b * c + a % b); \/\/ There is no case in which this doesn\'t hold\n\n return c;\n }\n\n \/**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n *\/\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n \/**\n * @dev Divides two numbers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n *\/\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n' }, - 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' }}) + 'github_import.sol': { content: 'pragma solidity ^0.5.0;\nimport \'SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' }}) }) }) }) + + // Test successful compile after combineSource + describe('test example_1 for successful compile', function() { + let filename = '../remix-resolve/tests/example_1/greeter.sol' + let tests = [], results = {} + + before(function (done) { + const content = fs.readFileSync(filename).toString() + var sources = [] + sources['greeter.sol'] = { 'content': content } + rr.combineSource('../remix-resolve/tests/example_1/', sources) + .then(sources => { + const outputSelection = { + // Enable the metadata and bytecode outputs of every single contract. + '*': { + '': ['legacyAST'], + '*': ['abi', 'evm.bytecode.object', 'devdoc', 'userdoc', 'evm.gasEstimates'] + } + } + const settings = { + optimizer: { enabled: true, runs: 500 }, + evmVersion: 'byzantium', + outputSelection + } + const input = { language: 'Solidity', sources, settings } + results = solc.compileStandardWrapper(JSON.stringify(input)) + done() + }) + .catch(e => { + throw e + }) + }) + it('should match compiled json', function () { + assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820302b121207c089c266b6ff1a5d282ee6cdcc92dbecd4beca1f3c49332bc2de640029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 ADDRESS 0x2b SLT SLT SMOD 0xc0 DUP10 0xc2 PUSH7 0xB6FF1A5D282EE6 0xcd 0xcc SWAP3 0xdb 0xec 0xd4 0xbe 0xca 0x1f EXTCODECOPY 0x49 CALLER 0x2b 0xc2 0xde PUSH5 0x29000000 ","sourceMap":"46:357:0:-;;;205:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;205:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;259:20:0;;205:81;;-1:-1:-1;259:20:0;;-1:-1:-1;259:8:0;;-1:-1:-1;259:20:0;;;;;:::i;:::-;;205:81;46:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;46:357:0;;;-1:-1:-1;46:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:20:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"66:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"66:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"133:6:0"}],"id":6,"name":"VariableDeclaration","src":"133:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"217:6:0"}],"id":8,"name":"VariableDeclaration","src":"217:23:0"}],"id":9,"name":"ParameterList","src":"216:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"249:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"259:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"270:9:0"}],"id":13,"name":"Assignment","src":"259:20:0"}],"id":14,"name":"ExpressionStatement","src":"259:20:0"}],"id":15,"name":"Block","src":"249:37:0"}],"id":16,"name":"FunctionDefinition","src":"205:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"330:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"354:6:0"}],"id":19,"name":"VariableDeclaration","src":"354:13:0"}],"id":20,"name":"ParameterList","src":"353:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"386:8:0"}],"id":22,"name":"Return","src":"379:15:0"}],"id":23,"name":"Block","src":"369:32:0"}],"id":24,"name":"FunctionDefinition","src":"316:85:0"}],"id":25,"name":"ContractDefinition","src":"46:357:0"}],"id":26,"name":"SourceUnit","src":"0:404:0"}},"mortal.sol":{"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) + }) + }) }) From bbe972ee05e24ad99c3f0e03c91ab21cd84a4c4a Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Tue, 27 Nov 2018 17:33:19 +0530 Subject: [PATCH 08/14] Check compilation with ast --- remix-resolve/tests/test.js | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 1ad974db12..0df121fc37 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -69,9 +69,31 @@ describe('testRunner', function () { before(function (done) { const content = fs.readFileSync(filename).toString() - var sources = [] - sources['greeter.sol'] = { 'content': content } - rr.combineSource('../remix-resolve/tests/example_1/', sources) + // var sources = [] + const missingInputsCallback = function (path) { + console.log(path) + } + // sources['greeter.sol'] = { 'content': content } + const sources = { + 'mortal.sol':{ content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, + 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' } + } + const outputSelection = { + // Enable the metadata and bytecode outputs of every single contract. + '*': { + '': ['ast', 'legacyAST'], + '*': ['abi', 'evm.bytecode.object', 'devdoc', 'userdoc', 'evm.gasEstimates'] + } + } + const settings = { + optimizer: { enabled: true, runs: 500 }, + evmVersion: 'byzantium', + outputSelection + } + const input = { language: 'Solidity', sources, settings } + results = solc.compile(JSON.stringify(input), missingInputsCallback) + done() + /* rr.combineSource('../remix-resolve/tests/example_1/', sources) .then(sources => { const outputSelection = { // Enable the metadata and bytecode outputs of every single contract. @@ -86,15 +108,15 @@ describe('testRunner', function () { outputSelection } const input = { language: 'Solidity', sources, settings } - results = solc.compileStandardWrapper(JSON.stringify(input)) + results = solc.lowlevel.compileStandard(JSON.stringify(input), handleImport) done() }) .catch(e => { throw e - }) + }) */ }) it('should match compiled json', function () { - assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820302b121207c089c266b6ff1a5d282ee6cdcc92dbecd4beca1f3c49332bc2de640029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 ADDRESS 0x2b SLT SLT SMOD 0xc0 DUP10 0xc2 PUSH7 0xB6FF1A5D282EE6 0xcd 0xcc SWAP3 0xdb 0xec 0xd4 0xbe 0xca 0x1f EXTCODECOPY 0x49 CALLER 0x2b 0xc2 0xde PUSH5 0x29000000 ","sourceMap":"46:357:0:-;;;205:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;205:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;259:20:0;;205:81;;-1:-1:-1;259:20:0;;-1:-1:-1;259:8:0;;-1:-1:-1;259:20:0;;;;;:::i;:::-;;205:81;46:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;46:357:0;;;-1:-1:-1;46:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:20:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"66:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"66:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"133:6:0"}],"id":6,"name":"VariableDeclaration","src":"133:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"217:6:0"}],"id":8,"name":"VariableDeclaration","src":"217:23:0"}],"id":9,"name":"ParameterList","src":"216:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"249:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"259:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"270:9:0"}],"id":13,"name":"Assignment","src":"259:20:0"}],"id":14,"name":"ExpressionStatement","src":"259:20:0"}],"id":15,"name":"Block","src":"249:37:0"}],"id":16,"name":"FunctionDefinition","src":"205:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"330:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"354:6:0"}],"id":19,"name":"VariableDeclaration","src":"354:13:0"}],"id":20,"name":"ParameterList","src":"353:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"386:8:0"}],"id":22,"name":"Return","src":"379:15:0"}],"id":23,"name":"Block","src":"369:32:0"}],"id":24,"name":"FunctionDefinition","src":"316:85:0"}],"id":25,"name":"ContractDefinition","src":"46:357:0"}],"id":26,"name":"SourceUnit","src":"0:404:0"}},"mortal.sol":{"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) + assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820302b121207c089c266b6ff1a5d282ee6cdcc92dbecd4beca1f3c49332bc2de640029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 ADDRESS 0x2b SLT SLT SMOD 0xc0 DUP10 0xc2 PUSH7 0xB6FF1A5D282EE6 0xcd 0xcc SWAP3 0xdb 0xec 0xd4 0xbe 0xca 0x1f EXTCODECOPY 0x49 CALLER 0x2b 0xc2 0xde PUSH5 0x29000000 ","sourceMap":"46:357:0:-;;;205:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;205:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;259:20:0;;205:81;;-1:-1:-1;259:20:0;;-1:-1:-1;259:8:0;;-1:-1:-1;259:20:0;;;;;:::i;:::-;;205:81;46:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;46:357:0;;;-1:-1:-1;46:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"ast":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]},"id":26,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"0:23:0"},{"absolutePath":"mortal.sol","file":"mortal.sol","id":2,"nodeType":"ImportDirective","scope":26,"sourceUnit":53,"src":"24:20:0","symbolAliases":[],"unitAlias":""},{"baseContracts":[{"arguments":null,"baseName":{"contractScope":null,"id":3,"name":"Mortal","nodeType":"UserDefinedTypeName","referencedDeclaration":52,"src":"66:6:0","typeDescriptions":{"typeIdentifier":"t_contract$_Mortal_$52","typeString":"contract Mortal"}},"id":4,"nodeType":"InheritanceSpecifier","src":"66:6:0"}],"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":25,"linearizedBaseContracts":[25,52],"name":"Greeter","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":6,"name":"greeting","nodeType":"VariableDeclaration","scope":25,"src":"133:15:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":5,"name":"string","nodeType":"ElementaryTypeName","src":"133:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"},{"body":{"id":15,"nodeType":"Block","src":"249:37:0","statements":[{"expression":{"argumentTypes":null,"id":13,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":11,"name":"greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":6,"src":"259:8:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"id":12,"name":"_greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":8,"src":"270:9:0","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},"src":"259:20:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":14,"nodeType":"ExpressionStatement","src":"259:20:0"}]},"documentation":null,"id":16,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":9,"nodeType":"ParameterList","parameters":[{"constant":false,"id":8,"name":"_greeting","nodeType":"VariableDeclaration","scope":16,"src":"217:23:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":7,"name":"string","nodeType":"ElementaryTypeName","src":"217:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"}],"src":"216:25:0"},"returnParameters":{"id":10,"nodeType":"ParameterList","parameters":[],"src":"249:0:0"},"scope":25,"src":"205:81:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":23,"nodeType":"Block","src":"369:32:0","statements":[{"expression":{"argumentTypes":null,"id":21,"name":"greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":6,"src":"386:8:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"functionReturnParameters":20,"id":22,"nodeType":"Return","src":"379:15:0"}]},"documentation":null,"id":24,"implemented":true,"kind":"function","modifiers":[],"name":"greet","nodeType":"FunctionDefinition","parameters":{"id":17,"nodeType":"ParameterList","parameters":[],"src":"330:2:0"},"returnParameters":{"id":20,"nodeType":"ParameterList","parameters":[{"constant":false,"id":19,"name":"","nodeType":"VariableDeclaration","scope":24,"src":"354:13:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":18,"name":"string","nodeType":"ElementaryTypeName","src":"354:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"}],"src":"353:15:0"},"scope":25,"src":"316:85:0","stateMutability":"view","superFunction":null,"visibility":"public"}],"scope":26,"src":"46:357:0"}],"src":"0:404:0"},"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:20:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"66:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"66:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"133:6:0"}],"id":6,"name":"VariableDeclaration","src":"133:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"217:6:0"}],"id":8,"name":"VariableDeclaration","src":"217:23:0"}],"id":9,"name":"ParameterList","src":"216:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"249:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"259:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"270:9:0"}],"id":13,"name":"Assignment","src":"259:20:0"}],"id":14,"name":"ExpressionStatement","src":"259:20:0"}],"id":15,"name":"Block","src":"249:37:0"}],"id":16,"name":"FunctionDefinition","src":"205:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"330:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"354:6:0"}],"id":19,"name":"VariableDeclaration","src":"354:13:0"}],"id":20,"name":"ParameterList","src":"353:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"386:8:0"}],"id":22,"name":"Return","src":"379:15:0"}],"id":23,"name":"Block","src":"369:32:0"}],"id":24,"name":"FunctionDefinition","src":"316:85:0"}],"id":25,"name":"ContractDefinition","src":"46:357:0"}],"id":26,"name":"SourceUnit","src":"0:404:0"}},"mortal.sol":{"ast":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]},"id":53,"nodeType":"SourceUnit","nodes":[{"id":27,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"0:23:1"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":52,"linearizedBaseContracts":[52],"name":"Mortal","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":29,"name":"owner","nodeType":"VariableDeclaration","scope":52,"src":"99:21:1","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":28,"name":"address","nodeType":"ElementaryTypeName","src":"99:15:1","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"body":{"id":37,"nodeType":"Block","src":"241:23:1","statements":[{"expression":{"argumentTypes":null,"id":35,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":32,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"243:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":33,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":67,"src":"251:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":34,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"251:10:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"243:18:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":36,"nodeType":"ExpressionStatement","src":"243:18:1"}]},"documentation":null,"id":38,"implemented":true,"kind":"function","modifiers":[],"name":"mortal","nodeType":"FunctionDefinition","parameters":{"id":30,"nodeType":"ParameterList","parameters":[],"src":"231:2:1"},"returnParameters":{"id":31,"nodeType":"ParameterList","parameters":[],"src":"241:0:1"},"scope":52,"src":"216:48:1","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":50,"nodeType":"Block","src":"349:49:1","statements":[{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":41,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":67,"src":"355:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"355:10:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":43,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"369:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"355:19:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":49,"nodeType":"IfStatement","src":"351:44:1","trueBody":{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":46,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"389:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":45,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":75,"src":"376:12:1","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":47,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"376:19:1","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":48,"nodeType":"ExpressionStatement","src":"376:19:1"}}]},"documentation":null,"id":51,"implemented":true,"kind":"function","modifiers":[],"name":"kill","nodeType":"FunctionDefinition","parameters":{"id":39,"nodeType":"ParameterList","parameters":[],"src":"339:2:1"},"returnParameters":{"id":40,"nodeType":"ParameterList","parameters":[],"src":"349:0:1"},"scope":52,"src":"326:72:1","stateMutability":"nonpayable","superFunction":null,"visibility":"public"}],"scope":53,"src":"25:375:1"}],"src":"0:401:1"},"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) }) }) }) From fa3a2510bea076f4c3ab10a1311e93e9405bc62b Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Wed, 28 Nov 2018 10:27:38 +0530 Subject: [PATCH 09/14] Add tests, research findImportsSync --- remix-resolve/package.json | 4 ++ remix-resolve/src/resolve.js | 2 + remix-resolve/tests/test.js | 76 +++++++++++++++++++++++------------- 3 files changed, 54 insertions(+), 28 deletions(-) diff --git a/remix-resolve/package.json b/remix-resolve/package.json index 9f79b4e506..5233099c34 100644 --- a/remix-resolve/package.json +++ b/remix-resolve/package.json @@ -28,7 +28,11 @@ ] }, "dependencies": { + "async": "^2.6.1", "axios": "^0.18.0", + "promise": "^8.0.2", + "remix-solidity": "^0.2.14", + "sleep": "^5.2.3", "solc": "^0.5.0", "url": "^0.11.0", "valid-url": "^1.0.9" diff --git a/remix-resolve/src/resolve.js b/remix-resolve/src/resolve.js index 0584aebba6..ba6860f3be 100644 --- a/remix-resolve/src/resolve.js +++ b/remix-resolve/src/resolve.js @@ -17,6 +17,8 @@ const handleGithubCall = async function (fullpath, repoPath, path, filename, fil } else { throw Error('Content not received!') } + }).catch(function (e) { + throw e }) return data } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 0df121fc37..05e337d69a 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -2,6 +2,10 @@ const rr = require('../src/index.js') const assert = require('assert') const fs = require('fs') const solc = require('solc') +const Compiler = require('remix-solidity').Compiler +const async = require('async') +const Promise = require('promise') +const sleep = require('sleep') describe('testRunner', function () { describe('#combineSource', function() { @@ -69,31 +73,9 @@ describe('testRunner', function () { before(function (done) { const content = fs.readFileSync(filename).toString() - // var sources = [] - const missingInputsCallback = function (path) { - console.log(path) - } - // sources['greeter.sol'] = { 'content': content } - const sources = { - 'mortal.sol':{ content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, - 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' } - } - const outputSelection = { - // Enable the metadata and bytecode outputs of every single contract. - '*': { - '': ['ast', 'legacyAST'], - '*': ['abi', 'evm.bytecode.object', 'devdoc', 'userdoc', 'evm.gasEstimates'] - } - } - const settings = { - optimizer: { enabled: true, runs: 500 }, - evmVersion: 'byzantium', - outputSelection - } - const input = { language: 'Solidity', sources, settings } - results = solc.compile(JSON.stringify(input), missingInputsCallback) - done() - /* rr.combineSource('../remix-resolve/tests/example_1/', sources) + let sources = [] + sources['greeter.sol'] = { 'content': content } + rr.combineSource('../remix-resolve/tests/example_1/', sources) .then(sources => { const outputSelection = { // Enable the metadata and bytecode outputs of every single contract. @@ -108,15 +90,53 @@ describe('testRunner', function () { outputSelection } const input = { language: 'Solidity', sources, settings } - results = solc.lowlevel.compileStandard(JSON.stringify(input), handleImport) + results = solc.compile(JSON.stringify(input)) done() }) .catch(e => { throw e - }) */ + }) }) it('should match compiled json', function () { - assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820302b121207c089c266b6ff1a5d282ee6cdcc92dbecd4beca1f3c49332bc2de640029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 ADDRESS 0x2b SLT SLT SMOD 0xc0 DUP10 0xc2 PUSH7 0xB6FF1A5D282EE6 0xcd 0xcc SWAP3 0xdb 0xec 0xd4 0xbe 0xca 0x1f EXTCODECOPY 0x49 CALLER 0x2b 0xc2 0xde PUSH5 0x29000000 ","sourceMap":"46:357:0:-;;;205:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;205:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;259:20:0;;205:81;;-1:-1:-1;259:20:0;;-1:-1:-1;259:8:0;;-1:-1:-1;259:20:0;;;;;:::i;:::-;;205:81;46:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;46:357:0;;;-1:-1:-1;46:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"ast":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]},"id":26,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"0:23:0"},{"absolutePath":"mortal.sol","file":"mortal.sol","id":2,"nodeType":"ImportDirective","scope":26,"sourceUnit":53,"src":"24:20:0","symbolAliases":[],"unitAlias":""},{"baseContracts":[{"arguments":null,"baseName":{"contractScope":null,"id":3,"name":"Mortal","nodeType":"UserDefinedTypeName","referencedDeclaration":52,"src":"66:6:0","typeDescriptions":{"typeIdentifier":"t_contract$_Mortal_$52","typeString":"contract Mortal"}},"id":4,"nodeType":"InheritanceSpecifier","src":"66:6:0"}],"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":25,"linearizedBaseContracts":[25,52],"name":"Greeter","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":6,"name":"greeting","nodeType":"VariableDeclaration","scope":25,"src":"133:15:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":5,"name":"string","nodeType":"ElementaryTypeName","src":"133:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"},{"body":{"id":15,"nodeType":"Block","src":"249:37:0","statements":[{"expression":{"argumentTypes":null,"id":13,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":11,"name":"greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":6,"src":"259:8:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"id":12,"name":"_greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":8,"src":"270:9:0","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},"src":"259:20:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":14,"nodeType":"ExpressionStatement","src":"259:20:0"}]},"documentation":null,"id":16,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":9,"nodeType":"ParameterList","parameters":[{"constant":false,"id":8,"name":"_greeting","nodeType":"VariableDeclaration","scope":16,"src":"217:23:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":7,"name":"string","nodeType":"ElementaryTypeName","src":"217:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"}],"src":"216:25:0"},"returnParameters":{"id":10,"nodeType":"ParameterList","parameters":[],"src":"249:0:0"},"scope":25,"src":"205:81:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":23,"nodeType":"Block","src":"369:32:0","statements":[{"expression":{"argumentTypes":null,"id":21,"name":"greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":6,"src":"386:8:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"functionReturnParameters":20,"id":22,"nodeType":"Return","src":"379:15:0"}]},"documentation":null,"id":24,"implemented":true,"kind":"function","modifiers":[],"name":"greet","nodeType":"FunctionDefinition","parameters":{"id":17,"nodeType":"ParameterList","parameters":[],"src":"330:2:0"},"returnParameters":{"id":20,"nodeType":"ParameterList","parameters":[{"constant":false,"id":19,"name":"","nodeType":"VariableDeclaration","scope":24,"src":"354:13:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":18,"name":"string","nodeType":"ElementaryTypeName","src":"354:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"}],"src":"353:15:0"},"scope":25,"src":"316:85:0","stateMutability":"view","superFunction":null,"visibility":"public"}],"scope":26,"src":"46:357:0"}],"src":"0:404:0"},"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:20:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"66:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"66:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"133:6:0"}],"id":6,"name":"VariableDeclaration","src":"133:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"217:6:0"}],"id":8,"name":"VariableDeclaration","src":"217:23:0"}],"id":9,"name":"ParameterList","src":"216:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"249:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"259:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"270:9:0"}],"id":13,"name":"Assignment","src":"259:20:0"}],"id":14,"name":"ExpressionStatement","src":"259:20:0"}],"id":15,"name":"Block","src":"249:37:0"}],"id":16,"name":"FunctionDefinition","src":"205:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"330:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"354:6:0"}],"id":19,"name":"VariableDeclaration","src":"354:13:0"}],"id":20,"name":"ParameterList","src":"353:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"386:8:0"}],"id":22,"name":"Return","src":"379:15:0"}],"id":23,"name":"Block","src":"369:32:0"}],"id":24,"name":"FunctionDefinition","src":"316:85:0"}],"id":25,"name":"ContractDefinition","src":"46:357:0"}],"id":26,"name":"SourceUnit","src":"0:404:0"}},"mortal.sol":{"ast":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]},"id":53,"nodeType":"SourceUnit","nodes":[{"id":27,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"0:23:1"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":52,"linearizedBaseContracts":[52],"name":"Mortal","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":29,"name":"owner","nodeType":"VariableDeclaration","scope":52,"src":"99:21:1","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":28,"name":"address","nodeType":"ElementaryTypeName","src":"99:15:1","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"body":{"id":37,"nodeType":"Block","src":"241:23:1","statements":[{"expression":{"argumentTypes":null,"id":35,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":32,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"243:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":33,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":67,"src":"251:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":34,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"251:10:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"243:18:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":36,"nodeType":"ExpressionStatement","src":"243:18:1"}]},"documentation":null,"id":38,"implemented":true,"kind":"function","modifiers":[],"name":"mortal","nodeType":"FunctionDefinition","parameters":{"id":30,"nodeType":"ParameterList","parameters":[],"src":"231:2:1"},"returnParameters":{"id":31,"nodeType":"ParameterList","parameters":[],"src":"241:0:1"},"scope":52,"src":"216:48:1","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":50,"nodeType":"Block","src":"349:49:1","statements":[{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":41,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":67,"src":"355:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"355:10:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":43,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"369:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"355:19:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":49,"nodeType":"IfStatement","src":"351:44:1","trueBody":{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":46,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"389:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":45,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":75,"src":"376:12:1","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":47,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"376:19:1","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":48,"nodeType":"ExpressionStatement","src":"376:19:1"}}]},"documentation":null,"id":51,"implemented":true,"kind":"function","modifiers":[],"name":"kill","nodeType":"FunctionDefinition","parameters":{"id":39,"nodeType":"ParameterList","parameters":[],"src":"339:2:1"},"returnParameters":{"id":40,"nodeType":"ParameterList","parameters":[],"src":"349:0:1"},"scope":52,"src":"326:72:1","stateMutability":"nonpayable","superFunction":null,"visibility":"public"}],"scope":53,"src":"25:375:1"}],"src":"0:401:1"},"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) + assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820302b121207c089c266b6ff1a5d282ee6cdcc92dbecd4beca1f3c49332bc2de640029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 ADDRESS 0x2b SLT SLT SMOD 0xc0 DUP10 0xc2 PUSH7 0xB6FF1A5D282EE6 0xcd 0xcc SWAP3 0xdb 0xec 0xd4 0xbe 0xca 0x1f EXTCODECOPY 0x49 CALLER 0x2b 0xc2 0xde PUSH5 0x29000000 ","sourceMap":"46:357:0:-;;;205:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;205:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;259:20:0;;205:81;;-1:-1:-1;259:20:0;;-1:-1:-1;259:8:0;;-1:-1:-1;259:20:0;;;;;:::i;:::-;;205:81;46:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;46:357:0;;;-1:-1:-1;46:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:20:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"66:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"66:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"133:6:0"}],"id":6,"name":"VariableDeclaration","src":"133:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"217:6:0"}],"id":8,"name":"VariableDeclaration","src":"217:23:0"}],"id":9,"name":"ParameterList","src":"216:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"249:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"259:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"270:9:0"}],"id":13,"name":"Assignment","src":"259:20:0"}],"id":14,"name":"ExpressionStatement","src":"259:20:0"}],"id":15,"name":"Block","src":"249:37:0"}],"id":16,"name":"FunctionDefinition","src":"205:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"330:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"354:6:0"}],"id":19,"name":"VariableDeclaration","src":"354:13:0"}],"id":20,"name":"ParameterList","src":"353:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"386:8:0"}],"id":22,"name":"Return","src":"379:15:0"}],"id":23,"name":"Block","src":"369:32:0"}],"id":24,"name":"FunctionDefinition","src":"316:85:0"}],"id":25,"name":"ContractDefinition","src":"46:357:0"}],"id":26,"name":"SourceUnit","src":"0:404:0"}},"mortal.sol":{"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) + }) + }) + + // Test github imports with callback + describe('test github imports with callback', function() { + let sources = {}, results = {} + sources = { + 'github_import.sol': { content: 'pragma solidity ^0.5.0;\nimport \'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' } + } + + before(function (done) { + const findImportsSync = function (path) { + rr.resolve('./', path).then(function(result) { + return result + }).catch(function(e) { + throw e + }) + return {} + } + const outputSelection = { + // Enable the metadata and bytecode outputs of every single contract. + '*': { + '': ['ast', 'legacyAST'], + '*': ['abi', 'evm.bytecode.object', 'devdoc', 'userdoc', 'evm.gasEstimates'] + } + } + const settings = { + optimizer: { enabled: true, runs: 500 }, + evmVersion: 'byzantium', + outputSelection + } + const input = { language: 'Solidity', sources, settings } + results = solc.compile(JSON.stringify(input), findImportsSync) + done() + }) + it('should not match file not found error msg', function () { + const msg = "{\"contracts\":{},\"errors\":[{\"component\":\"general\",\"formattedMessage\":\"github_import.sol:2:1: ParserError: Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\\nimport 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol';\\n^-------------------------------------------------------------------------------------^\\n\",\"message\":\"Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\",\"severity\":\"error\",\"sourceLocation\":{\"end\":111,\"file\":\"github_import.sol\",\"start\":24},\"type\":\"ParserError\"}],\"sources\":{}}" + assert.notDeepStrictEqual(results, msg) }) }) }) From 8225e7acb392d30b37e4ea2546f690a43a7db8da Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Thu, 29 Nov 2018 07:43:14 +0530 Subject: [PATCH 10/14] remove unused packages --- remix-resolve/package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/remix-resolve/package.json b/remix-resolve/package.json index 5233099c34..9f79b4e506 100644 --- a/remix-resolve/package.json +++ b/remix-resolve/package.json @@ -28,11 +28,7 @@ ] }, "dependencies": { - "async": "^2.6.1", "axios": "^0.18.0", - "promise": "^8.0.2", - "remix-solidity": "^0.2.14", - "sleep": "^5.2.3", "solc": "^0.5.0", "url": "^0.11.0", "valid-url": "^1.0.9" From 53ac628f9025f1ff4c0e52875efbd10e5c212802 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Thu, 29 Nov 2018 09:28:03 +0530 Subject: [PATCH 11/14] update readme; remove unused requires --- remix-resolve/README.md | 22 ++++++++++++++++++++++ remix-resolve/tests/test.js | 4 ---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/remix-resolve/README.md b/remix-resolve/README.md index 3fadaf5d72..387d8588ae 100644 --- a/remix-resolve/README.md +++ b/remix-resolve/README.md @@ -12,3 +12,25 @@ 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' } } ``` +#### API + +`combineSource(sources)` + +Returns `json` object with exact same path as `import` statement. + +**Output** +```json +{ + './mortal.sol': { content: '...' }, + 'greeter.sol': { content: '...' } +} +``` + +`resolve(path, combinedSources)` function should be called from within `handleImportCb` function of `solc.compile(input, handleImportCb)`. + +```javascript +const rr = require('remix-resolve') +function handleImportCb(path) { + return rr.resolve(path, combinedSources) +} +``` diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 05e337d69a..42e7de4667 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -2,10 +2,6 @@ const rr = require('../src/index.js') const assert = require('assert') const fs = require('fs') const solc = require('solc') -const Compiler = require('remix-solidity').Compiler -const async = require('async') -const Promise = require('promise') -const sleep = require('sleep') describe('testRunner', function () { describe('#combineSource', function() { From c414bdce55ae5fd6a66776c0099379f832430124 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Tue, 4 Dec 2018 16:21:15 +0530 Subject: [PATCH 12/14] try to implement getFile --- remix-resolve/src/combineSource.js | 10 +++--- remix-resolve/src/getFile.js | 5 +++ remix-resolve/src/index.js | 4 ++- remix-resolve/tests/test.js | 55 ++++++++++++++++++++++++++++-- 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 remix-resolve/src/getFile.js diff --git a/remix-resolve/src/combineSource.js b/remix-resolve/src/combineSource.js index 68f1947082..f08b8b2ee4 100644 --- a/remix-resolve/src/combineSource.js +++ b/remix-resolve/src/combineSource.js @@ -5,7 +5,7 @@ const resolve = require('./resolve.js') combineSource(//basepath, //sources object) */ const combineSource = async function (rootpath, sources) { - let fn, importLine, ir + let fn, ir var matches = [] ir = /^(?:import){1}(.+){0,1}\s['"](.+)['"];/gm let match = null @@ -15,8 +15,8 @@ const combineSource = async function (rootpath, sources) { matches.push(match) } for (let match of matches) { - importLine = match[0] - const extra = match[1] ? match[1] : '' + // importLine = match[0] + // const extra = match[1] ? match[1] : '' if (validUrl.isUri(rootpath)) { fn = url.resolve(rootpath, match[2]) } else { @@ -27,8 +27,8 @@ const combineSource = async function (rootpath, sources) { if (fn.localeCompare('remix_tests.sol') !== 0 && fn.localeCompare('tests.sol') !== 0) { let subSorce = {} const response = await resolve(rootpath, fn) - sources[fileName].content = sources[fileName].content.replace(importLine, 'import' + extra + ' \'' + response.filename + '\';') - subSorce[response.filename] = { content: response.content } + // sources[fileName].content = sources[fileName].content.replace(importLine, 'import' + extra + ' \'' + response.filename + '\';') + subSorce[fn] = { content: response.content } sources = Object.assign(await combineSource(response.rootpath, subSorce), sources) } } catch (e) { diff --git a/remix-resolve/src/getFile.js b/remix-resolve/src/getFile.js new file mode 100644 index 0000000000..92cf8f1d6e --- /dev/null +++ b/remix-resolve/src/getFile.js @@ -0,0 +1,5 @@ +const getFile = function (path, sources) { + return sources[path].content +} + +module.exports = getFile diff --git a/remix-resolve/src/index.js b/remix-resolve/src/index.js index eaa3b1d1ed..2329d0cbf7 100644 --- a/remix-resolve/src/index.js +++ b/remix-resolve/src/index.js @@ -5,8 +5,10 @@ const input = rr.combineSource({ 'greeter.sol': content }) */ const resolve = require('./resolve.js') const combineSource = require('./combineSource.js') +const getFile = require('./getFile.js') module.exports = { resolve: resolve, - combineSource: combineSource + combineSource: combineSource, + getFile: getFile } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 42e7de4667..7ea08b2111 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -7,7 +7,7 @@ describe('testRunner', function () { describe('#combineSource', function() { describe('test example_1 [local imports]]', function () { let filename = '../remix-resolve/tests/example_1/greeter.sol' - let tests = [], results = {} + let results = {} before(function (done) { const content = fs.readFileSync(filename).toString() @@ -35,7 +35,7 @@ describe('testRunner', function () { describe('test example_2 [github imports]', function () { let filename = '../remix-resolve/tests/example_2/github_import.sol' - let tests = [], results = {} + let results = {} before(function (done) { const content = fs.readFileSync(filename).toString() @@ -65,7 +65,7 @@ describe('testRunner', function () { // Test successful compile after combineSource describe('test example_1 for successful compile', function() { let filename = '../remix-resolve/tests/example_1/greeter.sol' - let tests = [], results = {} + let results = {} before(function (done) { const content = fs.readFileSync(filename).toString() @@ -135,4 +135,53 @@ describe('testRunner', function () { assert.notDeepStrictEqual(results, msg) }) }) + + // Test handleImportCb + describe('test github imports with callback', function() { + let filename = '../remix-resolve/tests/example_1/greeter.sol' + let sources = {}, results = {} + + before(function (done) { + const outputSelection = { + // Enable the metadata and bytecode outputs of every single contract. + '*': { + '': ['ast', 'legacyAST'], + '*': ['abi', 'evm.bytecode.object', 'devdoc', 'userdoc', 'evm.gasEstimates'] + } + } + const settings = { + optimizer: { enabled: true, runs: 500 }, + evmVersion: 'byzantium', + outputSelection + } + + const content = fs.readFileSync(filename).toString() + var sources = [] + sources['greeter.sol'] = { 'content': content } + rr.combineSource('../remix-resolve/tests/example_1/', sources) + .then(combinedSources => { + console.log(combinedSources) + const input = { language: 'Solidity', sources: combinedSources, settings } + const findImportsSync = function (path) { + console.log(path) + console.log(sources) + // return rr.getFile(path, sources) + } + try { + results = solc.compile(JSON.stringify(input), findImportsSync) + done() + } catch (e) { + throw e + } + }) + .catch(e => { + throw e + }) + }) + it('should not match file not found error msg', function () { + console.log(results) + const msg = "{\"contracts\":{},\"errors\":[{\"component\":\"general\",\"formattedMessage\":\"github_import.sol:2:1: ParserError: Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\\nimport 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol';\\n^-------------------------------------------------------------------------------------^\\n\",\"message\":\"Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\",\"severity\":\"error\",\"sourceLocation\":{\"end\":111,\"file\":\"github_import.sol\",\"start\":24},\"type\":\"ParserError\"}],\"sources\":{}}" + assert.notDeepStrictEqual(results, msg) + }) + }) }) From 10440f1761312916a2f546f5c574b3fbd3f52d2a Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Tue, 4 Dec 2018 19:30:26 +0530 Subject: [PATCH 13/14] resolve via callback --- remix-resolve/src/combineSource.js | 3 ++- remix-resolve/src/getFile.js | 1 + remix-resolve/tests/test.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/remix-resolve/src/combineSource.js b/remix-resolve/src/combineSource.js index f08b8b2ee4..b8b451cb42 100644 --- a/remix-resolve/src/combineSource.js +++ b/remix-resolve/src/combineSource.js @@ -28,7 +28,8 @@ const combineSource = async function (rootpath, sources) { let subSorce = {} const response = await resolve(rootpath, fn) // sources[fileName].content = sources[fileName].content.replace(importLine, 'import' + extra + ' \'' + response.filename + '\';') - subSorce[fn] = { content: response.content } + const regex = /(\.+\/)/g + subSorce[fn.replace(regex, '')] = { content: response.content } sources = Object.assign(await combineSource(response.rootpath, subSorce), sources) } } catch (e) { diff --git a/remix-resolve/src/getFile.js b/remix-resolve/src/getFile.js index 92cf8f1d6e..fba0c1345f 100644 --- a/remix-resolve/src/getFile.js +++ b/remix-resolve/src/getFile.js @@ -1,4 +1,5 @@ const getFile = function (path, sources) { + // return sources[path].content return sources[path].content } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 7ea08b2111..e329e5e3c3 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -165,7 +165,7 @@ describe('testRunner', function () { const findImportsSync = function (path) { console.log(path) console.log(sources) - // return rr.getFile(path, sources) + return rr.getFile(path, combinedSources) } try { results = solc.compile(JSON.stringify(input), findImportsSync) From bd058779bab662dacc1334426784301ba59cd303 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Wed, 5 Dec 2018 01:51:10 +0530 Subject: [PATCH 14/14] callback & compile --- remix-resolve/src/getFile.js | 1 - remix-resolve/tests/test.js | 56 +++++------------------------------- 2 files changed, 7 insertions(+), 50 deletions(-) diff --git a/remix-resolve/src/getFile.js b/remix-resolve/src/getFile.js index fba0c1345f..92cf8f1d6e 100644 --- a/remix-resolve/src/getFile.js +++ b/remix-resolve/src/getFile.js @@ -1,5 +1,4 @@ const getFile = function (path, sources) { - // return sources[path].content return sources[path].content } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index e329e5e3c3..be21ae864a 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -29,7 +29,7 @@ describe('testRunner', function () { it('should returns 2 contracts with specified content', function () { assert.deepEqual(results, { 'mortal.sol':{ content: 'pragma solidity ^0.5.0;\n\ncontract Mortal {\n /* Define variable owner of the type address */\n address payable owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() public { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() public { if (msg.sender == owner) selfdestruct(owner); }\n}\n' }, - 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' }}) + 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \"./mortal.sol\";\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' }}) }) }) @@ -56,8 +56,8 @@ describe('testRunner', function () { }) it('should returns 2 contracts with specified content', function () { - assert.deepEqual(results, { 'SafeMath.sol': { content: 'pragma solidity ^0.4.24;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Gas optimization: this is cheaper than requiring \'a\' not being zero, but the\n \/\/ benefit is lost if \'b\' is also tested.\n \/\/ See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n \/\/ assert(a == b * c + a % b); \/\/ There is no case in which this doesn\'t hold\n\n return c;\n }\n\n \/**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n *\/\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n \/**\n * @dev Divides two numbers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n *\/\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n' }, - 'github_import.sol': { content: 'pragma solidity ^0.5.0;\nimport \'SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' }}) + assert.deepEqual(results, { 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol': { content: 'pragma solidity ^0.4.24;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Gas optimization: this is cheaper than requiring \'a\' not being zero, but the\n \/\/ benefit is lost if \'b\' is also tested.\n \/\/ See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n \/\/ Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n \/\/ assert(a == b * c + a % b); \/\/ There is no case in which this doesn\'t hold\n\n return c;\n }\n\n \/**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n *\/\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n \/**\n * @dev Divides two numbers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n *\/\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n' }, + 'github_import.sol': { content: 'pragma solidity ^0.5.0;\nimport \'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' }}) }) }) }) @@ -94,50 +94,12 @@ describe('testRunner', function () { }) }) it('should match compiled json', function () { - assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820302b121207c089c266b6ff1a5d282ee6cdcc92dbecd4beca1f3c49332bc2de640029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 ADDRESS 0x2b SLT SLT SMOD 0xc0 DUP10 0xc2 PUSH7 0xB6FF1A5D282EE6 0xcd 0xcc SWAP3 0xdb 0xec 0xd4 0xbe 0xca 0x1f EXTCODECOPY 0x49 CALLER 0x2b 0xc2 0xde PUSH5 0x29000000 ","sourceMap":"46:357:0:-;;;205:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;205:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;259:20:0;;205:81;;-1:-1:-1;259:20:0;;-1:-1:-1;259:8:0;;-1:-1:-1;259:20:0;;;;;:::i;:::-;;205:81;46:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;46:357:0;;;-1:-1:-1;46:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:20:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"66:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"66:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"133:6:0"}],"id":6,"name":"VariableDeclaration","src":"133:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"217:6:0"}],"id":8,"name":"VariableDeclaration","src":"217:23:0"}],"id":9,"name":"ParameterList","src":"216:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"249:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"259:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"270:9:0"}],"id":13,"name":"Assignment","src":"259:20:0"}],"id":14,"name":"ExpressionStatement","src":"259:20:0"}],"id":15,"name":"Block","src":"249:37:0"}],"id":16,"name":"FunctionDefinition","src":"205:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"330:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"354:6:0"}],"id":19,"name":"VariableDeclaration","src":"354:13:0"}],"id":20,"name":"ParameterList","src":"353:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"386:8:0"}],"id":22,"name":"Return","src":"379:15:0"}],"id":23,"name":"Block","src":"369:32:0"}],"id":24,"name":"FunctionDefinition","src":"316:85:0"}],"id":25,"name":"ContractDefinition","src":"46:357:0"}],"id":26,"name":"SourceUnit","src":"0:404:0"}},"mortal.sol":{"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) - }) - }) - - // Test github imports with callback - describe('test github imports with callback', function() { - let sources = {}, results = {} - sources = { - 'github_import.sol': { content: 'pragma solidity ^0.5.0;\nimport \'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\';\n\ncontract SimpleMath {\n using SafeMath for uint;\n}\n' } - } - - before(function (done) { - const findImportsSync = function (path) { - rr.resolve('./', path).then(function(result) { - return result - }).catch(function(e) { - throw e - }) - return {} - } - const outputSelection = { - // Enable the metadata and bytecode outputs of every single contract. - '*': { - '': ['ast', 'legacyAST'], - '*': ['abi', 'evm.bytecode.object', 'devdoc', 'userdoc', 'evm.gasEstimates'] - } - } - const settings = { - optimizer: { enabled: true, runs: 500 }, - evmVersion: 'byzantium', - outputSelection - } - const input = { language: 'Solidity', sources, settings } - results = solc.compile(JSON.stringify(input), findImportsSync) - done() - }) - it('should not match file not found error msg', function () { - const msg = "{\"contracts\":{},\"errors\":[{\"component\":\"general\",\"formattedMessage\":\"github_import.sol:2:1: ParserError: Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\\nimport 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol';\\n^-------------------------------------------------------------------------------------^\\n\",\"message\":\"Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\",\"severity\":\"error\",\"sourceLocation\":{\"end\":111,\"file\":\"github_import.sol\",\"start\":24},\"type\":\"ParserError\"}],\"sources\":{}}" - assert.notDeepStrictEqual(results, msg) + assert.deepEqual(results, `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820219247b0f7e46da9d88f6a333d70c1cab030925efd29dccd57f97606a232a7530029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 0x21 SWAP3 0x47 0xb0 0xf7 0xe4 PUSH14 0xA9D88F6A333D70C1CAB030925EFD 0x29 0xdc 0xcd JUMPI 0xf9 PUSH23 0x6A232A753002900000000000000000000000000000000 ","sourceMap":"48:357:0:-;;;207:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;207:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;207:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;261:20:0;;207:81;;-1:-1:-1;261:20:0;;-1:-1:-1;261:8:0;;-1:-1:-1;261:20:0;;;;;:::i;:::-;;207:81;48:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;48:357:0;;;-1:-1:-1;48:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"./mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:22:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"68:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"68:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"135:6:0"}],"id":6,"name":"VariableDeclaration","src":"135:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"219:6:0"}],"id":8,"name":"VariableDeclaration","src":"219:23:0"}],"id":9,"name":"ParameterList","src":"218:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"251:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"261:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"272:9:0"}],"id":13,"name":"Assignment","src":"261:20:0"}],"id":14,"name":"ExpressionStatement","src":"261:20:0"}],"id":15,"name":"Block","src":"251:37:0"}],"id":16,"name":"FunctionDefinition","src":"207:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"332:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"356:6:0"}],"id":19,"name":"VariableDeclaration","src":"356:13:0"}],"id":20,"name":"ParameterList","src":"355:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"388:8:0"}],"id":22,"name":"Return","src":"381:15:0"}],"id":23,"name":"Block","src":"371:32:0"}],"id":24,"name":"FunctionDefinition","src":"318:85:0"}],"id":25,"name":"ContractDefinition","src":"48:357:0"}],"id":26,"name":"SourceUnit","src":"0:406:0"}},"mortal.sol":{"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}`) }) }) // Test handleImportCb - describe('test github imports with callback', function() { + describe('test github imports compilation with callback', function() { let filename = '../remix-resolve/tests/example_1/greeter.sol' let sources = {}, results = {} @@ -160,11 +122,8 @@ describe('testRunner', function () { sources['greeter.sol'] = { 'content': content } rr.combineSource('../remix-resolve/tests/example_1/', sources) .then(combinedSources => { - console.log(combinedSources) const input = { language: 'Solidity', sources: combinedSources, settings } const findImportsSync = function (path) { - console.log(path) - console.log(sources) return rr.getFile(path, combinedSources) } try { @@ -179,9 +138,8 @@ describe('testRunner', function () { }) }) it('should not match file not found error msg', function () { - console.log(results) - const msg = "{\"contracts\":{},\"errors\":[{\"component\":\"general\",\"formattedMessage\":\"github_import.sol:2:1: ParserError: Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\\nimport 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol';\\n^-------------------------------------------------------------------------------------^\\n\",\"message\":\"Source \\\"https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol\\\" not found: File not found.\",\"severity\":\"error\",\"sourceLocation\":{\"end\":111,\"file\":\"github_import.sol\",\"start\":24},\"type\":\"ParserError\"}],\"sources\":{}}" - assert.notDeepStrictEqual(results, msg) + const msg = `{"contracts":{"greeter.sol":{"Greeter":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516103733803806103738339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815164010000000081118282018710171561007857600080fd5b505080519093506100929250600191506020840190610099565b5050610134565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100da57805160ff1916838001178555610107565b82800160010185558215610107579182015b828111156101075782518255916020019190600101906100ec565b50610113929150610117565b5090565b61013191905b80821115610113576000815560010161011d565b90565b610230806101436000396000f3fe6080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b578063cfae321714610072578063f1eae25c146100fc575b600080fd5b34801561006757600080fd5b50610070610111565b005b34801561007e57600080fd5b5061008761014e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c15781810151838201526020016100a9565b50505050905090810190601f1680156100ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010857600080fd5b506100706101e3565b60005473ffffffffffffffffffffffffffffffffffffffff1633141561014c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101d95780601f106101ae576101008083540402835291602001916101d9565b820191906000526020600020905b8154815290600101906020018083116101bc57829003601f168201915b5050505050905090565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a72305820219247b0f7e46da9d88f6a333d70c1cab030925efd29dccd57f97606a232a7530029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x373 CODESIZE SUB DUP1 PUSH2 0x373 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x20 DUP2 ADD DUP5 DUP2 GT ISZERO PUSH2 0x5E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH5 0x100000000 DUP2 GT DUP3 DUP3 ADD DUP8 LT OR ISZERO PUSH2 0x78 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP DUP1 MLOAD SWAP1 SWAP4 POP PUSH2 0x92 SWAP3 POP PUSH1 0x1 SWAP2 POP PUSH1 0x20 DUP5 ADD SWAP1 PUSH2 0x99 JUMP JUMPDEST POP POP PUSH2 0x134 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDA JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x107 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x107 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x107 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEC JUMP JUMPDEST POP PUSH2 0x113 SWAP3 SWAP2 POP PUSH2 0x117 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x131 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x11D JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x230 DUP1 PUSH2 0x143 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x72 JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH2 0xFC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x111 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x87 PUSH2 0x14E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xA9 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xEE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x108 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x1E3 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH2 0x14C JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1D9 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1AE JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1D9 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1BC JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 0x21 SWAP3 0x47 0xb0 0xf7 0xe4 PUSH14 0xA9D88F6A333D70C1CAB030925EFD 0x29 0xdc 0xcd JUMPI 0xf9 PUSH23 0x6A232A753002900000000000000000000000000000000 ","sourceMap":"48:357:0:-;;;207:81;8:9:-1;5:2;;;30:1;27;20:12;5:2;207:81:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;207:81:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;261:11;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;-1:-1;;261:20:0;;207:81;;-1:-1:-1;261:20:0;;-1:-1:-1;261:8:0;;-1:-1:-1;261:20:0;;;;;:::i;:::-;;207:81;48:357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;48:357:0;;;-1:-1:-1;48:357:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"112000","executionCost":"infinite","totalCost":"infinite"},"external":{"greet()":"infinite","kill()":"30560","mortal()":"20397"}}},"userdoc":{"methods":{}}}},"mortal.sol":{"Mortal":{"abi":[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mortal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"evm":{"bytecode":{"linkReferences":{},"object":"608060405234801561001057600080fd5b5060fc8061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114604d578063f1eae25c146061575b600080fd5b348015605857600080fd5b50605f6073565b005b348015606c57600080fd5b50605f60af565b60005473ffffffffffffffffffffffffffffffffffffffff1633141560ad5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6000805473ffffffffffffffffffffffffffffffffffffffff19163317905556fea165627a7a723058203403979ec65509fedd999f7464440863faa25a2acaabd8dc0d01fa3aaeaee4400029","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xFC DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x48 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x41C0E1B5 DUP2 EQ PUSH1 0x4D JUMPI DUP1 PUSH4 0xF1EAE25C EQ PUSH1 0x61 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0x73 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x6C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x5F PUSH1 0xAF JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ ISZERO PUSH1 0xAD JUMPI PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND CALLER OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE SUB SWAP8 SWAP15 0xc6 SSTORE MULMOD INVALID 0xdd SWAP10 SWAP16 PUSH21 0x64440863FAA25A2ACAABD8DC0D01FA3AAEAEE44000 0x29 ","sourceMap":"25:375:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:375:1;;;;;;;"},"gasEstimates":{"creation":{"codeDepositCost":"50400","executionCost":"99","totalCost":"50499"},"external":{"kill()":"30560","mortal()":"20375"}}},"userdoc":{"methods":{}}}}},"sources":{"greeter.sol":{"ast":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]},"id":26,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"0:23:0"},{"absolutePath":"mortal.sol","file":"./mortal.sol","id":2,"nodeType":"ImportDirective","scope":26,"sourceUnit":53,"src":"24:22:0","symbolAliases":[],"unitAlias":""},{"baseContracts":[{"arguments":null,"baseName":{"contractScope":null,"id":3,"name":"Mortal","nodeType":"UserDefinedTypeName","referencedDeclaration":52,"src":"68:6:0","typeDescriptions":{"typeIdentifier":"t_contract$_Mortal_$52","typeString":"contract Mortal"}},"id":4,"nodeType":"InheritanceSpecifier","src":"68:6:0"}],"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":25,"linearizedBaseContracts":[25,52],"name":"Greeter","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":6,"name":"greeting","nodeType":"VariableDeclaration","scope":25,"src":"135:15:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":5,"name":"string","nodeType":"ElementaryTypeName","src":"135:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"},{"body":{"id":15,"nodeType":"Block","src":"251:37:0","statements":[{"expression":{"argumentTypes":null,"id":13,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":11,"name":"greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":6,"src":"261:8:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"id":12,"name":"_greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":8,"src":"272:9:0","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},"src":"261:20:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":14,"nodeType":"ExpressionStatement","src":"261:20:0"}]},"documentation":null,"id":16,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":9,"nodeType":"ParameterList","parameters":[{"constant":false,"id":8,"name":"_greeting","nodeType":"VariableDeclaration","scope":16,"src":"219:23:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":7,"name":"string","nodeType":"ElementaryTypeName","src":"219:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"}],"src":"218:25:0"},"returnParameters":{"id":10,"nodeType":"ParameterList","parameters":[],"src":"251:0:0"},"scope":25,"src":"207:81:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":23,"nodeType":"Block","src":"371:32:0","statements":[{"expression":{"argumentTypes":null,"id":21,"name":"greeting","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":6,"src":"388:8:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"functionReturnParameters":20,"id":22,"nodeType":"Return","src":"381:15:0"}]},"documentation":null,"id":24,"implemented":true,"kind":"function","modifiers":[],"name":"greet","nodeType":"FunctionDefinition","parameters":{"id":17,"nodeType":"ParameterList","parameters":[],"src":"332:2:0"},"returnParameters":{"id":20,"nodeType":"ParameterList","parameters":[{"constant":false,"id":19,"name":"","nodeType":"VariableDeclaration","scope":24,"src":"356:13:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":18,"name":"string","nodeType":"ElementaryTypeName","src":"356:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"internal"}],"src":"355:15:0"},"scope":25,"src":"318:85:0","stateMutability":"view","superFunction":null,"visibility":"public"}],"scope":26,"src":"48:357:0"}],"src":"0:406:0"},"id":0,"legacyAST":{"attributes":{"absolutePath":"greeter.sol","exportedSymbols":{"Greeter":[25]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":1,"name":"PragmaDirective","src":"0:23:0"},{"attributes":{"SourceUnit":53,"absolutePath":"mortal.sol","file":"./mortal.sol","scope":26,"symbolAliases":[null],"unitAlias":""},"id":2,"name":"ImportDirective","src":"24:22:0"},{"attributes":{"contractDependencies":[52],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[25,52],"name":"Greeter","scope":26},"children":[{"attributes":{"arguments":null},"children":[{"attributes":{"contractScope":null,"name":"Mortal","referencedDeclaration":52,"type":"contract Mortal"},"id":3,"name":"UserDefinedTypeName","src":"68:6:0"}],"id":4,"name":"InheritanceSpecifier","src":"68:6:0"},{"attributes":{"constant":false,"name":"greeting","scope":25,"stateVariable":true,"storageLocation":"default","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":5,"name":"ElementaryTypeName","src":"135:6:0"}],"id":6,"name":"VariableDeclaration","src":"135:15:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":true,"kind":"constructor","modifiers":[null],"name":"","scope":25,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"children":[{"attributes":{"constant":false,"name":"_greeting","scope":16,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":7,"name":"ElementaryTypeName","src":"219:6:0"}],"id":8,"name":"VariableDeclaration","src":"219:23:0"}],"id":9,"name":"ParameterList","src":"218:25:0"},{"attributes":{"parameters":[null]},"children":[],"id":10,"name":"ParameterList","src":"251:0:0"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"string storage ref"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":11,"name":"Identifier","src":"261:8:0"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":8,"type":"string memory","value":"_greeting"},"id":12,"name":"Identifier","src":"272:9:0"}],"id":13,"name":"Assignment","src":"261:20:0"}],"id":14,"name":"ExpressionStatement","src":"261:20:0"}],"id":15,"name":"Block","src":"251:37:0"}],"id":16,"name":"FunctionDefinition","src":"207:81:0"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"greet","scope":25,"stateMutability":"view","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":17,"name":"ParameterList","src":"332:2:0"},{"children":[{"attributes":{"constant":false,"name":"","scope":24,"stateVariable":false,"storageLocation":"memory","type":"string","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"string","type":"string"},"id":18,"name":"ElementaryTypeName","src":"356:6:0"}],"id":19,"name":"VariableDeclaration","src":"356:13:0"}],"id":20,"name":"ParameterList","src":"355:15:0"},{"children":[{"attributes":{"functionReturnParameters":20},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":6,"type":"string storage ref","value":"greeting"},"id":21,"name":"Identifier","src":"388:8:0"}],"id":22,"name":"Return","src":"381:15:0"}],"id":23,"name":"Block","src":"371:32:0"}],"id":24,"name":"FunctionDefinition","src":"318:85:0"}],"id":25,"name":"ContractDefinition","src":"48:357:0"}],"id":26,"name":"SourceUnit","src":"0:406:0"}},"mortal.sol":{"ast":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]},"id":53,"nodeType":"SourceUnit","nodes":[{"id":27,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"0:23:1"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":52,"linearizedBaseContracts":[52],"name":"Mortal","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":29,"name":"owner","nodeType":"VariableDeclaration","scope":52,"src":"99:21:1","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":28,"name":"address","nodeType":"ElementaryTypeName","src":"99:15:1","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"body":{"id":37,"nodeType":"Block","src":"241:23:1","statements":[{"expression":{"argumentTypes":null,"id":35,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":32,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"243:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":33,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":67,"src":"251:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":34,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"251:10:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"243:18:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":36,"nodeType":"ExpressionStatement","src":"243:18:1"}]},"documentation":null,"id":38,"implemented":true,"kind":"function","modifiers":[],"name":"mortal","nodeType":"FunctionDefinition","parameters":{"id":30,"nodeType":"ParameterList","parameters":[],"src":"231:2:1"},"returnParameters":{"id":31,"nodeType":"ParameterList","parameters":[],"src":"241:0:1"},"scope":52,"src":"216:48:1","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":50,"nodeType":"Block","src":"349:49:1","statements":[{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":41,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":67,"src":"355:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"355:10:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":43,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"369:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"355:19:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":49,"nodeType":"IfStatement","src":"351:44:1","trueBody":{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":46,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":29,"src":"389:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":45,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":75,"src":"376:12:1","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":47,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"376:19:1","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":48,"nodeType":"ExpressionStatement","src":"376:19:1"}}]},"documentation":null,"id":51,"implemented":true,"kind":"function","modifiers":[],"name":"kill","nodeType":"FunctionDefinition","parameters":{"id":39,"nodeType":"ParameterList","parameters":[],"src":"339:2:1"},"returnParameters":{"id":40,"nodeType":"ParameterList","parameters":[],"src":"349:0:1"},"scope":52,"src":"326:72:1","stateMutability":"nonpayable","superFunction":null,"visibility":"public"}],"scope":53,"src":"25:375:1"}],"src":"0:401:1"},"id":1,"legacyAST":{"attributes":{"absolutePath":"mortal.sol","exportedSymbols":{"Mortal":[52]}},"children":[{"attributes":{"literals":["solidity","^","0.5",".0"]},"id":27,"name":"PragmaDirective","src":"0:23:1"},{"attributes":{"baseContracts":[null],"contractDependencies":[null],"contractKind":"contract","documentation":null,"fullyImplemented":true,"linearizedBaseContracts":[52],"name":"Mortal","scope":53},"children":[{"attributes":{"constant":false,"name":"owner","scope":52,"stateVariable":true,"storageLocation":"default","type":"address payable","value":null,"visibility":"internal"},"children":[{"attributes":{"name":"address","stateMutability":"payable","type":"address payable"},"id":28,"name":"ElementaryTypeName","src":"99:15:1"}],"id":29,"name":"VariableDeclaration","src":"99:21:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"mortal","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":30,"name":"ParameterList","src":"231:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":31,"name":"ParameterList","src":"241:0:1"},{"children":[{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"=","type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":32,"name":"Identifier","src":"243:5:1"},{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":33,"name":"Identifier","src":"251:3:1"}],"id":34,"name":"MemberAccess","src":"251:10:1"}],"id":35,"name":"Assignment","src":"243:18:1"}],"id":36,"name":"ExpressionStatement","src":"243:18:1"}],"id":37,"name":"Block","src":"241:23:1"}],"id":38,"name":"FunctionDefinition","src":"216:48:1"},{"attributes":{"documentation":null,"implemented":true,"isConstructor":false,"kind":"function","modifiers":[null],"name":"kill","scope":52,"stateMutability":"nonpayable","superFunction":null,"visibility":"public"},"children":[{"attributes":{"parameters":[null]},"children":[],"id":39,"name":"ParameterList","src":"339:2:1"},{"attributes":{"parameters":[null]},"children":[],"id":40,"name":"ParameterList","src":"349:0:1"},{"children":[{"attributes":{"falseBody":null},"children":[{"attributes":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"operator":"==","type":"bool"},"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"member_name":"sender","referencedDeclaration":null,"type":"address payable"},"children":[{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":67,"type":"msg","value":"msg"},"id":41,"name":"Identifier","src":"355:3:1"}],"id":42,"name":"MemberAccess","src":"355:10:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":43,"name":"Identifier","src":"369:5:1"}],"id":44,"name":"BinaryOperation","src":"355:19:1"},{"children":[{"attributes":{"argumentTypes":null,"isConstant":false,"isLValue":false,"isPure":false,"isStructConstructorCall":false,"lValueRequested":false,"names":[null],"type":"tuple()","type_conversion":false},"children":[{"attributes":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"overloadedDeclarations":[null],"referencedDeclaration":75,"type":"function (address payable)","value":"selfdestruct"},"id":45,"name":"Identifier","src":"376:12:1"},{"attributes":{"argumentTypes":null,"overloadedDeclarations":[null],"referencedDeclaration":29,"type":"address payable","value":"owner"},"id":46,"name":"Identifier","src":"389:5:1"}],"id":47,"name":"FunctionCall","src":"376:19:1"}],"id":48,"name":"ExpressionStatement","src":"376:19:1"}],"id":49,"name":"IfStatement","src":"351:44:1"}],"id":50,"name":"Block","src":"349:49:1"}],"id":51,"name":"FunctionDefinition","src":"326:72:1"}],"id":52,"name":"ContractDefinition","src":"25:375:1"}],"id":53,"name":"SourceUnit","src":"0:401:1"}}}}` + assert.deepEqual(results, msg) }) }) })