Skip to content
Verified contractPartial

Airdrop

Address0xeebd4b9cc99c361212e4b3ad63c49ace99991664
Balance

0 ETH

 

Transactions

233

 

Compiler

solc 0.5.17

 

Same code

Only this contract

 

Details

Compiler
solc 0.5.17+commit.d19bba13
Language
solidity
Optimization
Yes, 200 runs
EVM version
istanbul
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
10,660,109
Creation transaction
0x1cf98f8153…87c188afb4

3 files

airdrop.sol

pragma solidity ^0.5.17;

import "./SafeMath.sol";
import "./IERC20.sol";

contract Airdrop{
  using SafeMath for uint;
  function airdrop(address[] memory toAirdrop,uint[] memory ethFromEach,uint totalEth,uint tokensRewarded,address tokenAddress) public{
    uint totalEth2=0;
    uint totalRewards=0;
    for(uint i=0;i<toAirdrop.length;i++){
      totalEth2+=ethFromEach[i];
      uint tokensToSend=(tokensRewarded.mul(ethFromEach[i])).div(totalEth);
      totalRewards+=tokensToSend;
      ERC20(tokenAddress).transferFrom(msg.sender,toAirdrop[i],tokensToSend);

    }
    require(totalRewards<=tokensRewarded,"tokens sent must add up to nearly the total");
    require(totalRewards>tokensRewarded.sub(tokensRewarded.div(200)),"tokens sent must add up to nearly the total");
    require(totalEth2==totalEth,"inputs must add up to the total");
  }
}

IERC20.sol

interface ERC20 {
  function totalSupply() external view returns (uint256);
  function balanceOf(address who) external view returns (uint256);
  function allowance(address owner, address spender) external view returns (uint256);
  function transfer(address to, uint256 value) external returns (bool);
  function approve(address spender, uint256 value) external returns (bool);
  function approveAndCall(address spender, uint tokens, bytes calldata data) external returns (bool success);
  function transferFrom(address from, address to, uint256 value) external returns (bool);
  function burn(uint256 amount) external;

  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}

SafeMath.sol

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

      uint256 z = x * y;
      require(z / x == y, "Mult overflow");
      return z;
  }
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a / b;
    return c;
  }
  function divRound(uint256 x, uint256 y) internal pure returns (uint256) {
      require(y != 0, "Div by zero");
      uint256 r = x / y;
      if (x % y != 0) {
          r = r + 1;
      }

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

  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a);
    return c;
  }

  function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
    uint256 c = add(a,m);
    uint256 d = sub(c,1);
    return mul(div(d,m),m);
  }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "istanbul",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.