All Projects β†’ lordlessio β†’ Airdrop

lordlessio / Airdrop

Licence: mit
🍬 Multiple erc20 token airdrop consumes one time gas

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Airdrop

Erc20 Generator
Create an ERC20 Token for FREE in less than a minute with the most used Smart Contract Generator for ERC20 Token. No login. No setup. No coding required.
Stars: ✭ 202 (+818.18%)
Mutual labels:  truffle, erc20
erc1363-payable-token
Code implementation for the ERC-1363 Payable Token
Stars: ✭ 83 (+277.27%)
Mutual labels:  truffle, erc20
likecoin-contracts
Token contracts of Like Coin
Stars: ✭ 22 (+0%)
Mutual labels:  truffle, erc20
0xdeca10b
Sharing Updatable Models (SUM) on Blockchain
Stars: ✭ 285 (+1195.45%)
Mutual labels:  truffle
Uniswap V1
🐍Uniswap V1 smart contracts
Stars: ✭ 313 (+1322.73%)
Mutual labels:  erc20
Eattheblocks
Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers
Stars: ✭ 431 (+1859.09%)
Mutual labels:  truffle
Eth.social
An Ethereum dApp for posting social events.
Stars: ✭ 17 (-22.73%)
Mutual labels:  truffle
Solidity Idiosyncrasies
Solidity gotchas, pitfalls, limitations, and idiosyncrasies.
Stars: ✭ 267 (+1113.64%)
Mutual labels:  truffle
Typechain
πŸ”Œ TypeScript bindings for Ethereum smart contracts
Stars: ✭ 769 (+3395.45%)
Mutual labels:  truffle
React Ethereum Dapp Example
A starter boilerplate for an Ethereum dapp using web3.js v1.0, truffle, react, and parity
Stars: ✭ 384 (+1645.45%)
Mutual labels:  truffle
Upchain Wallet
δ»₯ε€ͺεŠι’±εŒ…(ζ”―ζŒDApp ζ΅θ§ˆε™¨)- A Powerful Ethereum Android Wallet & DApp Browser
Stars: ✭ 359 (+1531.82%)
Mutual labels:  erc20
Web3j Sample
web3j 样例程序
Stars: ✭ 317 (+1340.91%)
Mutual labels:  erc20
Defi Sdk
DeFi SDK Makes Money Lego Work
Stars: ✭ 440 (+1900%)
Mutual labels:  truffle
Awesome Graal
A curated list of awesome resources for Graal, GraalVM, Truffle and related topics
Stars: ✭ 302 (+1272.73%)
Mutual labels:  truffle
Dapp Boilerplate
πŸŒ€ Decentralize application boilerplate with React Redux and Firebase integration.
Stars: ✭ 6 (-72.73%)
Mutual labels:  truffle
Uniswap V2 Periphery
🎚 Peripheral smart contracts for interacting with Uniswap V2
Stars: ✭ 267 (+1113.64%)
Mutual labels:  erc20
Ethermint Archive
Ethereum on Tendermint using Cosmos-SDK!
Stars: ✭ 667 (+2931.82%)
Mutual labels:  truffle
Eth Gas Reporter
Gas usage per unit test. Average gas usage per method. A mocha reporter.
Stars: ✭ 330 (+1400%)
Mutual labels:  truffle
Truffle eth class2
Stars: ✭ 330 (+1400%)
Mutual labels:  truffle
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+1809.09%)
Mutual labels:  truffle

ERC20 Token Airdrop

Build Status license

Airdrop effect 🍬

Multiple airdrop consumes one time gas FYI : https://etherscan.io/tx/0x061e701609d23e6755253fdb55ed1a31d2b253610b9f478600a0c1ad8b1f178e

source code

pragma solidity ^0.4.21;

import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";


contract Airdrop is Ownable {
  /**
   * @dev daAirdrop to address
   * @param _tokenAddr address the erc20 token address
   * @param dests address[] addresses to airdrop
   * @param values uint256[] value(in ether) to airdrop
   */
  function doAirdrop(address _tokenAddr, address[] dests, uint256[] values) onlyOwner public
    returns (uint256) {
    uint256 i = 0;
    while (i < dests.length) {
      ERC20(_tokenAddr).transferFrom(msg.sender, dests[i], values[i] * (10 ** 18));
      i += 1;
    }
    return(i);
  }


usage

const SimpleToken = artifacts.require('SimpleToken');
const Airdrop = artifacts.require('Airdrop');
const BigNumber = web3.BigNumber;
require('chai')
  .use(require('chai-as-promised'))
  .use(require('chai-bignumber')(BigNumber))
  .should();

contract('Airdrop', function (accounts) {
  before(async function () {
    this.simpleToken = await SimpleToken.new({ from: accounts[0] });
    this.airdrop = await Airdrop.new({ from: accounts[0] });
    this.airdropAmount = 666
    this.mockdata = {
      addresses: accounts,
      tokenAmounts: Array(10).fill(this.airdropAmount.toString()),
    }
  });

  describe('Airdrop basic test', function () {
    it('should airdrop to addresses', async function () {
      await this.simpleToken.approve(this.airdrop.address, 1e27);
      await this.airdrop.doAirdrop(
        this.simpleToken.address,
        this.mockdata.addresses,
        this.mockdata.tokenAmounts
      );
      const balance = (await this.simpleToken.balanceOf(accounts[1])).toNumber();
      await balance.should.be.equal(parseInt(await web3.toWei(this.airdropAmount)));
    });
  });
})

# test

npm run test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].