Post
Share your knowledge.
running a script command in VS code for deploying a solidity smart contract on Foundry
I am getting this error while running a solidity script inside VS code for deploying a solidity smart contract "SimpleStorage" on Foundry.
Error:
contract source info format must be `<path>:<contractname>` or `<contractname>`
user@user:~/src$ forge script script/lib/forge-std/DeploySimpleStorage.s.sol```
I found the lib/forge-std library was missing from my installation as I could not find it by exploring on top right.So subsequently installed it by creating Lib folder and then pasted forge-std inside it. I guess wrong path of folder could be the cause of this error. Please help how to set it correctly.
I tried resolving it by copying the DeploySimpleStorage.s.sol and SimpleStorage.sol inside various folders and subfolders but could not make it work. Please help me make it work.
- Smart Contract
- Solidity
Answers
1Hi there, Based on the information you provided, looks like there are two main issues with your project, First please make sure that you've installed foundry correctly, for that visit Foundry Installation Guide.
Now,
The first issue is that it's a best practice to initialize you foundry project using command: forge init project-dir-name --no-commit
This way, you make sure that the forge-std library is installed in you project
The second issue is that you should put your main solidity files (ContractName.sol) into the src/directory, script files (DeployContractName.s.sol) in /script directory and test files (ContractnameTest.t.sol) in test/ directory
BUT you should not put the libraries like forge-std inside these directories !!
If you're new to foundry and solidity development, please watch Patrick Collin's new foundry course on his youtube channel: Lesson 6 Video
Hope to see you soon on the top, let's keep up the hard work :)
Do you know the answer?
Please log in and share it.
Solidity is an object-oriented, high-level language for implementing smart contracts. It is a curly-bracket language designed to target the Ethereum Virtual Machine (EVM).
- My ERC721 contract successfully deploys, but I can't verify the contract's source code with hardhat21
- Solidity and ethers.js Compute Different Addresses from the Same Signature21
- can't understand what are the locations(uint256)22
- How to reverse keccak256 in solidity22
- Clarification on Gas Refunds and Comparison Between "require" and "revert" in Smart Contracts21