How to implement counter game with state in cardano plutus? (the 10th player can pick reward)

241 Views Asked by At

I want to make a simple stateful game in cardano using plutus language (to check what is possible in cardano, and what is not)

The rules are the following:

  • contract creator deploys smart contract and locks some ADA
  • games call the smart contract
  • the 10th unique gamer unlocks ADA and can pick up the reward

This is trivial to implement in etherium or tezos for example - you just:

  • the store has type array[address]
  • when gamer calls the smart contract you just check that address is not in the array yet AND append new address to the store
  • IF store.length >= 10 THEN caller can collect the reward

But how to implement this game in plutus?

What will be the type of:

  • data script
  • redeemer script
  • validator script (it's a function, sorry) ??

Update

Created similar question, but more realistic How to implement the voting smart contract in cardano Plutus language?

0

There are 0 best solutions below