Skip to content

DenhamPreen/merlions-bloom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Merlion's Bloom

Consumer Crypto App

A super simple, consumer-focused, single-player, coin toss game with novel game mechanics, where a player can win a prize by flipping a coin.

Merlion’s Bloom adds a twist by incorporating DeFi and novel game mechanisms that make the game a compelling experience and providing its players with real opportunities to win prizes. Deployed live on the Flow Mainnet and available to play at https://merlions-bloom.vercel.app/.

This hackathon project was built at the ETHGlobal Singapore 2024 Hackathon

This code repository contains the code for:

How It Works

To participate, a player deposits a specific amount of FLOW tokens, equal to or greater than the current game pool’s liquidity. Only one player can play at a time.

Once the deposit is made, the game uses randomness to determine the outcome. The game uses FLOW’s built-in randomness feature (VRF), which ensures the randomness is generated on-chain, without needing any external services to verify it.

If a player wins, they receive their entire deposit back plus the same amount—effectively doubling their original stake. For instance, if they deposit 4 FLOW tokens and win, they will receive 8 FLOW tokens in total. This is often referred to as “Double or Nothing.”

If a player loses, they forfeit their deposit, which gets added to the game’s pool. The next player will then need to deposit an amount that matches or exceeds the updated pool’s liquidity to play. The game pool’s liquidity grows with each loss, while winnings come from previous players’ deposits, supported by an initial reserve pool to keep the game running.

More About the Game Mechanics

The odds of winning or losing are based on the 40% chance of winning and 60% chance of losing, using the FLOW network’s native on-chain randomness feature. The randomness is generated by picking a random number and using a modulo operation to determine the outcome:

  • A random number from 0 to 9 is generated.
  • Numbers 0 to 5 represent a 60% chance of losing.
  • Numbers 6 to 9 represent a 40% chance of winning.

This system makes the game fair for all players, while ensuring the liquidity pool is sustained over time. Although a player could have a lucky streak, the game starts with an initial liquidity reserve to absorb those potential wins and keep the game active.

The Merlion’s Bloom smart contract holds logic of the game mechanics and is live and deployed on FLOW’s Mainnet, available to view here: https://evm-testnet.flowscan.io/address/0x992ca660013553acfC1649418C490d91B4Ce5E42