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?
Asked
Active
Viewed 98 times
0
-
Read: https://ethereum.stackexchange.com/questions/63987/can-a-contract-with-no-payable-function-have-ether – matank001 Oct 12 '22 at 12:17
-
1Does this answer your question? Can a contract with no payable function have ether? – matank001 Oct 12 '22 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 Oct 15 '22 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. – Bobby Sebastian Oct 19 '22 at 06:16
-
@matank001 i understand there are certain ways to force ether but was looking for why contracts cant receive ether like EOA. – Bobby Sebastian Oct 19 '22 at 06:19