Verified contractPartialUNLICENSED
CloneTarget
Address0x39778bc77bd7a9456655b19fd4c5d0bf2071104e
- Balance
0.000881 ETH
- Transactions
6
- Compiler
solc 0.5.16
- Same code
Only this contract
Details
- Compiler
- solc 0.5.16+commit.9c3226ce
- Language
- solidity
- Optimization
- Yes, 1,000 runs
- EVM version
- istanbul
- License
- UNLICENSED
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 9,872,832
- Creation transaction
- 0x2cb5b8ea5a…99d1f28b73
src/CloneTarget.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.5.16;
/// @notice Minimal ERC-20 interface used for balance queries and token sweeps.
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
}
/// @title CloneTarget
/// @notice Implementation contract for EIP-1167 deposit clones controlled by the authorized sweeper.
contract CloneTarget {
/// @notice Address of the authorized sweeper and sweep recipient.
address payable public constant sweeper = 0x5f65f7b609678448494De4C87521CdF6cEf1e932;
event ReceivedEther(address sender, uint256 amount);
event CallWithDataSuccess(address target, bytes data, bytes returnData);
event CallWithDataFailure(address target, bytes data, bytes returnData);
modifier onlySweeper() {
require(msg.sender == sweeper, "unauthorized");
_;
}
/// @notice Logs incoming ETH deposits when `msg.value` is non-zero.
function() external payable {
if (msg.value != 0) {
emit ReceivedEther(msg.sender, msg.value);
}
}
/// @notice Sweeps the entire ETH balance of the contract to `sweeper`.
function sweepEther() external onlySweeper {
uint256 balance = address(this).balance;
sweeper.transfer(balance);
}
/// @notice Executes an arbitrary call on `target` and logs success or failure with return data.
function executeCallWithData(address target, bytes calldata data) external onlySweeper {
(bool success, bytes memory returnData) = target.call(data);
if (success) {
emit CallWithDataSuccess(target, data, returnData);
} else {
emit CallWithDataFailure(target, data, returnData);
}
}
/// @notice Sweeps the entire `token` balance to `sweeper` and attempts an unlimited approval.
function sweepERC20(address token) external onlySweeper {
IERC20 erc20 = IERC20(token);
uint256 balance = erc20.balanceOf(address(this));
require(erc20.transfer(sweeper, balance), "transfer false");
// Intentionally ignores return value (some tokens like USDT omit bool return); matches deployed bytecode.
token.call(abi.encodeWithSignature("approve(address,uint256)", sweeper, uint256(-1)));
}
}
Compiler settingsShow
{
"metadata": {
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 1000,
"enabled": true
},
"evmVersion": "istanbul",
"remappings": [
"forge-std/=lib/forge-std/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.