As I understand it, the logic to deploy contract that uses library is as below: supposed that MetaCoin contract use TestLib library

  1. Deploy TestLib library first, then get a library contract address
  2. Get contract bytecodes that links library address by command solc --optimize --bin MetaCoin.sol --libraries "TestLib:<address>"
  3. Deploy MetaCoin contract by the bycodes

The above is the direct way to deploy contract that uses library.

However, how to deploy it in an indirect way? in other words, how to create a contract B that uses a library via contract A? How to link library to contract B?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.