0

I have this code to send a multi-transaction of token in a short airdrop

pragma solidity ^0.4.18;
contract ERC20 {
function transfer(address _recipient, uint256 _value) public returns (bool 
       success);
}

contract Airdrop {
function drop(ERC20 token, address[] recipients, uint256[] values) public {
  for (uint256 i = 0; i < recipients.length; i++) {
    token.transfer(recipients[i], values[i]);
  }
 }
}

I've deployed the contract but while it was successful, no token was received by the recipient. Do you see any errors here?

5
  • After deploying the contract, you must call the function drop with the parameters to have the tokes dropped. Did you do that? provide txn hash for people to check and get back to you
    – Rajesh
    Commented Jun 17, 2018 at 15:59
  • @Rajesh I call the function drop this is the txn 0x993e9ad6fa4fb142c21ea1b6a010ff214ee09470c6dc8f80fe7c664cc8c47ff5 success but there are no Token send in the address I provide I set the token address with the token contract address and the recipient to the recipient and the amount to amount I want but success but not receive
    – ArchDevOps
    Commented Jun 18, 2018 at 11:09
  • Can you also explain how did you execute/call the function? Did you use Remix? Can you also provide how did you pass the parameters? If its remix, you enclose the recipients and values within square bracket, items separated by the comma, surrounded by double quotes.
    – Rajesh
    Commented Jun 18, 2018 at 13:26
  • I create a new contract for this do I need to deploy this airdrop function in the same contract where I create the token? @Rajesh
    – ArchDevOps
    Commented Jun 19, 2018 at 15:30
  • Not required. It can be in a separate contract too. If you pass the parameters incorrectly you would get nothing. So, you will have to check the parameters passing again.
    – Rajesh
    Commented Jun 20, 2018 at 0:12

1 Answer 1

0

This might sound stupid... But did you send the tokens to the air drop contract?

The airdrop co tract will only be able to send the tokens that it (the contract address) holds.

1
  • yes I solve it now
    – ArchDevOps
    Commented Jul 13, 2018 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.