2

I am creating a presale for a new ERC20 token. I have seen various methods and I would like more details about the data field.

Example 1. Bitjob

Address: 0x5e87EDE65d71218d710c6F94b9bfCD9017FB292A
Gas Limit:​ 250000
GWEI (Gas Price): 25
Data:     0x1fb00cdc00000000000000000000000000000000464de6625dfe4f2d83ad09b4886000e6
  1. Target Coin

https://medium.com/@TargetCoin/contribute-to-target-coin-ico-83ba469f0b8a

They state -

Using the Target Coin Coin Smart-contract: ETH only.
0xe9e1E3414800886d5210a3F726947387F662ba2A

But there is no data field. I am a little confused by this.

Has anyone more details about the data field and how this should be used in a presale?

2 Answers 2

1

I guess I have an answer to my question without anyone responding here -

 // fallback function to buy tokens
  function () payable {
     buyTokens(msg.sender);
  }

A fallback is used when the code is run from the address and when the data is specified the 4 four bytes specifies the function.

0

Well you have given some ans to your question, so kudos to you. First of all, fallback function is the default function, i.e., when the contract is called but no data is send, then fallback function is invoked. If you try to send ether to a contract without any data, then the contract will go straight to fallback function(It will be able to receive ether if it is defined as payable otherwise it will throw an exception).

Secondly, it completely depends on the developer what he wants to do during the presale(the code). If theere should be data send along with ether, then a function according to it will be created(as in the case of bitjob), or if it just receives ether(Like the Target Coin or your example), a simple fallback function is enough.

In the end it boils down to how you want to do and what you want to do.

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.