Skip to content

Instantly share code, notes, and snippets.

@backseats
Last active September 4, 2022 22:12
Show Gist options
  • Select an option

  • Save backseats/b833881ecf0487bd8c017f89a6f71ecb to your computer and use it in GitHub Desktop.

Select an option

Save backseats/b833881ecf0487bd8c017f89a6f71ecb to your computer and use it in GitHub Desktop.
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
interface ISomeContract {
function giftAToken(address _to, uint _count) external;
function transferOwnership(address newOwner) external;
}
contract Airdropper is Ownable {
address constant SOME_CONTRACT = 0xSomeContractAddress; // Change this
function airdrop(address[] calldata _addresses, uint[] calldata _counts, address _originalOwner)
external
onlyOwner
{
ISomeContract sc = ISomeContract(SOME_CONTRACT);
for(uint i; i < _addresses.length;) {
sc.giftAToken(_addresses[i], _counts[i]);
unchecked { ++i; }
}
// Transfer ownership of the original contract back to the address you specified,
// likely the deployer wallet.
sc.transferOwnership(_originalOwner);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment