您当前的位置: 首页 >  区块链
  • 1浏览

    0关注

    284博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

区块链(Web3)开发工程师 发布时间:2022-09-21 16:17:14 ,浏览量:1

以太坊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
关注
打赏
1665194163
查看更多评论
立即登录/注册

微信扫码登录

0.0375s