SEND ETHER


SEND_TRANSFER_CALL

RECEIVE ETHER


🚀 Receiving Ether in Solidity

When you talk about receiving Ether in a contract, there are three ways that the contract can get funds deposited to it:

1️⃣ Via a payable function

When you write any payable function in Solidity, it can receive Ether.

For example:

function deposit() external payable {
    // user specifically calls deposit() with Ether
    // the Ether goes to the contract's balance
}

payable tells Solidity: this function is willing to accept Ether.

✅ If you leave off payable, the transaction will revert if Ether is sent.


2️⃣ Via the receive() function

If someone sends Ether to the contract address directly, with no data, Solidity needs a way to handle that. That is what receive() is for.

receive() external payable {
    // handles plain ether sent with no data
}

✅ This is triggered if there is no function selector in the call (so the data is empty).