Lesson 4 Testnet Demo 5:01:26 #594
-
Hi, I am able to send eth and receive, and it shows on on Etherscan however when I continue to add more, only Etherscan shows the additional eth added. When I check with the addressToAmountFunded call, it only shows the amount that I first sent. I'm not sure what I have done. // SPDX-License-Identifier: MIT import "./PriceConverter.sol"; contract FundMe {
function withdraw() public {
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey check your function fund() public payable{
require(msg.value.getConversionRate() >= minimumUsd, "Didn't send enough!");
funders.push(msg.sender);
- addressToAmountFunded[msg.sender] = msg.value;
+ addressToAmountFunded[msg.sender] += msg.value;
} |
Beta Was this translation helpful? Give feedback.
Hey check your
fund
function its should be+=
your fund is not accumulating because you are directly overriding the amount corresponding to that address instead we should add it to the previous amount.