-
Here is my solidity code: //SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./PriceConverter.sol";
error notOwner();
contract FundMe {
using PriceConverter for uint256;
uint256 public constant MINIMUMUSD = 50 * 1e18;
address[] public funders;
mapping(address => uint256) addressToAmountfunded;
function fund() public payable{
require(msg.value.getConversionRate() >=MINIMUMUSD, "Did not send enoough eth!");
funders.push(msg.sender);
addressToAmountfunded[msg.sender] = msg.value;
}
address public immutable i_owner;
constructor(){
i_owner = msg.sender;
}
function withdraw() public onlyOwner{
for (uint256 funderIndex = 0;funderIndex < funders.length; funderIndex = funderIndex++){
address funder = funders[funderIndex];
addressToAmountfunded[funder] = 0;
}
funders = new address[](0);
//payable(msg.sender).transfer(address(this).balance);
/*bool sendSuccess = payable(msg.sender).send(address(this).balance);
require(sendSuccess,"Send failed");*/
(bool callSuccess,) = payable(msg.sender).call{value: address(this).balance}("");
require(callSuccess,"Call failed");
}
modifier onlyOwner{
if(msg.sender != i_owner){ revert notOwner();}
//require(msg.sender == i_owner,"Sender is not owner!");
_;
}
receive() external payable {
fund();
}
fallback() external payable {
fund();
}
} Then I get this error
and as you see my wallet seems to be successfully connected. Did anyone run into this problem? |
Beta Was this translation helpful? Give feedback.
Answered by
alfaqi
Jul 18, 2023
Replies: 1 comment 1 reply
-
Instead of using |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ALGOD-SA
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of using
WalletConnect
, useInjected Provider - MetaMask