Merge pull request #710 from ethereum/yann300-patch-1

use solc for linking library
pull/7/head
yann300 7 years ago committed by GitHub
commit c5722689c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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