ETH Price: $2,149.85 (+0.24%)

Transaction Decoder

Block:
4582303 at Nov-19-2017 01:18:49 PM +UTC
Transaction Fee:
0.00092344 ETH $1.99
Gas Used:
46,172 Gas / 20 Gwei

Account State Difference:

  Address   Before After State Difference Code
(Ethpool 2)
110.85942195971318158 Eth110.86034539971318158 Eth0.00092344
0x595832F8...b7a361269
0xFBb1b73C...f520fBB98
(Bittrex)
689,376.307780721895140374 Eth
Nonce: 2570105
689,376.306857281895140374 Eth
Nonce: 2570106
0.00092344

Execution Trace

0xecbe450d256828dd2a9978e29b5b04708c2bf150.6ea056a9( )
  • Controller.sweeperOf( _token=0x595832F8FC6BF59c85C527fEC3740A1b7a361269 ) => ( 0xb2233FCEC42c588Ee71A594d9A25AA695345426c )
  • DefaultSweeper.sweep( _token=0x595832F8FC6BF59c85C527fEC3740A1b7a361269, _amount=44458492000 ) => ( True )
    • Controller.CALL( )
    • Controller.CALL( )
    • Controller.CALL( )
    • Controller.CALL( )
    • PowerLedger.balanceOf( _owner=0xECbE450d256828dd2A9978e29B5B04708c2BF150 ) => ( 44458492000 )
    • PowerLedger.transfer( _to=0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98, _value=44458492000 ) => ( True )
    • Controller.logSweep( from=0xECbE450d256828dd2A9978e29B5B04708c2BF150, to=0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98, token=0x595832F8FC6BF59c85C527fEC3740A1b7a361269, amount=44458492000 )
      File 1 of 3: PowerLedger
      pragma solidity 0.4.11;
      
      contract ERC20TokenInterface {
      
          /// @return The total amount of tokens
          function totalSupply() constant returns (uint256 supply);
      
          /// @param _owner The address from which the balance will be retrieved
          /// @return The balance
          function balanceOf(address _owner) constant public returns (uint256 balance);
      
          /// @notice send `_value` token to `_to` from `msg.sender`
          /// @param _to The address of the recipient
          /// @param _value The amount of token to be transferred
          /// @return Whether the transfer was successful or not
          function transfer(address _to, uint256 _value) public returns (bool success);
      
          /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
          /// @param _from The address of the sender
          /// @param _to The address of the recipient
          /// @param _value The amount of token to be transferred
          /// @return Whether the transfer was successful or not
          function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
      
          /// @notice `msg.sender` approves `_spender` to spend `_value` tokens
          /// @param _spender The address of the account able to transfer the tokens
          /// @param _value The amount of tokens to be approved for transfer
          /// @return Whether the approval was successful or not
          function approve(address _spender, uint256 _value) public returns (bool success);
      
          /// @param _owner The address of the account owning tokens
          /// @param _spender The address of the account able to transfer the tokens
          /// @return Amount of remaining tokens allowed to spent
          function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
      
          event Transfer(address indexed from, address indexed to, uint256 value);
          event Approval(address indexed owner, address indexed spender, uint256 value);
      }
      
      contract PowerLedger is ERC20TokenInterface {
      
        //// Constants ////
        string public constant name = 'PowerLedger';
        uint256 public constant decimals = 6;
        string public constant symbol = 'POWR';
        string public constant version = '1.0';
        string public constant note = 'Democratization of Power';
      
        // One billion coins, each divided to up to 10^decimals units.
        uint256 private constant totalTokens = 1000000000 * (10 ** decimals);
      
        mapping (address => uint256) public balances; // (ERC20)
        // A mapping from an account owner to a map from approved spender to their allowances.
        // (see ERC20 for details about allowances).
        mapping (address => mapping (address => uint256)) public allowed; // (ERC20)
      
        //// Events ////
        event MigrationInfoSet(string newMigrationInfo);
      
        // This is to be used when migration to a new contract starts.
        // This string can be used for any authorative information re the migration
        // (e.g. address to use for migration, or URL to explain where to find more info)
        string public migrationInfo = "";
      
        // The only address that can set migrationContractAddress, a secure multisig.
        address public migrationInfoSetter;
      
        //// Modifiers ////
        modifier onlyFromMigrationInfoSetter {
          if (msg.sender != migrationInfoSetter) {
            throw;
          }
          _;
        }
      
        //// Public functions ////
        function PowerLedger(address _migrationInfoSetter) {
          if (_migrationInfoSetter == 0) throw;
          migrationInfoSetter = _migrationInfoSetter;
          // Upon creation, all tokens belong to the deployer.
          balances[msg.sender] = totalTokens;
        }
      
        // See ERC20
        function totalSupply() constant returns (uint256) {
          return totalTokens;
        }
      
        // See ERC20
        // WARNING: If you call this with the address of a contract, the contract will receive the
        // funds, but will have no idea where they came from. Furthermore, if the contract is
        // not aware of POWR, the tokens will remain locked away in the contract forever.
        // It is always recommended to call instead compareAndApprove() (or approve()) and have the
        // receiving contract withdraw the money using transferFrom().
        function transfer(address _to, uint256 _value) public returns (bool) {
          if (balances[msg.sender] >= _value) {
            balances[msg.sender] -= _value;
            balances[_to] += _value;
            Transfer(msg.sender, _to, _value);
            return true;
          }
          return false;
        }
      
        // See ERC20
        function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
          if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value) {
            balances[_from] -= _value;
            allowed[_from][msg.sender] -= _value;
            balances[_to] += _value;
            Transfer(_from, _to, _value);
            return true;
          }
          return false;
        }
      
        // See ERC20
        function balanceOf(address _owner) constant public returns (uint256) {
          return balances[_owner];
        }
      
        // See ERC20
        // NOTE: this method is vulnerable and is placed here only to follow the ERC20 standard.
        // Before using, please take a look at the better compareAndApprove below.
        function approve(address _spender, uint256 _value) public returns (bool) {
          allowed[msg.sender][_spender] = _value;
          Approval(msg.sender, _spender, _value);
          return true;
        }
      
        // A vulernability of the approve method in the ERC20 standard was identified by
        // Mikhail Vladimirov and Dmitry Khovratovich here:
        // https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM
        // It's better to use this method which is not susceptible to over-withdrawing by the approvee.
        /// @param _spender The address to approve
        /// @param _currentValue The previous value approved, which can be retrieved with allowance(msg.sender, _spender)
        /// @param _newValue The new value to approve, this will replace the _currentValue
        /// @return bool Whether the approval was a success (see ERC20's `approve`)
        function compareAndApprove(address _spender, uint256 _currentValue, uint256 _newValue) public returns(bool) {
          if (allowed[msg.sender][_spender] != _currentValue) {
            return false;
          }
          return approve(_spender, _newValue);
        }
      
        // See ERC20
        function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
          return allowed[_owner][_spender];
        }
      
        // Allows setting a descriptive string, which will aid any users in migrating their token
        // to a newer version of the contract. This field provides a kind of 'double-layer' of
        // authentication for any migration announcement, as it can only be set by PowerLedger.
        /// @param _migrationInfo The information string to be stored on the contract
        function setMigrationInfo(string _migrationInfo) onlyFromMigrationInfoSetter public {
          migrationInfo = _migrationInfo;
          MigrationInfoSet(_migrationInfo);
        }
      
        // To be used if the migrationInfoSetter wishes to transfer the migrationInfoSetter
        // permission to a new account, e.g. because of change in personnel, a concern that account
        // may have been compromised etc.
        /// @param _newMigrationInfoSetter The address of the new Migration Info Setter
        function changeMigrationInfoSetter(address _newMigrationInfoSetter) onlyFromMigrationInfoSetter public {
          migrationInfoSetter = _newMigrationInfoSetter;
        }
      }

      File 2 of 3: Controller
      pragma solidity ^0.4.10;
      
      // Copyright 2017 Bittrex
      
      contract AbstractSweeper {
          function sweep(address token, uint amount) returns (bool);
      
          function () { throw; }
      
          Controller controller;
      
          function AbstractSweeper(address _controller) {
              controller = Controller(_controller);
          }
      
          modifier canSweep() {
              if (msg.sender != controller.authorizedCaller() && msg.sender != controller.owner()) throw;
              if (controller.halted()) throw;
              _;
          }
      }
      
      contract Token {
          function balanceOf(address a) returns (uint) {
              (a);
              return 0;
          }
      
          function transfer(address a, uint val) returns (bool) {
              (a);
              (val);
              return false;
          }
      }
      
      contract DefaultSweeper is AbstractSweeper {
          function DefaultSweeper(address controller)
                   AbstractSweeper(controller) {}
      
          function sweep(address _token, uint _amount)
          canSweep
          returns (bool) {
              bool success = false;
              address destination = controller.destination();
      
              if (_token != address(0)) {
                  Token token = Token(_token);
                  uint amount = _amount;
                  if (amount > token.balanceOf(this)) {
                      return false;
                  }
      
                  success = token.transfer(destination, amount);
              }
              else {
                  uint amountInWei = _amount;
                  if (amountInWei > this.balance) {
                      return false;
                  }
      
                  success = destination.send(amountInWei);
              }
      
              if (success) {
                  controller.logSweep(this, destination, _token, _amount);
              }
              return success;
          }
      }
      
      contract UserWallet {
          AbstractSweeperList sweeperList;
          function UserWallet(address _sweeperlist) {
              sweeperList = AbstractSweeperList(_sweeperlist);
          }
      
          function () public payable { }
      
          function tokenFallback(address _from, uint _value, bytes _data) {
              (_from);
              (_value);
              (_data);
           }
      
          function sweep(address _token, uint _amount)
          returns (bool) {
              (_amount);
              return sweeperList.sweeperOf(_token).delegatecall(msg.data);
          }
      }
      
      contract AbstractSweeperList {
          function sweeperOf(address _token) returns (address);
      }
      
      contract Controller is AbstractSweeperList {
          address public owner;
          address public authorizedCaller;
      
          address public destination;
      
          bool public halted;
      
          event LogNewWallet(address receiver);
          event LogSweep(address indexed from, address indexed to, address indexed token, uint amount);
          
          modifier onlyOwner() {
              if (msg.sender != owner) throw; 
              _;
          }
      
          modifier onlyAuthorizedCaller() {
              if (msg.sender != authorizedCaller) throw; 
              _;
          }
      
          modifier onlyAdmins() {
              if (msg.sender != authorizedCaller && msg.sender != owner) throw; 
              _;
          }
      
          function Controller() 
          {
              owner = msg.sender;
              destination = msg.sender;
              authorizedCaller = msg.sender;
          }
      
          function changeAuthorizedCaller(address _newCaller) onlyOwner {
              authorizedCaller = _newCaller;
          }
      
          function changeDestination(address _dest) onlyOwner {
              destination = _dest;
          }
      
          function changeOwner(address _owner) onlyOwner {
              owner = _owner;
          }
      
          function makeWallet() onlyAdmins returns (address wallet)  {
              wallet = address(new UserWallet(this));
              LogNewWallet(wallet);
          }
      
          function halt() onlyAdmins {
              halted = true;
          }
      
          function start() onlyOwner {
              halted = false;
          }
      
          address public defaultSweeper = address(new DefaultSweeper(this));
          mapping (address => address) sweepers;
      
          function addSweeper(address _token, address _sweeper) onlyOwner {
              sweepers[_token] = _sweeper;
          }
      
          function sweeperOf(address _token) returns (address) {
              address sweeper = sweepers[_token];
              if (sweeper == 0) sweeper = defaultSweeper;
              return sweeper;
          }
      
          function logSweep(address from, address to, address token, uint amount) {
              LogSweep(from, to, token, amount);
          }
      }

      File 3 of 3: DefaultSweeper
      pragma solidity ^0.4.10;
      
      // Copyright 2017 Bittrex
      
      contract AbstractSweeper {
          function sweep(address token, uint amount) returns (bool);
      
          function () { throw; }
      
          Controller controller;
      
          function AbstractSweeper(address _controller) {
              controller = Controller(_controller);
          }
      
          modifier canSweep() {
              if (msg.sender != controller.authorizedCaller() && msg.sender != controller.owner()) throw;
              if (controller.halted()) throw;
              _;
          }
      }
      
      contract Token {
          function balanceOf(address a) returns (uint) {
              (a);
              return 0;
          }
      
          function transfer(address a, uint val) returns (bool) {
              (a);
              (val);
              return false;
          }
      }
      
      contract DefaultSweeper is AbstractSweeper {
          function DefaultSweeper(address controller)
                   AbstractSweeper(controller) {}
      
          function sweep(address _token, uint _amount)
          canSweep
          returns (bool) {
              bool success = false;
              address destination = controller.destination();
      
              if (_token != address(0)) {
                  Token token = Token(_token);
                  uint amount = _amount;
                  if (amount > token.balanceOf(this)) {
                      return false;
                  }
      
                  success = token.transfer(destination, amount);
              }
              else {
                  uint amountInWei = _amount;
                  if (amountInWei > this.balance) {
                      return false;
                  }
      
                  success = destination.send(amountInWei);
              }
      
              if (success) {
                  controller.logSweep(this, destination, _token, _amount);
              }
              return success;
          }
      }
      
      contract UserWallet {
          AbstractSweeperList sweeperList;
          function UserWallet(address _sweeperlist) {
              sweeperList = AbstractSweeperList(_sweeperlist);
          }
      
          function () public payable { }
      
          function tokenFallback(address _from, uint _value, bytes _data) {
              (_from);
              (_value);
              (_data);
           }
      
          function sweep(address _token, uint _amount)
          returns (bool) {
              (_amount);
              return sweeperList.sweeperOf(_token).delegatecall(msg.data);
          }
      }
      
      contract AbstractSweeperList {
          function sweeperOf(address _token) returns (address);
      }
      
      contract Controller is AbstractSweeperList {
          address public owner;
          address public authorizedCaller;
      
          address public destination;
      
          bool public halted;
      
          event LogNewWallet(address receiver);
          event LogSweep(address indexed from, address indexed to, address indexed token, uint amount);
          
          modifier onlyOwner() {
              if (msg.sender != owner) throw; 
              _;
          }
      
          modifier onlyAuthorizedCaller() {
              if (msg.sender != authorizedCaller) throw; 
              _;
          }
      
          modifier onlyAdmins() {
              if (msg.sender != authorizedCaller && msg.sender != owner) throw; 
              _;
          }
      
          function Controller() 
          {
              owner = msg.sender;
              destination = msg.sender;
              authorizedCaller = msg.sender;
          }
      
          function changeAuthorizedCaller(address _newCaller) onlyOwner {
              authorizedCaller = _newCaller;
          }
      
          function changeDestination(address _dest) onlyOwner {
              destination = _dest;
          }
      
          function changeOwner(address _owner) onlyOwner {
              owner = _owner;
          }
      
          function makeWallet() onlyAdmins returns (address wallet)  {
              wallet = address(new UserWallet(this));
              LogNewWallet(wallet);
          }
      
          function halt() onlyAdmins {
              halted = true;
          }
      
          function start() onlyOwner {
              halted = false;
          }
      
          address public defaultSweeper = address(new DefaultSweeper(this));
          mapping (address => address) sweepers;
      
          function addSweeper(address _token, address _sweeper) onlyOwner {
              sweepers[_token] = _sweeper;
          }
      
          function sweeperOf(address _token) returns (address) {
              address sweeper = sweepers[_token];
              if (sweeper == 0) sweeper = defaultSweeper;
              return sweeper;
          }
      
          function logSweep(address from, address to, address token, uint amount) {
              LogSweep(from, to, token, amount);
          }
      }