treat library as dependencies for contract deployment

This commit is contained in:
Iuri Matias 2017-07-16 13:31:40 -04:00
parent ecab599d00
commit acee934467
2 changed files with 10 additions and 3 deletions

View File

@ -137,8 +137,15 @@ class ContractsManager {
for (className in self.contracts) {
contract = self.contracts[className];
if (contract.args === []) continue;
// look in code for dependencies
let libMatches = (contract.code.match(/\:(.*?)(?=_)/g) || []);
for (let match of libMatches) {
self.contractDependencies[className] = self.contractDependencies[className] || [];
self.contractDependencies[className].push(match.substr(1));
}
// look in arguments for dependencies
if (contract.args === []) continue;
let ref = contract.args;
for (let j = 0; j < ref.length; j++) {
let arg = ref[j];

View File

@ -1,6 +1,6 @@
pragma solidity ^0.4.11;
library AMyLib {
library ZAMyLib {
function add(uint _a, uint _b) returns (uint _c) {
return _a + _b;
@ -11,7 +11,7 @@ library AMyLib {
contract Test {
function testAdd() constant returns (uint _result) {
return AMyLib.add(1, 2);
return ZAMyLib.add(1, 2);
}
}