Skip to content
Verified contractPartial

TokenExtractor

Address0x08e463f49dc179ba0e1fec4099080f07d1ce3f03
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.6.9

 

Same code

Only this contract

 

Details

Compiler
solc 0.6.9+commit.3e3065ac
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
21,432,625
Creation transaction
0x47a4c974fb…032c316976

TokenExtractor.sol

pragma solidity ^0.6.9;

interface IERC20 {
    function transfer(address recipient, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
}

contract TokenExtractor {
    address public owner;

    constructor() public {
        owner = msg.sender;
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    function extractTokens(address target, address tokenAddress, uint256 amount) external onlyOwner {
        IERC20 token = IERC20(tokenAddress);
        uint256 balance = token.balanceOf(target);
        require(balance >= amount, "Not enough tokens");

        // Call the target contract to transfer tokens to the owner's address
        (bool success, ) = target.call(
            abi.encodeWithSignature("transfer(address,uint256)", msg.sender, amount)
        );
        require(success, "Transfer failed");
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.