2

Not having issues compiling project. When I truffle migrate I receive this error:

Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  Migrations: 0x60fff93824e024bc3ae45e548138a01e1faa125f
Saving successful migration to network...
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying ConvertLib...
  ConvertLib: 0x50b2d957e2bb477053b362e6d179297c037f53ff
  Linking ConvertLib to MetaCoin
  Deploying MetaCoin...
  MetaCoin: 0xc5bf0d8abb18763eb3be5a5ff5dbe976fb3acff8
  Deploying Node...
Error encountered, bailing. Network state unknown. Review successful         transactions manually.
Error: Node contains unresolved libraries. You must deploy and link the following libraries before you can deploy a new version of Node: ConvertLib
at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:345:17
at process._tickCallback (internal/process/next_tick.js:109:7)

Here is my Node contract (MetaCoin is Ownable):

pragma solidity ^0.4.4;
import "./Relay.sol";
import "./MetaCoin.sol";

contract Node is MetaCoin {

uint public fee;
address public owner;
address[] public publicRelays;

  function Node() {
    owner = msg.sender;
    fee = 10;
  }

  function createRelay () returns (address){
    address relay = new Relay();
    publicRelays.push(relay);
    return relay;
  }
}

Not sure what the issue is. Any help in the right direction would be great. Using Truffle v3.2.1.

Thank you.

1 Answer 1

6

Since you import MetaCoin.sol in Node.sol, and the Node contract inherits from MetaCoin, that means Node.sol includes all the MetaCoin.sol code. This means you need to also link ConvertLib to Node.

The solution is to change this line in your migration:

deployer.link(ConvertLib, MetaCoin)

To this:

deployer.link(ConvertLib, [MetaCoin, Node])

So, in English: "Link Convertlib to MetaCoin and Node."

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.