treat library as dependencies for contract deployment
This commit is contained in:
parent
48f9c54d9d
commit
c02e3e7ab8
|
@ -138,8 +138,15 @@ class ContractsManager {
|
||||||
for (className in self.contracts) {
|
for (className in self.contracts) {
|
||||||
contract = self.contracts[className];
|
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;
|
let ref = contract.args;
|
||||||
for (let j = 0; j < ref.length; j++) {
|
for (let j = 0; j < ref.length; j++) {
|
||||||
let arg = ref[j];
|
let arg = ref[j];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
pragma solidity ^0.4.11;
|
pragma solidity ^0.4.11;
|
||||||
|
|
||||||
library AMyLib {
|
library ZAMyLib {
|
||||||
|
|
||||||
function add(uint _a, uint _b) returns (uint _c) {
|
function add(uint _a, uint _b) returns (uint _c) {
|
||||||
return _a + _b;
|
return _a + _b;
|
||||||
|
@ -11,7 +11,7 @@ library AMyLib {
|
||||||
contract Test {
|
contract Test {
|
||||||
|
|
||||||
function testAdd() constant returns (uint _result) {
|
function testAdd() constant returns (uint _result) {
|
||||||
return AMyLib.add(1, 2);
|
return ZAMyLib.add(1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue