Skip to content
Verified contractPartial

Sweeper

Address0xde4d4c5fa500e13997a587e949b903ba27c1bfb2
Balance

0 ETH

 

Transactions

43

 

Compiler

solc 0.4.24

 

Same code

320 more contracts

 

Details

Compiler
solc 0.4.24+commit.e67f0147
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: no, runtime code: yes
Verified on Sourcify
Created in block
6,271,564
Creation transaction
0x30810a2172…b226368209

Sweeper.sol

// Submitted by EthereumHistory (ethereumhistory.com)
pragma solidity ^0.4.24;

contract ERC20 {
    function balanceOf(address _owner) public returns (uint256);
    function transfer(address _to, uint256 _value) public;
    function transferFrom(address _from, address _to, uint256 _value) public;
}

contract Sweeper {
    address public owner;
    address public authorizedCaller;
    bool public halted;
    bool public isPayable;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

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

    modifier onlyAuthorized() {
        require(msg.sender == owner || msg.sender == authorizedCaller);
        _;
    }

    function () public payable {
        if (isPayable == false) {
            revert();
        }
    }

    function sweep(address _token, uint256 _amount) public onlyAuthorized returns (bool) {
        bool ok = false;
        require(_token != address(0) && halted == false);
        ERC20 token = ERC20(_token);
        if (token.balanceOf(this) < _amount) {
            return false;
        }
        token.transfer(msg.sender, _amount);
        return true;
    }

    function sweepFrom(address _token, uint256 _amount) public onlyAuthorized returns (bool) {
        bool ok = false;
        require(_token != address(0) && halted == false);
        ERC20 token = ERC20(_token);
        if (token.balanceOf(this) < _amount) {
            return false;
        }
        token.transferFrom(this, msg.sender, _amount);
        return true;
    }

    function sendEther(address _to, uint256 _amount) public payable onlyAuthorized returns (bool) {
        if (isPayable == false) {
            revert();
        }
        return _to.send(_amount);
    }

    function sweepAll(address _token) public onlyAuthorized returns (bool) {
        bool ok = false;
        require(_token != address(0) && halted == false);
        ERC20 token = ERC20(_token);
        token.transfer(msg.sender, token.balanceOf(this));
        return true;
    }

    function setAcceptEth(bool _value) public onlyOwner {
        isPayable = _value;
    }

    function setHalted(bool _value) public onlyOwner {
        halted = _value;
    }

    function transferAuthorizedCaller(address _newCaller) public onlyOwner {
        require(_newCaller != address(0));
        authorizedCaller = _newCaller;
    }

    function transferOwnership(address _newOwner) public onlyOwner {
        require(_newOwner != address(0));
        emit OwnershipTransferred(owner, _newOwner);
        owner = _newOwner;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.