Skip to main content
16 events
when toggle format what by license comment
Feb 15, 2018 at 17:42 vote accept rustyshackleford
Feb 15, 2018 at 7:41 comment added user19510 The code in your question works fine for me. Note that gas fees apply no matter what, so the account's ether balance should go down a tiny amount with each transaction. But if I start with 100 ether and send 1 ether to adopt(), I end up with >99.99999999 ether after the call.
Feb 15, 2018 at 7:38 comment added rustyshackleford updated my question with the full code
Feb 15, 2018 at 7:15 comment added user19510 You'd have to share the actual code you're using (I guess the current code for adopt that calls returnEth.)
Feb 15, 2018 at 6:29 comment added rustyshackleford 1 eth is deducted from their wallet from the adopt() function in my previous question. returnEth() is called from within adopt(), but it doesn't seem to be working.
Feb 15, 2018 at 6:24 comment added user19510 No. Directly calling returnEth() should never reduce the amount of ether in the caller's account. Even if the transfer fails, the transaction will be reverted, so no ether will move.
Feb 15, 2018 at 5:35 comment added rustyshackleford so I won't talk about the web3js thing anymore, but if I call returnEth(); in my existing contract, eth is deducted from my metamask wallet but it is not returned. Do you know why this might be happening?
Feb 15, 2018 at 5:27 comment added user19510 To call it from another function in your contract, just do returnEth();. If your question is "How do I call a function from web3.js?" that doesn't seem related. Please ask it as a new question, but first, please just read a tutorial, maybe even mine: programtheblockchain.com/posts/2017/12/13/…. (I think, though, that maybe you're using Truffle? If so, look at a tutorial for that instead.)
Feb 15, 2018 at 5:25 comment added rustyshackleford okay. If I wanted to call that function inside of my contract (it's the same one as the one you replied to on my last question), how would I do that with web3js? I just don't want to spam StackExchange with questions.
Feb 15, 2018 at 5:08 comment added user19510 For your original code, if User A sends 1 ether to the function, then it transfers 1 ether to User A. If for some reason you don't want to just revert the transaction, then this seems like a fine way to refund the transferred ether.
Feb 15, 2018 at 5:03 comment added rustyshackleford So would my original code theoretically work, if it was called at the right time?
Feb 15, 2018 at 5:02 comment added user19510 It's just <address>.transfer(<amount>).
Feb 15, 2018 at 5:00 comment added rustyshackleford That's good information, but I'd still like to know how to send ether to users from the contract. Should I update my original question?
Feb 15, 2018 at 4:58 comment added user19510 A transaction that hasn't been confirmed is just waiting around. It doesn't have any effect. When it finally gets processed, it will either succeed (if it's the first to buy the item) or fail.
Feb 15, 2018 at 4:57 comment added rustyshackleford What happens if the transaction is still being confirmed?
Feb 15, 2018 at 4:53 history answered user19510 CC BY-SA 3.0