Ethereum Airdrop Discussion

Welcome to the thread about Ethereum Airdrop. Here you can discuss everything about the code and potential problems that you might stumble upon.

Hi everybody. Can someone explain to me what the drop function does in the Airdrop contract?
I am a little confused by this simple function and how it is used.

function drop() public {
    token.transferFrom(tokenHolder, msg.sender, amountToTransfer);

The drop function executes the transferFrom function in the token contract. If you look at that function, you will see that it transfers tokens from the “tokenHolder” to msg.sender. The amount will be “amountToTransfer”.


Got it. So it allows the “admin” to make the airdrop to whoever requested it

Yes, if that is how you you configured the airdrop to work. Usually the airdrop is open for everyone and the drop function would be called by anyone wanting the tokens.

tryed recently and had to remove the last part of the abi (so it looks like filips in the video) for the sending of 100 tokens to work just fyi

Is there a way to call the approve function automatically? in a dapp i mean!

What do you mean? You could of course call the function from any server or application “automatically”. In a dapp you could also call that function without user input, if that’s what you mean.

1 Like

Yes, that was i mean! Thank you pal

1 Like

Hi there,

I don’t understand why the airdrop doesn’t work

Any idea?

Could you expand the error message so we can read the details? One issue could for example be that your tokenHolder that you created doesn’t hold any balance. Does it?