0

enter image description hereHi guys quick and simple question....

i have the script for airdropping tokens, all i need is to know what and how to input these value on the drop section of remix script:token,recipient,values.

Assuming i want to send to 5 addresses, please respond with a sample that we can copy and paste into the fields...

No much grammer neede thank you

see what i mean below

help

1

This is what you want to enter in your contract argument fields.

token field: "Address of the token contract"
recipients field: ["address1", "address2", "address3", "address4, address5"]
values field: [1,2,3,4,5]

I'm updating my answer after you've provided code. your code is insecure. Below I've made you a simple airdrop contract, I'm sure you spot the differences.

    contract AirDrop is Owned {
    using SafeMath for uint256;

    uint8   public constant DECIMALS = 18;
    uint256 public constant DECIMALFACTOR = 10 ** uint256(DECIMALS);
    uint256 public AIRDROP_SUPPLY = 10000000 * uint256(DECIMALFACTOR);
    uint256 public TOTAL_SUPPLY = 1000000000000 * uint256(DECIMALFACTOR);
    uint256 public claimedTokens = 0;

    AirdropToken public airdropToken;

    mapping (address => bool) public airdropReceivers;

    event AirDropped (
        address[] _recipients, 
        uint256 _amount, 
        uint256 claimedTokens);

    constructor() public {
        airdropToken = new AirdropToken(this);
    }

    function airDrop(address[] _recipients, uint256 _amount) external onlyOwner {
        require(_amount > 0);
        uint256 airdropped;
        uint256 amount = _amount * uint256(DECIMALFACTOR);
        for (uint256 index = 0; index < _recipients.length; index++) {
            if (!airdropReceivers[_recipients[index]]) {
                airdropReceivers[_recipients[index]] = true;
                airdropToken.transfer(_recipients[index], amount);
                airdropped = airdropped.add(amount);
            }
        }
    AIRDROP_SUPPLY = AIRDROP_SUPPLY.sub(airdropped);
    TOTAL_SUPPLY = TOTAL_SUPPLY.sub(airdropped);
    claimedTokens = claimedTokens.add(airdropped);
    emit AirDropped(_recipients, _amount, claimedTokens);
    }
}
  • Thank you for your response. The value field, does it represent how many tokens that will be sent to each address? e.g [1,2,3,4,5] could mean, 100,200,200,300,400 tokens to each address? – souljay May 12 '18 at 2:37
  • This is what i got after trying it as i specified above, – souljay May 12 '18 at 3:01
  • It shows as if i created a contract on etherscan instead of showing me that i sent out tokens – souljay May 12 '18 at 3:02
  • how do ispecify the amount of tokes to go to each address? – souljay May 12 '18 at 3:05
  • Without knowing the code, I highly believe that the value field represents how many tokens will be sent to each address, here you can place the amount you want to send, I just showed you a template of how to do it properly. If it is not working, then show the code of the script. – phant0m May 12 '18 at 7:10
0

That contract is insecure. Anyone can call it, and airdrop all the tokens to themselves. Do not send any tokens to it unless you're OK with losing them.

  • Thank you James, Please how can i get a secure contract.....to airdrop the tokens.... any suggestions? – souljay May 12 '18 at 8:40
  • The simplest way would be to add require(msg.sender == 0xyouraddress);. Or you could reuse the Ownable mixin from Zeppelin, and make the function onlyOwner, which amounts to the same thing. – James_pic May 12 '18 at 10:22
  • 1
    check my edited answer for an example of a airdrop contract. – phant0m May 12 '18 at 10:25
0

Some days ago I can't do exactly that you want from Remix: pass array to function params. But I have can do this with https://www.myetherwallet.com/ (MEW)

  1. Go to the Contract page (https://www.myetherwallet.com/#contracts )
  2. In Contract Address field point to your deployed contract
  3. In ABI/JSON Interface field insert ABI, you can take it from remix (Compile page-Details button-ABI section)
  4. Push Access button
  5. Chois your airdrop method from dropdown box
  6. In the field below you will see to fields for your params And now !!!!! atention!!!! put your addresses and amounts without [ ], just comma.

Look like this. enter image description here Then connect to your wallet and push write.

In this example there is not airdrop method, but there is multiTransfer - it's same, you can see here https://rinkeby.etherscan.io/address/0x0db720da802ea43ba7e725c868cd6fed2db06a9c#code

  • rinkeby.etherscan.io/address/… – souljay May 12 '18 at 17:20
  • I have tried this but i think the problem is the ABI code copied from Remix,i can see the multitransfer option and have actually executed it,it said the transaction was successful,but it failed on etherscan. Am I supposed to get an ABI that is particular for my token or will i just use that of Cryptoindex100(because i noticed that it has the multitransfer it has the multi transfer option. – souljay May 12 '18 at 17:27
  • etherscan.io/tx/…. I am almost through,pls dont give up on me – souljay May 12 '18 at 17:27

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.