The first air dropper I created was a semi-auto dropper that required a fair amount of manual data entry. Not ideal, prone to human error and slow. At the time it made sense due to time constraints. For the TIME collaboration drop I wanted to create an air dropper that would be capable of firing off hundreds of tokens in seconds.
Before we dive into the code, I need to say that this article is not going to give you 100% of the Cool Cats’ air dropper source code. It will however cover the theory and point you in the right direction to start work on your own dropper. I do this for two reasons
- I believe an engaged developer that understands every line of their code is more capable of fixing any issues or making changes to fit new scenarios
- Cool Cats needs to have some hidden secrets.
As you read this article and code, please keep in mind that I am pretty new to solidity development and the solutions I come up with might not be the most efficient. Always take the time to do your code due diligence.
Air dropper theory
The idea behind the contract was to essentially act as a wallet. It needed to be capable of:
- receiving tokens
- sending held tokens to addresses
This might seem like an intuitive action — just send tokens to the contract, right? Nope. I tried that and all transactions failed.
After some head scratching and Googling, it hit me. The contract needs to explicitly have token holding capabilities defined:
As I intended to send ERC1155 tokens to the contract it needed to know how to hold them.
The contract is able to receive and hold tokens, awesome, but it needs to do stuff with those tokens, like transfer them.
I had no idea how to do this until I found this code, for an ERC20 token as below:
The key part of this code for me was this line:
Of course, I need to define the token that is being moved around. Duh!
With that epiphany, I created the following function that uses a contract address to define the token and stores the tokenId for later use.
Dropping to addresses
This was the easy part. I simply send 100 addresses and the contract sends tokens to those addresses.
However, I have to stress again that the provided code is not 100% complete. There are situations in which this function will fail. Always make sure to run a full battery of unit tests and account for all edge cases.
Where to find me
I can normally be found in the Cool Cats discord channel
Or on Twitter
I feel silly saying this, but I have had so many messages I feel it might save you and me some time.
I have a full-time job IRL and coupled with Cool Cats I am swamped with work, so sadly I have to decline every job offer.
But I am always willing to help out by sharing resources and advice where I can.