Skip to content

Let's Fucking Game allows you to create "One Button Game" to engage your community and provide them fun way to engage with your content. Once the game starts. players have to log in everyday during a random time slot. If you forget, you lose. The last players share the prizes according to the prizepool distribution.

Notifications You must be signed in to change notification settings

0xGeegZ/lets-fucking-game-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Let's Fucking Game

Let's Fucking Game Presentation

Description

This application was done during the ChainLink Hackathon Fall 2022

Hackathon version Release accessible HERE.

Contracts deployed on ETHEREUM CHAIN TESTNET GOERLI :

PRIMARY :

SECONDARY :

Contracts deployed on BNB CHAIN TESTNET :

PRIMARY :

SECONDARY :

Contracts deployed on POLYGON CHAIN TESTNET MUMBAI :

PRIMARY :

SECONDARY :

Inspiration

We could run into a storytelling exercise and tell you that this was thought of as an innovative new way to engage your web3 community on twitter while providing a simple and fun experience.

And in retrospect, it can be. But the fact is the original goal was just to find a fun way to learn Web3 because in reality... It's just a fucking game :)

What it does

Let's Fucking Game allows you to create "one button games" to engage your community in order to provide them with a fun way to engage with your content.

The games can be free (the creator deposits the total prizepool of the game) or paid for by the players (the prizepool is composed of the players' registration fees).

Once the total number of players is reached, the game starts.

How it works

As a player, you'll have to interact with the game smart contract each day during a random time slot. This time slot change everyday and could be during the day or during the night. If you forget just once, you lose.

The last remaining players share the prizes according to the prizepool repartition.

When there is less than 50% players, a player can vote to split pot between remaining players. If all remaining players are ok to split pot then the pot is fairly distributed between remaining players .

The creator can manage the size of the slots and the frequency of the games to make the game last more or less time.

The game creator can also manage the winners structure to allow more or less players to win more or less part of the prizepool.

How we built it

Mono Repo boilerplate crafted from multiple other boilerplates. This help us to bootstrap this project in the best conditions :

Smart contract : Solidity, Hardhat and ChainLink Keeper

Front end : Used Nextjs and Etherjs to develop a cross chain dapp

Challenges we ran into

Our biggest challenge was to control contract size.

We also handle some difficulties is to create one keeper that manage all games. We used ChainLink V8 upKeep contract base and update it to allow management for multiple delegators (each game manage his keeper job Id).

We also have create a Game Factory to manage all games and facilitate games administration.

Finally, we encountered some challenges in the cross-chain administration of the project.

Accomplishments that we're proud of

The smart contracts are more than 80% covered in tests and this is probably our biggest pride.

We have also created an interface for the games and a generic system that will allow us to easily evolve the game contract to offer games with ERC20 tokens or NFTS.

Finally, the boilerplate we used offers a very quick analysis of our smart contracts with Slither and Mythril which allowed us to respect the best design pattern and the main security standards.

What we learned

First of all, it is important to know that 4 of the 5 team members had never been initiated to web3 before this project. It was therefore an opportunity for them to discover all these technologies.

We learned a lot about web3, both in terms of smart contracts, Hardhat and interfacing with etherJs.

It's also the first cross-chain project I've worked on and I've learned a lot about how to architect a project for that.

Finally, I manipulated for the first time the hardhat deploy plugin which make easier management of deployments as well as the tests thanks to fixtures.

I plan to create a boilerplate based on this project for all my future web3 developments.

What's next for LFG

In the short term, we intend to launch the project on the BNB Chain and on Polygon at least.

We would then like to add the possibility of depositing NFTs in the prizepool as this is the use case that made us want to embark on this adventure.

Rather than organizing Twitter contests to win an NFT, why not offer several people in the community the opportunity to sign up for a game and be the actor of their victory? That would be much more fun.

Then, we would like to interface with the ChainLink Data Feed service to allow the creator of the game to ask for an action on Twitter (like, share, comment) and a proof in order to register to the game.

Lfg would thus become a real social engagement tool for its web3 community, especially for influencer or NFTs projects.

It will also be necessary to improve the architecture of the smart contracts, in particular to optimize them and optimize gas costs.

Last, we would like to use Ethereum Push Notification to improve user experience and why not add ChainLink VRF to randomize in a better way the daily time range generation.

Built with

Primary :

Secondary :

Deployment :

Quick Start

Requirements

Clone the repo:

git clone https://github.com/lets-fucking-game/lets-fucking-game
cd lets-fucking-game

Install all dependencies:

yarn install      # install deps
yarn run build    # install solc and other tools in the docker image

Don't forget to copy the .env.example file to a file named .env, and then edit it to fill in the details.

Start up the local Hardhat network and deploy all contracts:

yarn chain

Startup the dapp

In a second terminal start up the local development server run the front-end app:

yarn dev

Metamask configuration

To interact with the local network, follow this step-by-step guide on how to use MetaMask with a Hardhat node.

If you've set the mnemonic from MetaMask the first 20 accounts will be funded with ETH.

Environment Variables

To make setting environment variables easier there are .env.example files in the hardhat and dapp workspaces. You can copy them to new .env files and replace the values with your own.

Hardhat

Name Description
NETWORK_RPC_URL One key by RCP network (see env.example). Required to deploy to public networks. Obtain from Infura's site.
DEPLOYER_WALLET_PRIVATE_KEY The private key of the account which will send the deployment transaction. The account must have enough ETH to deploy the contracts, as well as LINK which can be obtained from Chainlink's faucets.
ETHERSCAN_API_KEY Your Etherscan API key to verify contract code on Etherscan.

Front-end

Name Description
NEXT_PUBLIC_INFURA_KEY Read-only mode and WalletConnect.

Deploy Contracts

This will run the deploy scripts to a local Hardhat network:

yarn deploy

SEE hardhat package.json to see all deployment commands.

Auto-Funding

The Hardhat project will attempt to auto-fund the keeper deployed contract, which otherwise has to be done manually.

The amount in LINK to send as part of this process can be modified in this Hardhat Config, and are configurable per network.

Parameter Description Default Value
fundAmount Amount of LINK to transfer when funding contracts 1 LINK

Verify on Blockchain Explorers

You'll need an Blockchain Explorers API Key configured in your env file.

All deployment script include verify part.

For more information, SEE the README.

Test

If the test command is executed without a specified network it will run locally and only perform the unit tests:

yarn test:contracts

For coverage report:

yarn coverage:contracts

Format

Fix formatting according to prettier config in the respective workspace:

yarn format:dapp
yarn format:hardhat

Lint

yarn lint:dapp

Miscellaneous

SEE hardhat package to see all smart contracts miscellaneous. SEE dapp package to see all dapp miscellaneous.

References

About

Let's Fucking Game allows you to create "One Button Game" to engage your community and provide them fun way to engage with your content. Once the game starts. players have to log in everyday during a random time slot. If you forget, you lose. The last players share the prizes according to the prizepool distribution.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •