Post
Share your knowledge.
Forge Create Command Error with Ganache on Windows WSL
I encountered an error while running the command 'forge create SimpleStorage --rpc-url http://127.0.0.1:8545 --interactive' on Windows Subsystem for Linux (WSL) with Ganache. The error message indicates a connection issue with the RPC server. I have successfully installed Ganache and switched to WSL. Are there any additional configurations or settings I need to adjust in Ganache to resolve this error? Any insights or guidance would be greatly appreciated.
error
'''Compiling... No files changed, compilation skipped Error: error sending request for url (http://127.0.0.1:8545/): error trying to connect: tcp connect error: Connection refused (os error 111)'''
- Solidity
- Blockchain
Answers
1This is the crowdfunding/funding smart contract where multiple people can give funding to this smart contract and the authority/owner can get the funds out of the contract whenever they want(no other user has the power to withdraw funds).
Now in the withdrawal, we are resetting both the array and the mapping because we want to remove the previous record once the owner gets the funds out of contract for this round.
Now your question is that it only works for 1 user. So the answer is, it is intentionally created this way so the only owner can get funds out of the smart contract.
If let's say funders are the owner and any other user, and both gave 1 ETH each and now the contract has 2 ETH deposited. The owner will call the withdraw function which gives the 2 ETH to the owner and reset both array and mappings.
After that new round will be initiated and new funding will be raised.
Do you know the answer?
Please log in and share it.
Cyfrin Updraft is an education platform specializing on teaching the next generation of smart contract developers