treat library as dependencies for contract deployment
This commit is contained in:
parent
ecab599d00
commit
acee934467
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue