use solc for linking librairy

pull/3094/head
yann300 7 years ago
parent 48ff5e882d
commit 69033b7239
  1. 11
      remix-lib/src/execution/txFormat.js

@ -3,6 +3,8 @@ var ethJSABI = require('ethereumjs-abi')
var helper = require('./txHelper')
var executionContext = require('./execution-context')
var asyncJS = require('async')
var solcLinker = require('solc/linker')
var ethJSUtil = require('ethereumjs-util')
module.exports = {
@ -226,14 +228,7 @@ module.exports = {
},
linkLibrary: function (libraryName, address, bytecodeToLink) {
var libLabel = '__' + libraryName + Array(39 - libraryName.length).join('_')
if (bytecodeToLink.indexOf(libLabel) === -1) return bytecodeToLink
address = Array(40 - address.length + 1).join('0') + address
while (bytecodeToLink.indexOf(libLabel) >= 0) {
bytecodeToLink = bytecodeToLink.replace(libLabel, address)
}
return bytecodeToLink
return solcLinker.linkBytecode(bytecodeToLink, { [libraryName]: ethJSUtil.addHexPrefix(address) })
},
decodeResponse: function (response, fnabi) {

Loading…
Cancel
Save