2

I'm writing a smart contract to distribute the created tokens to multiple address. Looking around on the web I may found what I was looking for but I don't know how to insert the addresses in the field; I tried in different ways but none worked. This is the function to distribute token:

function distributeToken(address[] addresses, uint256 _value) onlyOwner {
     for (uint i = 0; i < addresses.length; i++) {
         balances[owner] -= _value;
         balances[addresses[i]] += _value;
         Transfer(owner, addresses[i], _value);
     }
}

and this is the function in the contract:

enter image description here

I tried to insert the addresses in these ways:

0x0000000000000000000000000000000000000001 0x0000000000000000000000000000000000000002 0x0000000000000000000000000000000000000003

['0x0000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000002', '0x0000000000000000000000000000000000000003']

0x0000000000000000000000000000000000000001, 0x0000000000000000000000000000000000000002, 0x0000000000000000000000000000000000000003

but no one worked. How can I solve this? Thank you

  • did it get execute for you? now, if enclosed with double-quote, the warning shows the transaction may fail & all gas will be consumed. And the transaction is passing with single-quote, and not quote, but unable to check the token transfer on the destination accounts. – Rajesh Nov 21 '17 at 6:03
  • Yes, I managed to execute it with double quote. Single quote pass the transaction but don't transfer tokens – user19489 Nov 21 '17 at 9:47
  • You mean, the above function is added to your token contract itself, or in a separate contract? – Rajesh Nov 21 '17 at 9:56
  • The function is in the token contract – user19489 Nov 21 '17 at 13:42
  • it could trigger the gas limitation problem when users try to send to too many addresses – Chinh Phan Aug 21 '18 at 6:16
3

The addresses should be in "s and not 's:


["0x0000000000000000000000000000000000000001", "0x0000000000000000000000000000000000000002", "0x0000000000000000000000000000000000000003"]

I tested this on Remix and it worked fine.

protected by Community Dec 4 '17 at 8:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?