Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Library Linking in Solidity #5642

Closed
mshakeg opened this issue Aug 16, 2023 · 2 comments
Closed

Support for Library Linking in Solidity #5642

mshakeg opened this issue Aug 16, 2023 · 2 comments
Labels
T-feature Type: feature

Comments

@mshakeg
Copy link

mshakeg commented Aug 16, 2023

Component

Forge

Describe the feature you would like

Allow for dynamic library linking within Solidity by adding a libraries field to the contract creation syntax. This would enable linking libraries to contracts during deployment, akin to how it's done in Hardhat. The proposed syntax would be:

string[] memory myContractLibraries = ['src/libraries/MyLibrary.sol:MyLibrary: 0x1230000000000000000000000000000000000abc'];
MyContract myContract = new MyContract{libraries: myContractLibraries}();

Additional context

I initially asked a question on the ethereum stackexchange

The proposed syntax adheres to existing practices within Foundry, requiring a list of strings in the format <libraryPath>:<libraryName>:<libraryAddress>.

This solution aims to bring Foundry's capabilities in line with other popular development environments while maintaining its unique all-Solidity approach.

@mshakeg mshakeg added the T-feature Type: feature label Aug 16, 2023
@gakonst gakonst added this to Foundry Aug 16, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Aug 16, 2023
@mshakeg
Copy link
Author

mshakeg commented Aug 19, 2023

I initially created this issue due to experiencing a problem to similar to that described in foundry-rs/book#1361

However, I have since come up with a temporary workaround, regardless I've confirmed that the expected behaviour would be for foundry to deploy all libraries that a contract depends on and link those libraries automatically before deploying.

However, I still think the ask in this issue would be helpful in the case that the libraries have already been deployed at known addresses and so developers can avoid deploying duplicate libraries. I also like the idea of foundry using deterministic CREATE2 deploys of libraries as explained here.

This issue seems related to #3664

@Evalir
Copy link
Member

Evalir commented Sep 11, 2023

Yep ack—I think we want this on a cheatcode so we don't have to hijack solidity's syntax 😄 Will close to unify these requests on #3664

@Evalir Evalir closed this as completed Sep 11, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

2 participants