diff --git a/package.json b/package.json index 6078b4e61b..2e98b348bb 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "jquery": "^2.2.0", "js-base64": "^2.1.9", "nightwatch": "^0.9.3", - "semver": "^5.3.0", "solc": "https://github.com/ethereum/solc-js", "standard": "^8.5.0", "tape": "^4.5.1", diff --git a/src/app/compiler.js b/src/app/compiler.js index 384205e0c3..b0d7d6a6e5 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -1,8 +1,8 @@ 'use strict' var solc = require('solc/wrapper') +var solcABI = require('solc/abi') -var semver = require('semver') var webworkify = require('webworkify') var utils = require('./utils') @@ -278,51 +278,9 @@ function Compiler (editor, handleGithubCall) { } function updateInterface (data) { - console.log(data) - for (var contract in data.contracts) { var abi = JSON.parse(data.contracts[contract].interface) - console.log(abi) - - var hasConstructor = false - var hasFallback = false - - for (var i = 0; i < abi.length; i++) { - var item = abi[i] - - if (item.type === "constructor") { - hasConstructor = true - } else if (item.type === "fallback") { - hasFallback = true - } - - // add "payable" to everything - // FIXME: only for compiler <0.4.0 - if (semver.lt(currentVersion, '0.4.0')) { - item.payable = true - } - } - - // FIXME: only for compiler <0.x.y - // 0.1.2 from Aug 2015 had it. The code has it since May 2015 (e7931ade) - if (!hasConstructor && semver.lt(currentVersion, '0.1.2')) { - abi.push({ - type: 'constructor', - payable: true, - inputs: [] - }) - } - - // FIXME: only for compiler <0.4.0 - if (!hasFallback && semver.lt(currentVersion, '0.4.0')) { - abi.push({ - type: 'fallback', - payable: true - }) - } - - console.log(abi) - + abi = solcABI.update(currentVersion, abi) data.contracts[contract].interface = JSON.stringify(abi) }