ETH Price: $1,798.63 (-11.96%)

Contract Diff Checker

Contract Name:
AirDrop

Contract Source Code:

File 1 of 1 : AirDrop

// File: openzeppelin-solidity/contracts/ownership/Ownable.sol

pragma solidity ^0.4.23;


/**
 * @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.
   */
  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;
  }
}

// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol

pragma solidity ^0.4.23;


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}

// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol

pragma solidity ^0.4.23;



/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender)
    public view returns (uint256);

  function transferFrom(address from, address to, uint256 value)
    public returns (bool);

  function approve(address spender, uint256 value) public returns (bool);
  event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
  );
}

// File: sc-library/contracts/ERC223/ERC223Receiver.sol

pragma solidity ^0.4.23;


/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223Receiver {
  /**
   * @dev Standard ERC223 function that will handle incoming token transfers.
   *
   * @param _from  Token sender address.
   * @param _value Amount of tokens.
   * @param _data  Transaction metadata.
   */
  function tokenFallback(address _from, uint _value, bytes _data) public;
}

// File: contracts/AirDrop.sol

pragma solidity ^0.4.24;





contract AirDrop is Ownable {
    ERC20 public token;
    uint public createdAt;
    constructor(address _target, ERC20 _token) public {
        owner = _target;
        token = _token;
        createdAt = block.number;
    }

    function transfer(address[] _addresses, uint[] _amounts) external onlyOwner {
        require(_addresses.length == _amounts.length);

        for (uint i = 0; i < _addresses.length; i ++) {
            token.transfer(_addresses[i], _amounts[i]);
        }
    }

    function transferFrom(address _from, address[] _addresses, uint[] _amounts) external onlyOwner {
        require(_addresses.length == _amounts.length);

        for (uint i = 0; i < _addresses.length; i ++) {
            token.transferFrom(_from, _addresses[i], _amounts[i]);
        }
    }

    function tokenFallback(address, uint, bytes) public pure {
        // receive tokens
    }

    function withdraw(uint _value) public onlyOwner {
        token.transfer(owner, _value);
    }

    function withdrawToken(address _token, uint _value) public onlyOwner {
        ERC20(_token).transfer(owner, _value);
    }
}

Contract Name:
AirDrop

Contract Source Code:

File 1 of 1 : AirDrop

// File: openzeppelin-solidity/contracts/ownership/Ownable.sol

pragma solidity ^0.4.23;


/**
 * @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.
   */
  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;
  }
}

// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol

pragma solidity ^0.4.23;


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}

// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol

pragma solidity ^0.4.23;



/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender)
    public view returns (uint256);

  function transferFrom(address from, address to, uint256 value)
    public returns (bool);

  function approve(address spender, uint256 value) public returns (bool);
  event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
  );
}

// File: sc-library/contracts/ERC223/ERC223Receiver.sol

pragma solidity ^0.4.23;


/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223Receiver {
  /**
   * @dev Standard ERC223 function that will handle incoming token transfers.
   *
   * @param _from  Token sender address.
   * @param _value Amount of tokens.
   * @param _data  Transaction metadata.
   */
  function tokenFallback(address _from, uint _value, bytes _data) public;
}

// File: contracts/AirDrop.sol

pragma solidity ^0.4.24;





contract AirDrop is Ownable {
    ERC20 public token;
    uint public createdAt;
    constructor(address _target, ERC20 _token) public {
        owner = _target;
        token = _token;
        createdAt = block.number;
    }

    function transfer(address[] _addresses, uint[] _amounts) external onlyOwner {
        require(_addresses.length == _amounts.length);

        for (uint i = 0; i < _addresses.length; i ++) {
            token.transfer(_addresses[i], _amounts[i]);
        }
    }

    function transferFrom(address _from, address[] _addresses, uint[] _amounts) external onlyOwner {
        require(_addresses.length == _amounts.length);

        for (uint i = 0; i < _addresses.length; i ++) {
            token.transferFrom(_from, _addresses[i], _amounts[i]);
        }
    }

    function tokenFallback(address, uint, bytes) public pure {
        // receive tokens
    }

    function withdraw(uint _value) public onlyOwner {
        token.transfer(owner, _value);
    }

    function withdrawToken(address _token, uint _value) public onlyOwner {
        ERC20(_token).transfer(owner, _value);
    }
}

Context size (optional):