0

why do smart contracts requires a receive function to accept ether? what prevents the smart contract from receiving ether like an externally owned account(EOA) directly without any functions? What was the design principle behind this?

5
  • Read: ethereum.stackexchange.com/questions/63987/…
    – matank001
    Commented Oct 12, 2022 at 12:17
  • 1
    Does this answer your question? Can a contract with no payable function have ether?
    – matank001
    Commented Oct 12, 2022 at 12:19
  • Mostly for security reason. In very old solidity versions contracts could accept ethers without requiring a fallback function that caused some issues for developers that weren't aware of that feature. Solidity developers decided that in order for a contract to accept payments it should enable it explicitly. It still possible to send ether to contracts without a receive function,.
    – Ismael
    Commented Oct 15, 2022 at 19:21
  • @Ismael thanks i got it. there should be an EIP associated with the change, any idea which one is that? would like go in depth how the check is implemented. Commented Oct 19, 2022 at 6:16
  • @matank001 i understand there are certain ways to force ether but was looking for why contracts cant receive ether like EOA. Commented Oct 19, 2022 at 6:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.