foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Documentation needed: cannot deploy contract with linked libraries using deployCode

Open Pet3ris opened this issue 2 years ago • 1 comments

Component

Forge

Describe the feature you would like

I need to deploy a contract with an incompatible version number to my test script. The natural solution is to use deployCode, however, this contract also requires certain libraries. The following leads to an error:

address factory = deployCode(
  “Factory.sol”,
  abi.encode(arg1)
);

Error:

[FAIL. Reason: Setup failed: No bytecode for contract. Is it abstract or unlinked?]

It's a known limitation that deployCode doesn't support library linking which prevents the Factory contract from being deployed.

What is the best alternative for deploying a contract that needs a unique version number and depends on libraries?

Additional context

No response

Pet3ris avatar Jan 06 '23 12:01 Pet3ris