Use solc/abi

pull/1/head
Alex Beregszaszi 8 years ago
parent 8229fc358a
commit 7bcceae9ff
  1. 1
      package.json
  2. 46
      src/app/compiler.js

@ -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",

@ -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)
}

Loading…
Cancel
Save