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”.

2 Likes

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?

Good day Filip,
Now that I’m finished with my airdrops portion of the course and the NEM blockchain section is deprecated. What now?

Then you are done with the Smart Contract Programming course. Congrats! As you might have noticed, all the EOS content has been moved away from that course into 2 separate courses. So now you have 2 additional EOS courses that are included for you as well, if you want to learn other blockchains.

If you want to continue on your Solidity journey I would recommend that you first of all, code something on your own, and then continue with our Ethereum Smart Contract Security course.

1 Like