These are chat archives for ethereum/tutorials

17th
Jul 2018
Navneet Boghani
@navneetboghani
Jul 17 2018 05:56
Hi, i have made one crowdsale for my token, now crowsale is close. but my crowsale is fail. so i have to refund eth according to token, but some small mistake in refund functionality. so how can i change or update crowasale? so anybody help me for that
my crowsale on ethscan as above url
phiferd
@phiferd
Jul 17 2018 06:02
@navneetboghani what is the issue exactly?
Navneet Boghani
@navneetboghani
Jul 17 2018 06:02
how can refund my eth from this contract?
just trying to understand what the actual problem is. Also, are you the owner of the contract?
Navneet Boghani
@navneetboghani
Jul 17 2018 06:06
yes
refund function is working only for first trancation of contract
in this address i have spend 140 eth
but i can get refund first 39 eth
remain eth not geting
phiferd
@phiferd
Jul 17 2018 06:11

And you have control of this address: '0xbad6f174c8267d8b9d7c1006f56fb63e64a84488' right?

Can you use the selfdestruct option?

Navneet Boghani
@navneetboghani
Jul 17 2018 06:12
yes 0xbad6f174c8267d8b9d7c1006f56fb63e64a84488 this one my eth address in my mist wallet
phiferd
@phiferd
Jul 17 2018 06:13
ok. so you should be able to call 'removeContract' and get all of the ETH back in that address. Then you would need to go through the event log to refund any other addresses that haven't called refund yet.
Were there any other users that contributed multiple times?
i have only 7 to 8 member who have contribute multiple time
so as per you saying if i m destroy contract then eth refund automatilly on user address right?
phiferd
@phiferd
Jul 17 2018 06:22

when selfdestruct is called, the balance of the contract will be sent to the parameter. So, you have selfdestruct(msg.sender) where msg.sender should be creator based on the precondition.

However, before you do that, I recommend deploying the contract using remix to an in memory EVM, recreate the issue, then try the self destruct. Or, add a test case using truffle. Or, deploy to the test net and recreate then destruct.

Please keep in mind I haven't really spent any time looking carefully at the contract, so that's way I recommend reproducing the issue somewhere else first and verifying that your recovery will work as expected.
Navneet Boghani
@navneetboghani
Jul 17 2018 06:25
OK, I have already generate similar scenario, now I m destroy the contract and check it is working or not
phiferd
@phiferd
Jul 17 2018 06:25
on some test net, right?
Navneet Boghani
@navneetboghani
Jul 17 2018 06:26
no main account i have Create same process but very low amount of eth so i can test on main net
phiferd
@phiferd
Jul 17 2018 06:27
ok.
Navneet Boghani
@navneetboghani
Jul 17 2018 06:27
but any other option to update smart contract functionality
phiferd
@phiferd
Jul 17 2018 06:29
not really, no. There are some things you can do to redirect calls dynamically to another contract, so the redirect address can be updated, but in general, no.
Navneet Boghani
@navneetboghani
Jul 17 2018 08:34
hi
i have problem to remove contract from blockchain
phiferd
@phiferd
Jul 17 2018 08:36
what's the issue?
Navneet Boghani
@navneetboghani
Jul 17 2018 08:37
Warning! Error encountered during contract execution [Reverted]
phiferd
@phiferd
Jul 17 2018 08:37
can you send a link to the tx
phiferd
@phiferd
Jul 17 2018 08:44
one sec. looking
Navneet Boghani
@navneetboghani
Jul 17 2018 08:44
ok
phiferd
@phiferd
Jul 17 2018 08:47
looks like the state is still "Fundrasing"
Navneet Boghani
@navneetboghani
Jul 17 2018 08:48
as per contract deadline show 1531812368
so you can check it this timeline is gone
phiferd
@phiferd
Jul 17 2018 08:48
did you call checkIfFundingCompleteOrExpired
phiferd
@phiferd
Jul 17 2018 08:49
ok. should be good now
much easier to work with etherscan if you register your code. It has built in tools to read the state of the contract and you can debug with Remix
Navneet Boghani
@navneetboghani
Jul 17 2018 08:52
We are working on Remix
how can i check my debug log in remix
phiferd
@phiferd
Jul 17 2018 09:00
I think the issue your running into now is here require((state == State.Failed || state == State.Successful) && completedAt + 1 hours < now)
The completedAt time was just set when you sent checkIfFundingCompleteOrExpired, so you have to wait an hour
Navneet Boghani
@navneetboghani
Jul 17 2018 09:00
so after one hour i can remove contract
phiferd
@phiferd
Jul 17 2018 09:01
In Remix, when a tx fails, you can click the debug option.
Yes, I think the removeContract function should work then. the '1 hour ' delay is hardcoded into your contract
Navneet Boghani
@navneetboghani
Jul 17 2018 09:05
ok
so after 1 hours i can try again and send back to you response of this tx
Navneet Boghani
@navneetboghani
Jul 17 2018 10:12
Hi
removeContract done successfully
and balance revert in admin account, so how can that ether balance transfer to users ?
phiferd
@phiferd
Jul 17 2018 10:32
you will have to transfer it yourself from the admin account.
Navneet Boghani
@navneetboghani
Jul 17 2018 10:32
Ok
phiferd
@phiferd
Jul 17 2018 10:37
It will take some effort, but there were only 56 total txs. not sure how many addresses were refunded, but you should be able to find it in the tx history. good luck.
洪春
@halu886
Jul 17 2018 11:51
hello~
Hai Luong
@hailq
Jul 17 2018 13:02
hi
i read the solidity document
And i'm really confused with the now variable
It’s said that it’s the time stamp of the current block, what does it mean ?
so if i call now on a function then after some line of codes i call now again
will it return 2 different values, because maybe those funtion calls are on the same block :?