Wordle dueling game built on near smart contracts.
Working demo on heroku
- A new wordle game takes place every day. To get to participate in this game, players bid tokens to get in the top 2.
- Losers in the bidding phase get refunded. Top 2 players bid makes up the total bid.
- The game plays like wordle but with two players. Players take alternating turns to submit a word.
- The first player to find the word wins, if the word was not found the game is a draw.
- Winner gets the total bid and the total bid is shared equally when a draw occurs.
- The game has a time limit. When the time is up, anyone can claim the total bid.
- Clone the project and run either
npm install
oryarn
- Make sure you are logged in on near-cli
- Deploy the contracts and the react webapp on development mode by
npm run dev
oryarn dev
- Clone the project
- Locate to the
scripts
folder - Follow instructions in the
README.md
file
Initialize the contract with the necessary variables, word list etc.
Example call:
near call <contract-id> initContract --accountId <account-id>
Get the account which initialized the contract
Example call:
near view <contract-id> getOwner
Place a bid equal to the attached tokens in the transaction
Example call:
near call <contract-id> placeBid --accountId <account-id> --deposit <near-amount>
Increase the existent bid by the amount attached in the transaction
Example call:
near call <contract-id> increaseBid --accountId <account-id> --deposit <near-amount>
Get the total number of bidder in the current bidding session
Example call:
near view <contract-id> getTotalBidders
Get top 10 bidders accountId and bid amounts
Example call:
near view <contract-id> getTopBidders
Get the bid amount of the given accountId
Example call:
near view <contract-id> getBid '{"accountId":"<account-id>"}'
Start the game with the current top 2 bidders
- Only players of the game (top 2 bidders) can call this function
- Players are incentivized to calling this function because they will lose their bets if they dont
Example call:
near call <contract-id> startGame --accountId <account-id>
Finish the game if the game time is up
- Everyone is incentivized to calling this function because they can claim the total bid
Example call:
near call <contract-id> finishGame --accountId <account-id>
Get the current game state
Example call:
near view <contract-id> getGame
Play a word
- Only players of the game (top 2 bidders) can call this function
- Players are incentivized to call this function because game will timeout if they dont (and the total bid becomes claimable to everyone)
Example call:
near call <contract-id> playGame --accountId <account-id> '{"word":"<word>"}'