Reputation: 11
When I try to deploy a contract it is showing me this error everytime, please help
Here is the code I am trying to deploy:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
contract MappingWithdrawls{
mapping (address => uint) public balanceReceived;
function sendMoney() public payable {
balanceReceived[msg.sender] += msg.value;
}
function getBalance() public view returns (uint){
return address(this).balance;
}
function withdrawAllmoney(address payable _to) public {
uint balanceToSendOut = balanceReceived[msg.sender];
balanceReceived[msg.sender] = 0;
_to.transfer(balanceToSendOut);
}
}
I am using solidity version 0.8.20 to write the code. Remix Version - Remix 0.34.1 and Ganache Version v2.7.1
Upvotes: 0
Views: 644
Reputation: 11
I got the solution after solidity version 0.8.19 ganache can't deploy the code,, you need to change the version to 0.8.19 to deploy your contract in ganache
Upvotes: 1