foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Compile solidity scripts

Open kelcheone opened this issue 2 years ago • 3 comments

Component

Forge

Describe the feature you would like

Now that foundry supports scripting for deployments it would be trivial for the forge build command to also compile solidity files found in the scripts folder.

Additional context

No response

kelcheone avatar Jun 26 '22 20:06 kelcheone

I'm unsure what the use case for this is, given scripts are assumed to use cheatcodes which would not be deployable in a live environment. When you run a script it is built already. Can you expand on the use case?

onbjerg avatar Jun 27 '22 06:06 onbjerg

Yes, you can classify this as nice to have it has no big inherent use case for most people. But when writing large deployments scripts for someone who might not be native to solidity is like doing it in a black box without knowing it the code compiles or doesn't.

kelcheone avatar Jun 27 '22 08:06 kelcheone

Just to weigh in on this. One of the inherent advantages solidity scripting provides over using another language is the tight integration with the src/ contracts. This gives you type-safety (to the extend solidity can provide).

If we agree that ever commit should be compileable and not broken, then it is critical to ensure your scripts compile after any src/ change. Building scripts/ on forge build will help eliminate drift and catch breaking changes earlier.

OliverNChalk avatar Jul 13 '22 23:07 OliverNChalk