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

区块链(Web3)开发工程师 2022-09-23 01:14:01 阅读数:480

区块实现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
版权声明:本文为[区块链(Web3)开发工程师]所创,转载请带上原文链接,感谢。 https://blog.csdn.net/qq_28505809/article/details/126975157