1

The contract is 0x1b016Ac4De0996b1f59EaB9c54A083aF496C811D.

For now my token shows no value. I would like each token to start from a value of 0.0001 Eth.

Thanks

5
  • 1
    What do you mean by "add value", in order to get an useful answer please provide sufficient information of your problem and what you want to do. – Jaime May 23 '18 at 14:44
  • For now my token show no value. I would like each token to start from a value of 0.0001 Eth. Thanks Jaime – Patru Douazeci May 23 '18 at 14:48
  • 2
    Create a community. Give the token some utility. Anyone can create an ERC20 token; its value is derived from the project that surrounds it. – Joe Jordan May 23 '18 at 15:54
  • I understand what you are saying Joe, it’s obvious that these are the next steps. What my question was is if I can input a standard starting value of my token. Like, when I will deploy a crowdsale can I add value/token so whenever someone send eth to that address it will return tokens automatically? – Patru Douazeci May 23 '18 at 15:57
  • @PatruDouazeci Such a crowdsale still would not immediately give the token value. Value is derived from people buying and selling at that price. Only buying is not enough. – Jesbus Dec 11 '18 at 15:33
1

The contract you are providing does not allow buying or selling tokens, only transferences. Therefore there is no price to be set.

The example of a token in ethereum.org implements buying and selling of tokens, you may want to take a look at that.

Hope this helps

0

Have a look at the sample crowdsale contract on the official site

There's a function with no name that has the payable modifier:

/**
 * Fallback function
 *
 * The function without name is the default function that is called whenever anyone sends funds to a contract
 */
function () payable {
    require(!crowdsaleClosed);
    uint amount = msg.value;
    balanceOf[msg.sender] += amount;
    amountRaised += amount;
    tokenReward.transfer(msg.sender, amount / price);
    FundTransfer(msg.sender, amount, true);
}

This function is executed when somebody sends ETH to your contract:

  • msg.sender contains the address that sent the ETH
  • msg.value contains the amount sent by msg.sender to your smart contract, in wei

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.