0

I had a quick question about an abnormal ways to buy ERC-20 Tokens and hear if this is technically possible.

Let's assume there is a smart contract that generates and holds ERC-20Token called 'ThankYou' token, which has a supply of 1 billion tokens.

1) User A donates 100ETH to a child in need.

2) Smart contract detects that User A has donated 100 ETH and validates that 100ETH indeed has been sent to the child

3) Smart contract is triggered to transfer 30ThankYou tokens to User A for doing good.

I would very much appreciate your thought on this. I only came across cases where ERC-20 Tokens are attained by 'buying' with ETH (based on the price of ERC-20 Tokens). I was wondering if above step I mentioned is possible. And If yes, then can User A sell that 30ThankYou tokens for a exchange with ETH.

Thank you,

0

If your contract handles the Ether donations as well, then it's quite easy to do. So your contract would take the donation and pass it on to where it was supposed to go and trigger a transfer of tokens.

If your contract is not handling the donations then you have to somehow notice when donations are made. This you have to do outside the blockchain, probably by listening to some events being emitted or so. You also have to think quite spefically which Ether transfer is considered as a donation and which not.

  • Thank you Lauri for insight. Is it possible for a smart contract to generate&transfer erc20 tokens without the exchange of ether? I'm assuming that very little ether is required to cover the gas, but beyond that, is it possible for smart contract to just generate erc20 token and transfer those token for free based on action created off-blockchain? – Harris Lee Apr 16 '18 at 3:44
  • The ERC20 standard doesn't say anything about how the tokens should be distributed. It only includes functions to distribute them. You can call the transfer function whenever you want for whatever reason. So, yes, it only takes some gas to transfer generated tokens. – Lauri Peltonen Apr 16 '18 at 5:45

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.