Skip to content
Verified contractPartial

SweepableWallet

Address0xcc6d2f0fcfbe1e7b5f7bdee014a2764237373183
Balance

0 ETH

 

Transactions

52

 

Compiler

solc 0.4.24

 

Same code

87 more contracts

 

Details

Compiler
solc 0.4.24+commit.e67f0147
Language
solidity
Optimization
Yes, 150 runs
License
Not stated
Match
Partialcreation code: no, runtime code: yes
Verified on Sourcify
Created in block
6,622,381
Creation transaction
0x33f8e7e7c2…f37d781bf6

SweepableWallet.sol

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

contract ERC20Basic {
    function transfer(address to, uint256 value) public;
    function balanceOf(address who) public view returns (uint256);
}

contract SweepableWallet {
    address public owner;

    event Transfer(address indexed token, address indexed to, uint256 value);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor() public {
        owner = msg.sender;
    }

    function transferFrom(address _token, address _to, uint256 _amount) public returns (bool) {
        require(msg.sender == owner || _to == owner);
        require(balanceOf(_token) >= _amount);
        if (address(this) == _token) {
            require(_to.send(_amount));
        } else {
            ERC20Basic(_token).transfer(_to, _amount);
        }
        emit Transfer(_token, _to, _amount);
        return true;
    }

    function balanceOf(address _token) public view returns (uint256) {
        if (address(this) == _token) {
            return _token.balance;
        }
        return ERC20Basic(_token).balanceOf(address(this));
    }

    function transferOwnership(address _newOwner) public {
        require(msg.sender == owner);
        require(_newOwner != address(0));
        emit OwnershipTransferred(owner, _newOwner);
        owner = _newOwner;
    }

    function () public payable {
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 150,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.