Can a smart contract B force a revert on receiving eth from another contract A and bug this contract? Is sending eth safe generally for a smart contract if the receiver is a contract address?
Nov 29, 2023, 9:27 PM
That's the default behaviour of a contract. It cannot receive eth unless there's a receive,fallback or any payable function
Nov 29, 2023, 10:02 PM
that's not my question. Does sending eth to a contract like this would result in a revert from sending contract or not, and generally is sending ether to another contract a safe operation from the sender perspective (can it bug the code of sending contract) by forcing a revert for example
Nov 29, 2023, 10:05 PM
Uhh... Isn't that what I just answered. You simply cannot send eth to a contract from an eoa/another contract if the receiver contract doesn't explicitly have fallback/receive function implemented
Nov 29, 2023, 10:08 PM
you can revert by specifying it in the fallback function, but you can still be forced to receive it if it does get sent with selfdestruct.
Nov 29, 2023, 11:42 PM
Apart from forcing ether into a contract bypassing fallbacks
Nov 30, 2023, 2:02 AM
Contract A will selfdestruct before call to contract B gets reverted?
Nov 30, 2023, 5:31 AM
Still not my question
You can revert in B sure but can you force A to revert from B
Nov 30, 2023, 7:08 AM
It doesn't get reverted with selfdestruct
Nov 30, 2023, 7:37 AM
so yeah apparently it does cause a revert in contract A. i assumed ether transfers were of a different nature than external function calls. That's really dangerous if your contract logic has to transfer succesfully to be able to go on. The next step is to prevent sending ether to a smart contract
is require(msg.sender == tx.origin) sufficient to guarantee 100% the caller isn't a contract
Nov 30, 2023, 8:27 AM
No
Nov 30, 2023, 8:33 AM
so what are the options left to prevent a smart contract from interacting with a function
Nov 30, 2023, 9:13 AM