These are chat archives for ethereum/tutorials

31st
Dec 2017
alexgiul
@alexgiul
Dec 31 2017 07:15
good morning I am testing crowdsale but I got a error when I try to send "ether" in change of tokens
this is the last transaction that failed
I used the same code pubblished here
The problem seems is raised when I invoke the transfer function on the token
barrard
@barrard
Dec 31 2017 10:00
did you create a token and use that address for the crowdsale contract?
alexgiul
@alexgiul
Dec 31 2017 11:55
yes
I modified the code in this way and now works but I really dont why
uint256 tokensForEther = (1/500)*1 ether;

// calculate token amount to be created
uint256 tokens = weiAmount/tokensForEther;
if I replace (1/500) with 1/RATE where RATE is: uint256 public constant RATE = 500; I get the error
Vidor Gencel
@vidorge
Dec 31 2017 12:00
So how much tokens do you want to give for 1 ether?
alexgiul
@alexgiul
Dec 31 2017 12:01
here (just for test) I put 500
I can share the code if it's easier to undestand and explain what happens
do you need the address of contracts?
Vidor Gencel
@vidorge
Dec 31 2017 12:03
msg.value contains the amount of wei that the user sent along with the transaction. You take that number, multiply it by rate ( 500 ) and get the amount of tokens that the user will get. I suppose your token uses 18 decimals just like ethereum, for simplicity
alexgiul
@alexgiul
Dec 31 2017 12:04
well, maybe that is the problem I see 0 decimals to the token
sorry, I set 0 decimals to the token
alexgiul
@alexgiul
Dec 31 2017 12:41
How can I avoid partial token distribution?
ubaka30
@ubaka30
Dec 31 2017 14:01
i copied the code but it did not work
can anyone send me code for creating token
Mehrdad Salimi
@mehrdadphp
Dec 31 2017 15:02
hi
I want to use Api Ethereum with php
help me
alexgiul
@alexgiul
Dec 31 2017 16:06
@ubaka30 have you find your way?
alexgiul
@alexgiul
Dec 31 2017 16:41
This line makes the contract working:
uint256 tokensForEther = (1.0/500)*1 ether;
if I substitute 500 with RATE and define RATE as following:
uint public constant RATE = 500;
I got an error into the transaction
Cole Bradley
@stantoncbradley
Dec 31 2017 20:49
just downloaded the wallet. it won't finish syncing, looks like related to this issue ethereum/mist#2564
anyone else experience this? really a show stopper...
Daighus
@Daighus
Dec 31 2017 21:02
I just downloaded and installed Ethereum wallet, I see and understand the concept of the code(if not the nuances), the pages I read say to copy... fine. I can do that. but where to paste it?
Cole Bradley
@stantoncbradley
Dec 31 2017 21:03
@Daighus Contracts -> Deploy New Contract
Daighus
@Daighus
Dec 31 2017 21:06
Thank you Cole.
No button displayed. Hmm, I suppose I must wait until all downloads are complete.
Cole Bradley
@stantoncbradley
Dec 31 2017 21:08
works for me w/o finishing downloading...
image.png
or are you talking about not being able to deploy?
I think it has to finish downloading so you can send ether to deploy it maybe? I'm new too
Daighus
@Daighus
Dec 31 2017 21:26
@stantoncbradley https://gyazo.com/5d4660587b0ccaa4a66f872cc78999ba <-- what I have so far. So just watching.
Cole Bradley
@stantoncbradley
Dec 31 2017 21:27
ohhhh. ok what I did was quit etheruem wallet. then when you open it again, you have the option to launch the app before it finishes downloading
but, it never finished downloading for me, and you need ether to deploy, which has to sync first. i'm following this tutorial now https://steemit.com/ethereum/@maxnachamkin/how-to-create-your-own-ethereum-token-in-an-hour-erc20-verified
Daighus
@Daighus
Dec 31 2017 21:37
Oh! Thank you. Good info. I'll make it so.