Verified contractPartialMIT
SendAllETH
Address0x4aae61bdf428ad56b1dc3bba16da0c051d74e079
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,123,420
- Creation transaction
- 0xaa26a645f0…85d5cae6ed
SendAllETH.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract SendAllETH {
event ETHSent(
address indexed sender,
address indexed recipient,
uint256 amount
);
/**
* Sends all ETH attached to this transaction to `recipient`.
*
* The caller pays the gas.
* `msg.value` is the amount forwarded to the recipient.
*/
function sendAll(address payable recipient) external payable {
require(recipient != address(0), "Invalid recipient");
require(msg.value > 0, "No ETH sent");
(bool success, ) = recipient.call{value: msg.value}("");
require(success, "ETH transfer failed");
emit ETHSent(msg.sender, recipient, msg.value);
}
/**
* Accept ETH sent directly to the contract.
*/
receive() external payable {}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.