use solc for linking librairy

pull/7/head
yann300 7 years ago
parent fde4ee1eab
commit 33c1dd1c63
  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