Bài viết
Chia sẻ kiến thức của bạn.
Aug 15, 2023
Thảo Luận
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
0
1
Chia sẻ
Bình luận
Câu trả lời
1Daniel37
Aug 18 2023, 06:18I think it wants not just file name but also the name of your script contract.
See example here: https://book.getfoundry.sh/tutorials/solidity-scripting
File is NFT.s.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Script.sol";
import "../src/NFT.sol";
contract MyScript is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
NFT nft = new NFT("NFT_tutorial", "TUT", "baseUri");
vm.stopBroadcast();
}
}
And the command to run that script is following:
# To load the variables in the .env file
source .env
# To deploy and verify our contract
forge script script/NFT.s.sol:MyScript --rpc-url $GOERLI_RPC_URL --broadcast --verify -vvvv
0
Bình luận
Bạn có biết câu trả lời không?
Hãy đăng nhập và chia sẻ nó.
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).
39Bài viết48Câu trả lời
Kiếm phần của bạn từ 1000 Sui
Tích lũy điểm danh tiếng và nhận phần thưởng khi giúp cộng đồng Sui phát triển.
Bài viết nổi bật
- My ERC721 contract successfully deploys, but I can't verify the contract's source code with hardhat21
- Solidity và ethers.js Tính toán các địa chỉ khác nhau từ cùng một chữ ký21
- không thể hiểu các vị trí là gì (uint256)22
- Làm thế nào để đảo ngược keccak256 trong độ rắn22
- Làm rõ về hoàn tiền gas và so sánh giữa “yêu cầu” và “hoàn lại” trong hợp đồng thông minh21