This applies to any Foundry project that needs to add additional libraries for their contracts besides the default forge-std, openzeppelin-contracts and solidity-bytes-utils submodules.
There are two ways I can add new contract libraries. Neither of these are possible with the extension system currently:
-
Install library to node_modules and then update foundry.toml libs to include node_modules (libs = ['lib', 'node_modules']). Not possible with current template file:
https://github.com/scaffold-eth/create-eth/blob/main/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs
This won't show as a submodule but will still be accessible to the contract.
-
Add the library as a git submodule to ./.gitmodules and update remappings.txt. Neither of those files have template files and as a result are un-alterable in the extension system.
The quickest path to having something workable may be shipping a new default version of foundry.toml that includes node_modules in libs. I think the cleanest long term way of doing this would be to allow the files mentioned in method 2 to be editable.
This applies to any Foundry project that needs to add additional libraries for their contracts besides the default
forge-std,openzeppelin-contractsandsolidity-bytes-utilssubmodules.There are two ways I can add new contract libraries. Neither of these are possible with the extension system currently:
Install library to node_modules and then update foundry.toml
libsto includenode_modules(libs = ['lib', 'node_modules']). Not possible with current template file:https://github.com/scaffold-eth/create-eth/blob/main/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs
This won't show as a submodule but will still be accessible to the contract.
Add the library as a git submodule to
./.gitmodulesand updateremappings.txt. Neither of those files have template files and as a result are un-alterable in the extension system.The quickest path to having something workable may be shipping a new default version of
foundry.tomlthat includesnode_modulesinlibs. I think the cleanest long term way of doing this would be to allow the files mentioned in method 2 to be editable.