Skip to content

Lesson 4 Testnet Demo 5:01:26 #594

Answered by technophile-04
supaari89 asked this question in Q&A
Discussion options

You must be logged in to vote

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.

    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;
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@supaari89
Comment options

Answer selected by PatrickAlphaC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants