Skip to content
Verified contractPartial

TokenBooksAirdrop

Address0xc5cfbad9210cedc3109b532d4fe1a4ef268af2f1
Balance

0 ETH

 

Transactions

142

 

Compiler

solc 0.4.22

 

Same code

Only this contract

 

Details

Compiler
solc 0.4.22+commit.4cb486ee
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
5,672,705
Creation transaction
0xe81ab9dfc9…b8fa3209c2

TokenBooksAirdrop.sol

pragma solidity ^0.4.13;


contract ERC20Basic {
  uint256 public totalSupply;
  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);
}

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);
}
contract Ownable {
  address public owner;


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


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() 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 transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}

library SafeMath {
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}
contract TokenBooksAirdrop is Ownable{
	using SafeMath for uint256;

	function TokenBooksAirdrop(){
	}


    function withdrawCoinToOwner(address tokenAddress ,uint256 _value) external
		onlyOwner
	{
		processFunding(tokenAddress,msg.sender,_value);
	}
	//空投
    function airdrop(address tokenAddress,address [] _holders,uint256 paySize) external
    	onlyOwner 
	{
		ERC20 token = ERC20(tokenAddress);
        uint256 count = _holders.length;
        assert(paySize.mul(count) <= token.balanceOf(this));
        for (uint256 i = 0; i < count; i++) {
			processFunding(tokenAddress,_holders [i],paySize);
        }
    }
	function processFunding(address tokenAddress,address receiver,uint256 _value) internal
	{
		ERC20 token = ERC20(tokenAddress);
		require(_value<=token.balanceOf(this));
		if(!token.transfer(receiver,_value)){
			revert();
		}
	}

	
	function etherProceeds() external
		onlyOwner

	{
		if(!msg.sender.send(this.balance)) revert();
	}

}
Compiler settingsShow
{
  "optimizer": {
    "runs": 0,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.