ETH Price: $2,273.96 (-6.08%)

Contract

0x8B3d70d628Ebd30D4A2ea82DB95bA2e906c71633
 
Transaction Hash
Method
Block
From
To
Transfer Ownersh...95255922020-02-21 8:50:101668 days ago1582275010IN
bZx: Vault
0 ETH0.000192046
Transfer Ownersh...88364432019-10-29 21:46:351783 days ago1572385595IN
bZx: Vault
0 ETH0.000246848
Transfer B Zx Ow...71379902019-01-28 7:20:442057 days ago1548660044IN
bZx: Vault
0 ETH0.0003085710
Transfer B Zx Ow...70729312019-01-15 23:24:102070 days ago1547594650IN
bZx: Vault
0 ETH0.0003085710
Transfer B Zx Ow...70054982019-01-03 21:46:512082 days ago1546552011IN
bZx: Vault
0 ETH0.0004579310
0x6080604070054422019-01-03 21:31:582082 days ago1546551118IN
 Create: BZxVault
0 ETH0.0072734210

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BZxVault

Compiler Version
v0.5.2+commit.1df8f40c

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2019-02-24
*/

/**
 * Copyright 2017–2019, bZeroX, LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0.
 */
 
pragma solidity 0.5.2;


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


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


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   * @notice Renouncing to ownership will leave the contract without an owner.
   * It will not be possible to call the functions with the `onlyOwner`
   * modifier anymore.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function transferOwnership(address _newOwner) public onlyOwner {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}

contract BZxOwnable is Ownable {

    address public bZxContractAddress;

    event BZxOwnershipTransferred(address indexed previousBZxContract, address indexed newBZxContract);

    // modifier reverts if bZxContractAddress isn't set
    modifier onlyBZx() {
        require(msg.sender == bZxContractAddress, "only bZx contracts can call this function");
        _;
    }

    /**
    * @dev Allows the current owner to transfer the bZx contract owner to a new contract address
    * @param newBZxContractAddress The bZx contract address to transfer ownership to.
    */
    function transferBZxOwnership(address newBZxContractAddress) public onlyOwner {
        require(newBZxContractAddress != address(0) && newBZxContractAddress != owner, "transferBZxOwnership::unauthorized");
        emit BZxOwnershipTransferred(bZxContractAddress, newBZxContractAddress);
        bZxContractAddress = newBZxContractAddress;
    }

    /**
    * @dev Allows the current owner to transfer control of the contract to a newOwner.
    * @param newOwner The address to transfer ownership to.
    * This overrides transferOwnership in Ownable to prevent setting the new owner the same as the bZxContract
    */
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0) && newOwner != bZxContractAddress, "transferOwnership::unauthorized");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }
}

interface NonCompliantEIP20 {
    function transfer(address _to, uint256 _value) external;
    function transferFrom(address _from, address _to, uint256 _value) external;
    function approve(address _spender, uint256 _value) external;
}

contract EIP20Wrapper {

    function eip20Transfer(
        address token,
        address to,
        uint256 value)
        internal
        returns (bool result) {

        NonCompliantEIP20(token).transfer(to, value);

        assembly {
            switch returndatasize()   
            case 0 {                        // non compliant ERC20
                result := not(0)            // result is true
            }
            case 32 {                       // compliant ERC20
                returndatacopy(0, 0, 32) 
                result := mload(0)          // result == returndata of external call
            }
            default {                       // not an not an ERC20 token
                revert(0, 0) 
            }
        }

        require(result, "eip20Transfer failed");
    }

    function eip20TransferFrom(
        address token,
        address from,
        address to,
        uint256 value)
        internal
        returns (bool result) {

        NonCompliantEIP20(token).transferFrom(from, to, value);

        assembly {
            switch returndatasize()   
            case 0 {                        // non compliant ERC20
                result := not(0)            // result is true
            }
            case 32 {                       // compliant ERC20
                returndatacopy(0, 0, 32) 
                result := mload(0)          // result == returndata of external call
            }
            default {                       // not an not an ERC20 token
                revert(0, 0) 
            }
        }

        require(result, "eip20TransferFrom failed");
    }

    function eip20Approve(
        address token,
        address spender,
        uint256 value)
        internal
        returns (bool result) {

        NonCompliantEIP20(token).approve(spender, value);

        assembly {
            switch returndatasize()   
            case 0 {                        // non compliant ERC20
                result := not(0)            // result is true
            }
            case 32 {                       // compliant ERC20
                returndatacopy(0, 0, 32) 
                result := mload(0)          // result == returndata of external call
            }
            default {                       // not an not an ERC20 token
                revert(0, 0) 
            }
        }

        require(result, "eip20Approve failed");
    }
}

contract BZxVault is EIP20Wrapper, BZxOwnable {

    // Only the bZx contract can directly deposit ether
    function() external payable onlyBZx {}

    function withdrawEther(
        address payable to,
        uint256 value)
        public
        onlyBZx
        returns (bool)
    {
        uint256 amount = value;
        if (amount > address(this).balance) {
            amount = address(this).balance;
        }

        return (to.send(amount));
    }

    function depositToken(
        address token,
        address from,
        uint256 tokenAmount)
        public
        onlyBZx
        returns (bool)
    {
        if (tokenAmount == 0) {
            return false;
        }

        eip20TransferFrom(
            token,
            from,
            address(this),
            tokenAmount);

        return true;
    }

    function withdrawToken(
        address token,
        address to,
        uint256 tokenAmount)
        public
        onlyBZx
        returns (bool)
    {
        if (tokenAmount == 0) {
            return false;
        }

        eip20Transfer(
            token,
            to,
            tokenAmount);

        return true;
    }

    function transferTokenFrom(
        address token,
        address from,
        address to,
        uint256 tokenAmount)
        public
        onlyBZx
        returns (bool)
    {
        if (tokenAmount == 0) {
            return false;
        }

        eip20TransferFrom(
            token,
            from,
            to,
            tokenAmount);

        return true;
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"to","type":"address"},{"name":"tokenAmount","type":"uint256"}],"name":"withdrawToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"withdrawEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newBZxContractAddress","type":"address"}],"name":"transferBZxOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"bZxContractAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenAmount","type":"uint256"}],"name":"transferTokenFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"from","type":"address"},{"name":"tokenAmount","type":"uint256"}],"name":"depositToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousBZxContract","type":"address"},{"indexed":true,"name":"newBZxContract","type":"address"}],"name":"BZxOwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

608060405260008054600160a060020a031916331790556109a7806100256000396000f3fe6080604052600436106100a3576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100765780638da5cb5b146101c9578063e4a72b13146101fa578063e59949051461020f578063f2fde38b14610258578063fb0f97a81461028b576100a3565b806301e33667146100f1578063522f681514610148578063715018a61461018157806372e98a7914610196575b600154600160a060020a031633146100ef5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b005b3480156100fd57600080fd5b506101346004803603606081101561011457600080fd5b50600160a060020a038135811691602081013590911690604001356102ce565b604080519115158252519081900360200190f35b34801561015457600080fd5b506101346004803603604081101561016b57600080fd5b50600160a060020a038135169060200135610344565b34801561018d57600080fd5b506100ef6103cd565b3480156101a257600080fd5b506100ef600480360360208110156101b957600080fd5b5035600160a060020a0316610439565b3480156101d557600080fd5b506101de61051f565b60408051600160a060020a039092168252519081900360200190f35b34801561020657600080fd5b506101de61052e565b34801561021b57600080fd5b506101346004803603608081101561023257600080fd5b50600160a060020a0381358116916020810135821691604082013516906060013561053d565b34801561026457600080fd5b506100ef6004803603602081101561027b57600080fd5b5035600160a060020a03166105b5565b34801561029757600080fd5b50610134600480360360608110156102ae57600080fd5b50600160a060020a038135811691602081013590911690604001356106b0565b600154600090600160a060020a0316331461031d5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b81151561032c5750600061033d565b61033784848461071a565b50600190505b9392505050565b600154600090600160a060020a031633146103935760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b8130318111156103a1575030315b604051600160a060020a0385169082156108fc029083906000818181858888f198975050505050505050565b600054600160a060020a031633146103e457600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a0316331461045057600080fd5b600160a060020a038116158015906104765750600054600160a060020a03828116911614155b15156104b65760405160e560020a62461bcd02815260040180806020018281038252602281526020018061095a6022913960400191505060405180910390fd5b600154604051600160a060020a038084169216907f275474e6a50395ffcbf8e9ecf8250fc1a6baa73c802ea8809292f5021c9980bf90600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b600154600160a060020a031681565b600154600090600160a060020a0316331461058c5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b81151561059b575060006105ad565b6105a785858585610821565b50600190505b949350505050565b600054600160a060020a031633146105cc57600080fd5b600160a060020a038116158015906105f25750600154600160a060020a03828116911614155b1515610648576040805160e560020a62461bcd02815260206004820152601f60248201527f7472616e736665724f776e6572736869703a3a756e617574686f72697a656400604482015290519081900360640190fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600090600160a060020a031633146106ff5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b81151561070e5750600061033d565b61033784843085610821565b604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03848116600483015260248201849052915160009286169163a9059cbb916044808301928692919082900301818387803b15801561078557600080fd5b505af1158015610799573d6000803e3d6000fd5b505050503d600081146107b357602081146107bd57600080fd5b60001991506107c9565b60206000803e60005191505b5080151561033d576040805160e560020a62461bcd02815260206004820152601460248201527f65697032305472616e73666572206661696c6564000000000000000000000000604482015290519081900360640190fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015284811660248301526044820184905291516000928716916323b872dd916064808301928692919082900301818387803b15801561089457600080fd5b505af11580156108a8573d6000803e3d6000fd5b505050503d600081146108c257602081146108cc57600080fd5b60001991506108d8565b60206000803e60005191505b508015156105ad576040805160e560020a62461bcd02815260206004820152601860248201527f65697032305472616e7366657246726f6d206661696c65640000000000000000604482015290519081900360640190fdfe6f6e6c7920625a7820636f6e7472616374732063616e2063616c6c20746869732066756e6374696f6e7472616e73666572425a784f776e6572736869703a3a756e617574686f72697a6564a165627a7a7230582085e12a768e81aca03bd227e9f1edaa028e75ad086b88d6f957668cc4f18017b80029

Deployed Bytecode

0x6080604052600436106100a3576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100765780638da5cb5b146101c9578063e4a72b13146101fa578063e59949051461020f578063f2fde38b14610258578063fb0f97a81461028b576100a3565b806301e33667146100f1578063522f681514610148578063715018a61461018157806372e98a7914610196575b600154600160a060020a031633146100ef5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b005b3480156100fd57600080fd5b506101346004803603606081101561011457600080fd5b50600160a060020a038135811691602081013590911690604001356102ce565b604080519115158252519081900360200190f35b34801561015457600080fd5b506101346004803603604081101561016b57600080fd5b50600160a060020a038135169060200135610344565b34801561018d57600080fd5b506100ef6103cd565b3480156101a257600080fd5b506100ef600480360360208110156101b957600080fd5b5035600160a060020a0316610439565b3480156101d557600080fd5b506101de61051f565b60408051600160a060020a039092168252519081900360200190f35b34801561020657600080fd5b506101de61052e565b34801561021b57600080fd5b506101346004803603608081101561023257600080fd5b50600160a060020a0381358116916020810135821691604082013516906060013561053d565b34801561026457600080fd5b506100ef6004803603602081101561027b57600080fd5b5035600160a060020a03166105b5565b34801561029757600080fd5b50610134600480360360608110156102ae57600080fd5b50600160a060020a038135811691602081013590911690604001356106b0565b600154600090600160a060020a0316331461031d5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b81151561032c5750600061033d565b61033784848461071a565b50600190505b9392505050565b600154600090600160a060020a031633146103935760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b8130318111156103a1575030315b604051600160a060020a0385169082156108fc029083906000818181858888f198975050505050505050565b600054600160a060020a031633146103e457600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a0316331461045057600080fd5b600160a060020a038116158015906104765750600054600160a060020a03828116911614155b15156104b65760405160e560020a62461bcd02815260040180806020018281038252602281526020018061095a6022913960400191505060405180910390fd5b600154604051600160a060020a038084169216907f275474e6a50395ffcbf8e9ecf8250fc1a6baa73c802ea8809292f5021c9980bf90600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b600154600160a060020a031681565b600154600090600160a060020a0316331461058c5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b81151561059b575060006105ad565b6105a785858585610821565b50600190505b949350505050565b600054600160a060020a031633146105cc57600080fd5b600160a060020a038116158015906105f25750600154600160a060020a03828116911614155b1515610648576040805160e560020a62461bcd02815260206004820152601f60248201527f7472616e736665724f776e6572736869703a3a756e617574686f72697a656400604482015290519081900360640190fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600090600160a060020a031633146106ff5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806109316029913960400191505060405180910390fd5b81151561070e5750600061033d565b61033784843085610821565b604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03848116600483015260248201849052915160009286169163a9059cbb916044808301928692919082900301818387803b15801561078557600080fd5b505af1158015610799573d6000803e3d6000fd5b505050503d600081146107b357602081146107bd57600080fd5b60001991506107c9565b60206000803e60005191505b5080151561033d576040805160e560020a62461bcd02815260206004820152601460248201527f65697032305472616e73666572206661696c6564000000000000000000000000604482015290519081900360640190fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015284811660248301526044820184905291516000928716916323b872dd916064808301928692919082900301818387803b15801561089457600080fd5b505af11580156108a8573d6000803e3d6000fd5b505050503d600081146108c257602081146108cc57600080fd5b60001991506108d8565b60206000803e60005191505b508015156105ad576040805160e560020a62461bcd02815260206004820152601860248201527f65697032305472616e7366657246726f6d206661696c65640000000000000000604482015290519081900360640190fdfe6f6e6c7920625a7820636f6e7472616374732063616e2063616c6c20746869732066756e6374696f6e7472616e73666572425a784f776e6572736869703a3a756e617574686f72697a6564a165627a7a7230582085e12a768e81aca03bd227e9f1edaa028e75ad086b88d6f957668cc4f18017b80029

Swarm Source

bzzr://85e12a768e81aca03bd227e9f1edaa028e75ad086b88d6f957668cc4f18017b8

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.