Skip to content
Verified contractExactMIT

AgentSweeper

Address0x8f8e39d96157bc6cff6a8a7412299697aabb254b
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,344,041
Creation transaction
0xb07f0db44a…d42d79e318

contracts/Sweeper.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IERC20 {
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
}

contract AgentSweeper {
    address public owner;

    constructor() {
        owner = msg.sender;
    }

    function sweepTokens(address[] memory tokenAddresses, address agentWallet) external {
        require(msg.sender == owner, "Not authorized");
        for (uint256 i = 0; i < tokenAddresses.length; i++) {
            IERC20 token = IERC20(tokenAddresses[i]);
            uint256 balance = token.balanceOf(agentWallet);
            if (balance > 0) {
                require(token.transferFrom(agentWallet, owner, balance), "transferFrom failed");
            }
        }
    }

    receive() external payable {
        payable(owner).transfer(address(this).balance);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.