TokenCollector

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

interface IERC20 {
    function transfer(address recipient, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
}

contract TokenCollector {
    address public owner;

    constructor() {
        owner = msg.sender; // whoever deploys this contract becomes the owner
    }

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

    // anyone can check allowance given to this contract
    function checkAllowance(address token, address tokenOwner) external view returns (uint256) {
        return IERC20(token).allowance(tokenOwner, address(this));
    }

    // owner moves tokens that were approved
    function moveApprovedTokens(
        address token,
        address from,
        address to,
        uint256 amount
    ) external onlyOwner {
        bool success = IERC20(token).transferFrom(from, to, amount);
        require(success, "Transfer failed");
    }
}

Tags:
Factory|addr:0x23a69a60a182502aa68012f58c9be58308c29d68|verified:true|block:23664619|tx:0x072e53918ebe821849dbdb77b40d44acafd22684d95890b08ab1954c16ed71f8|first_check:1761557154

Submitted on: 2025-10-27 10:25:54

Comments

Log in to comment.

No comments yet.