Last active
September 4, 2022 22:12
-
-
Save backseats/b833881ecf0487bd8c017f89a6f71ecb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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