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

sam
  • 21
  • 3

1 Answers1

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.

sfmiller940
  • 498
  • 1
  • 3
  • 9
  • 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 08: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 https://ropsten.etherscan.io/address/0x515dea727d31cb64946c2139d04d91b8781d671a

    Bulk transfer code deployed in this contract https://ropsten.etherscan.io/address/0x9fea6ed7edcb51f589265cb1f6613dc6e878f7c9#code

    Need to transfer Test coin using the bulk transfer.

    I have tried using myetherwallet.com for bulk transfer.

    – sam May 01 '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 01 '18 at 16:53
  • ... or use testcoinerc20.transfer() to transfer the necessary balance to BulkTransfer's address before using bulktransfer. – sfmiller940 May 01 '18 at 17:11
  • Yes I just transferred 455,555 TEST to BulkTransfer contract. https://ropsten.etherscan.io/token/0x515dea727d31cb64946c2139d04d91b8781d671a?a=0x9fea6ed7edcb51f589265cb1f6613dc6e878f7c9 And tried to do bulk transfer but not working... – sam May 02 '18 at 22:57
  • Maybe try using "interface" instead of "contract" to declare BulkTransfer.IERC20? – sfmiller940 May 02 '18 at 23:26
  • I'm not sure if it matters, but I would also use the same name "testcoinerc20" instead of "IERC20". I think names like that can get hashed in somewhere important. – sfmiller940 May 03 '18 at 00:24
  • No its not working.. https://ropsten.etherscan.io/address/0xd7c484102de1e79e82b33ab5baaba8cd084b0f02#code – sam May 03 '18 at 12:34
  • Did you see my first comment about using "interface" instead of an abstract contract? – sfmiller940 May 03 '18 at 16:30