1

Hello dear Eth community,

I am a complete noob, please go easy on me ;) I am an IT teacher and I want to create a reward system for my class for a game that we play weekly. The game is not blockchain related - basically it is a quiz which when solved would open an ethereum address and an amount of ETH to sent to the address. E.g. “Address is 0x337hj377v..; you can now transfer 2ETH to get your “game reward tokens”. Once individual sends that ETH, he receives back the appropriate amount of game tokens e.g. 1eth = 0.1 game tokens.

We then count who collected the most and determine the winner.

Again, I am completely new to developing smart contracts and I have some challenges.

I am working on a test net and already created my “game reward tokens”.

Next what I am struggling to do is to create a smart contract which would accept my “game reward tokens” and then would send it to users, to whoever is sending ETH, lets say 1ETH = 10 “game reward tokens”.

So “game reward tokens” >> moved to smart contract address >> sits there until someone sends the ETH. If 1eth sent from address x >> 10 game reward tokens sent to address x.

Is there a change anyone could help me out? Maybe there already were similar discussions and you could point me there.

Would appreciate any suggestions, Cheers!

3
  • This blog post of mine may help. It sounds like pretty much exactly your scenario: programtheblockchain.com/posts/2018/02/02/….
    – user19510
    Feb 22, 2018 at 23:53
  • Thank you for sharing! If you don't mind I have couple of questions: 1. token contract, what kind of contract is that? ICO contract generated ICO tokens? Can it be just an address where tokens are just stored? 2.When deploying does it requires to change IERC20Token in interface section to the token name that I am selling? 3. When deploying is there anything else needed to be inputed rather than token contract/address and a price? So far I am able to deploy, but when ever I try to send ETH as if buying tokens, it fails during confirmation. Thank you very much for your help!
    – Pandation
    Mar 1, 2018 at 23:13
  • programtheblockchain.com/posts/2018/01/30/… may help you to understand the token contract, and programtheblockchain.com/posts/2018/02/09/… may help you put it all together.
    – user19510
    Mar 1, 2018 at 23:14

1 Answer 1

0

If you try to run the smart contract on this website Crowdsale In this process you have to build the erc20 token in 1st step and then 2nd step crowdsale , transafer some coins to this crowdsale contract.Anyone send the eth to this crowdsale contract will get the tokens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.