2

Code

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]); } } }

How to use. Please can you tell me what is the format i have to put address and token value to send. I have tried many formats but not worked. token send to multiple addresses in one transaction.

Please can you tell me what is the format i have to put address and token value. I have tried many formats but not worked.

Please

1

I don't think there's a multisend function in the standard ERC20 interface. If you're using a variation of ERC20, please tell us more about it. For implementation of a multisend function check out this post and this post.

  • Thanks for replying sfmiller940. sfmiller94 Code 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]); } } } How to use. Please can you tell me what is the format i have to put address and token value to send. I have tried many formats but not worked. – sam Apr 30 '18 at 8:23
  • How are you calling the Airdrop function? From inside the contract or externally with JavaScript, etc.? Can You share that code? – sfmiller940 Apr 30 '18 at 14:57
  • 1
    Test Coin in this contract ropsten.etherscan.io/address/… Bulk transfer code deployed in this contract ropsten.etherscan.io/address/… Need to transfer Test coin using the bulk transfer. I have tried using myetherwallet.com for bulk transfer. – sam May 1 '18 at 15:56
  • There's alot going on here... But when BulkTransfer.bulkTransfer() calls testcoinerc20.transfer(), the address msg.sender in testcoinerc20.transfer() is the address of the contract BulkTransfer. The address that you use to call BulkTransfer.bulkTransfer() is tx.origin. Does the BulkTransfer contract have a balance in testcoinerc20? If not, then you might want to use tx.origin instead of msg.sender in testcoinerc20.transfer() or use another approach. – sfmiller940 May 1 '18 at 16:53
  • ... or use testcoinerc20.transfer() to transfer the necessary balance to BulkTransfer's address before using bulktransfer. – sfmiller940 May 1 '18 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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