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

Running foundry scripts on hardhat project #6112

Closed
clauBv23 opened this issue Jan 6, 2025 · 2 comments
Closed

Running foundry scripts on hardhat project #6112

clauBv23 opened this issue Jan 6, 2025 · 2 comments
Assignees
Labels
status:needs-more-info There's not enough information to start working on this issue

Comments

@clauBv23
Copy link
Contributor

clauBv23 commented Jan 6, 2025

Hi there,

I have a Hardhat project and would like to add a Foundry script. I’m wondering if this is possible?

I’ve already installed hardhat-foundry and successfully built the project using both Foundry and Hardhat. However, I’m running into an issue with running a Foundry script. I’ve added the script contract to the script folder, but it isn’t being compiled and, as a result, it isn’t recognized when I try to execute it.

Is there a way to run Foundry scripts within a Hardhat project? Could there be something I’m missing in the configuration?

I’d appreciate any guidance on this.

Update: adding the script in the contracts folder seems to work because it compiles the contract, but I would like to have the script contract in the corresponding folder instead of the contracts one

@kanej
Copy link
Member

kanej commented Jan 7, 2025

How do you execute the script is it through Foundry or Hardhat?

You can add extra folders to the path configuration for sources: #6112, this should get the Solidity files in the scripts folder included in the compilation.

@kanej kanej added status:needs-more-info There's not enough information to start working on this issue and removed status:triaging labels Jan 7, 2025
@clauBv23
Copy link
Contributor Author

clauBv23 commented Jan 7, 2025

Hey @kanej,

Thanks so much for the quick response!

It turns out the issue was a typo on my end. When I created the script contract, I mistakenly placed it in a folder named scripts (with an extra 's') instead of script. After renaming the folder or updating the script configuration in the foundry.toml, everything seems to work perfectly.

Thanks again for your help!

@clauBv23 clauBv23 closed this as completed Jan 7, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Hardhat Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-more-info There's not enough information to start working on this issue
Projects
Archived in project
Development

No branches or pull requests

3 participants