【区块链 | Solidity】以太坊Solidity如何实现海量空投代币?

以太坊Solidity如何实现海量空投代币?

1. 摘要

通证token项目启动时,短期内繁荣生态,要舍得给粉丝们打币,把利益分出去。本文聚焦在技术层面,实现如何快速完成TOKEN海量空投,既要节约时间,又要节省TOKEN费用。

2.代码分析

话不多说,直接上代码。

pragma solidity ^0.4.18;

contract Ownable {
  address public owner;

  function Ownable() public {
    owner = msg.sender;
  }

  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }
}

interface Token {
  function balanceOf(address _owner) public constant returns (uint256 );
  function transfer(address _to, uint256 _value) public ;
  event Transfer(address indexed _from, address indexed _to, uint256 _value);
}

contract Airdropper is Ownable {

    function AirTransfer(address[] memory _recipients, uint _values, address _tokenAddress) onlyOwner public returns (bool) {
        require(_recipients.length > 0);

        Token token = Token(_tokenAddress);

        for(uint j = 0; j < _recipient

猜你喜欢

转载自blog.csdn.net/qq_28505809/article/details/126975157