Skip to content

Instantly share code, notes, and snippets.

@chenjia404
Created February 7, 2022 10:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save chenjia404/24a9cf36eaec52ed797858898ebb861f to your computer and use it in GitHub Desktop.
Save chenjia404/24a9cf36eaec52ed797858898ebb861f to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library TransferHelper {
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
}
contract token_address {
constructor(address token,address owner){
token.call(abi.encodeWithSelector(0x4e71d92d));//claim()
TransferHelper.safeTransfer(token,owner,151200000000000000000000000);
selfdestruct(payable(msg.sender));
}
}
//部署这个类
contract batch_claim_token {
constructor(){
}
//调用这个函数,参数就是领取数量
function claim(uint amount) public{
for (uint i = 0; i <amount;i++)
{
new token_address(address(0x1c7E83f8C581a967940DBfa7984744646AE46b29),msg.sender);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment