[Ethereum] Loading smart contract x with tokens; sending eth to smart contract x; receiving tokens for that eth

contract-designethergamesrewardtokens

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!

Best Answer

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.

Related Topic