Skip to content
Verified contractExactMIT

TokenRecovery

Address0xabb4be750fabffa24b3624573aa83a4acaaedfa6
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.34

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.34+commit.80d5c536
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
24,867,749
Creation transaction
0x43129c831c…a2a44bcf69

recovery.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract TokenRecovery {
    address public owner;

    constructor() {
        owner = msg.sender;
    }

    function recoverETH() external {
        payable(owner).transfer(address(this).balance);
    }

    function recoverERC20(address token) external {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSignature("balanceOf(address)", address(this))
        );
        require(success, "balanceOf failed");
        uint256 balance = abi.decode(data, (uint256));

        (success, ) = token.call(
            abi.encodeWithSignature("transfer(address,uint256)", owner, balance)
        );
        require(success, "transfer failed");
    }

    function recoverERC721(address token, uint256 tokenId) external {
        (bool success, ) = token.call(
            abi.encodeWithSignature(
                "transferFrom(address,address,uint256)",
                address(this),
                owner,
                tokenId
            )
        );
        require(success, "transfer failed");
    }

    receive() external payable {}
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.