2

Question regarding RefundableCrowdsale of OpenZeppelin. When its goal isn't reached, how do investors get refund?

By calling the claimRefund() method? How do they call the method??

1

They sign a transaction to the contract's claimRefund() function.

It can be done from the command-line, from Mist, from MyEtherWallet and all that is required is knowledge of the contract address and function signature.

In practice, no one should expect the users to figure out how to accomplish that.

A reasonably user-friendly implementation would present a button that users press. They will have to expend a little gas to pay for processing.

The important thing is that users should approach the contract like a vending machine/ATM and pull their funds out. This is a best practice in contract design for some good reasons.

Hope it helps.

| improve this answer | |
  • In this case, creating a onlyOwner refund method and refunding ether by owner's gas is not a realistic way? – Tom Apr 17 '18 at 8:37
  • It can be done, but there are technical issues to overcome and it's questionable that one should want to. What if the owner is unable or unwilling to perform the task? – Rob Hitchens Apr 17 '18 at 13:52
  • Thanks for your reply, Rob. What are the technical issues? I understand that our investors might not want it. – Tom Apr 18 '18 at 4:15
  • You have to be careful not to iterate over a loop for (i=0;i <n; i++) because it will simply fail on a large n owing to the gaslimit. When interacting with untrusted contracts, you want to keep them separate so mischief by Alice doesn't DoS Bob, carol, etc. Don't forget the signer pays for gas. That could be a predicament if the sponsor was supposed to pay for refunds. The withdraw pattern, aka favoring pull over push solved for those concerns. – Rob Hitchens Apr 18 '18 at 4:52
  • Thanks a lot for your explanation, Rob!! It helps me a lot. – Tom Apr 18 '18 at 6:21

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.