Skip to content

Lesson 4: Remix Fund Me #2602

Answered by othaime-en
aviorn36 asked this question in Q&A
Sep 15, 2022 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

Hey @aviorn36 for your contract to receive/hold ETH, there has to be atleast one function marked payable In our case, it was the fund() function. However, in scenarios like the one you have where you want to send funds directly without using the fund function, we need to come up with a default function that sort of receives the funds. In you case, since you didn't set a fallback function, that's why you encountered an error because there is no way contract can sort of, hold/receive the funds you are sending to it. So if you don't want to use the fund function as the main way you send money into this contract, you have to set a payable fallback or receive function that will do just that. I…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@aviorn36
Comment options

@RoboCrypter
Comment options

Comment options

You must be logged in to vote
4 replies
@aviorn36
Comment options

@othaime-en
Comment options

@aviorn36
Comment options

@alymurtazamemon
Comment options

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