Giter Club home page Giter Club logo

πŸ“œ RaiseTheStakes DApp

Deployed xmcbgdevs to Github Pages with Github Actions.

Project Overview

Description

RaiseTheStakes is a decentralized application (DApp) built on the Ethereum blockchain that allows users to participate in a competitive gaming environment where they can stake tokens, earn rewards, and improve their rankings. This DApp leverages the power of smart contracts to ensure transparency, security, and fairness in the gaming ecosystem.

πŸ”‘ Key Features

  1. Player Data Management: The DApp allows users to create player profiles and manage their gaming data, including rankings, reward percentages, stakes, and items.

  2. Staking Mechanism: Users can stake a certain amount of tokens to participate in games and competitions, increasing their chances of winning rewards.

  3. Ranking System: A robust ranking system is in place to determine players' standings within the gaming community. Players can strive to improve their rankings over time.

  4. Reward Distribution: The DApp automatically calculates and distributes rewards to players based on their performance and staked amounts.

  5. Transparency: All gaming-related data and transactions are recorded on the Ethereum blockchain, ensuring transparency and preventing manipulation.

πŸ“œ RaiseTheStakes Smart Contract

This combination of technologies ensures a robust, secure, and user-friendly experience for players participating in the RaiseTheStakes DApp.

The RaiseTheStakes.sol smart contract is a core component of this project. It includes features such as player information tracking, ranking, reward percentages, stakes, and items.

  • You can find the contract code in the contracts/RaiseTheStakes.sol file.

πŸ’» Getting Started

To get started with the RaiseTheStakes DApp, follow these steps:

  1. Install project dependencies:
    npm install
  2. Compile the smart contract:
    npx hardhat compile
  3. Deploy the smart contract:
    npx hardhat run scripts/deploy.js
  4. Start the DApp:
    npx start
  5. Visit http://localhost:3000 in your web browser to interact with the DApp.

πŸ§ͺ Testing the Contract

To run tests on the RaiseTheStakes.sol smart contract, use the following commands:

  1. Compile the smart contract:
    npx hardhat compile
  2. Run the contract tests:
    npx hardhat test
    

πŸ”§ Technologies Used

  • Ethereum Blockchain: The core of the project relies on Ethereum smart contracts to manage player data, staking, rankings, and rewards.

  • Solidity: The smart contracts are written in Solidity, a programming language specifically designed for Ethereum.

  • Vite: The project utilizes Vite as a development and build tool, enabling faster development and hot module reloading for a seamless development experience.

  • React: The frontend of the DApp is built using React, a popular JavaScript library for building user interfaces.

  • Web3.js: Web3.js is used to interact with the Ethereum blockchain from the frontend, enabling users to perform actions such as staking and updating player data.

  • OpenZeppelin Contracts: The project relies on OpenZeppelin Contracts, a library of reusable smart contracts, to enhance security and reduce development time.

  • Express.js: Express.js is used to create a backend server for handling API requests and serving the frontend.

  • @replit/database: This package is used for data storage and retrieval, allowing the DApp to persist player data.

  • Styled Components: Styled Components is used for styling the frontend, providing a flexible and maintainable way to manage CSS.

  • Ethers.js: Ethers.js is used for Ethereum wallet integration, enabling users to connect their wallets and perform transactions securely.

  • evm-chains: This package assists in working with different Ethereum networks and configurations.

  • React Feather Icons: Icons from the React Feather library are used to enhance the user interface.

  • Use-Local-Storage: This package is utilized for managing local storage and caching.

  • JSON Stringify Safe: JSON Stringify Safe is used for safe JSON stringification.

  • Microtip: Microtip is integrated for easy and convenient tipping within the DApp.

πŸš€ Project Structure

Inside of your project, you'll see the following folders and files:

/xmcbgdevs
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ nextjs.yml
β”‚       └── deploy.yml
β”œβ”€β”€ next
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”œβ”€β”€ global.css
β”‚   β”œβ”€β”€ layout.tsx
β”‚   β”œβ”€β”€ page.module.css
β”‚   └── page.tsx
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”œβ”€β”€ avatar.tsx
β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”œβ”€β”€ dropdown-menu.tsx
β”‚   β”‚   β”œβ”€β”€ sepertor.tsx
β”‚   β”œβ”€β”€ action-button.tsx
β”‚   β”œβ”€β”€ ConnectButton.tsx
β”‚   β”œβ”€β”€ date-range.tsx
β”‚   β”œβ”€β”€ footer.tsx
β”‚   β”œβ”€β”€ header.tsx
β”‚   └── sidebar.tsx
β”œβ”€β”€ crypto/
β”‚   β”œβ”€β”€ contracts/
β”‚   β”‚   β”œβ”€β”€ examples/
β”‚   β”‚   β”‚   β”œβ”€β”€ NFT.sol
β”‚   β”‚   β”‚   β”œβ”€β”€ token.sol
β”‚   β”‚   β”‚   └── wallet.sol
β”‚   β”‚   β”œβ”€β”€ contract.sol
β”‚   β”‚   β”œβ”€β”€ Game.sol
β”‚   β”‚   β”œβ”€β”€ GHO.sol
β”‚   β”‚   β”œβ”€β”€ RaiseTheStakes.sol
β”‚   β”‚   └── RaiseTheStakesTester.sol
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ borrowgho.js
β”‚   β”‚   └── test.js
β”‚   β”œβ”€β”€ tools /
β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”œβ”€β”€ ui.jsx
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ sniff.cjs
β”‚   β”œβ”€β”€ upgrade-vite.cjs
β”‚   β”œβ”€β”€ vite.config.js
β”‚   β”œβ”€β”€ package.json
β”‚   └── README.md
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ customWalletTheme.js
β”‚   β”œβ”€β”€ data.ts
β”‚   └── utils.ts
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”œβ”€β”€ next.svg
β”‚   └── vercel.svg
β”œβ”€β”€ styles/
β”‚   └── global.css
β”œβ”€β”€ .env
β”œβ”€β”€ .eslintrc.js
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .gitignore
β”œβ”€β”€ next-env.d.ts
β”œβ”€β”€ next.config.js
β”œβ”€β”€ package.lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€postcss.config.js
β”œβ”€β”€ README.md
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── tailwind.config.js


/xmcbgdevs
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ nextjs.yml
β”‚       └── deploy.yml
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ next
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”‚   β”œβ”€β”€ global.css
β”‚   β”‚   β”œβ”€β”€ layout.tsx
β”‚   β”‚   β”œβ”€β”€ page.module.css
β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”‚   β”œβ”€β”€ logo.svg
β”‚   β”‚   β”œβ”€β”€ pattern.svg
β”‚   β”‚   β”œβ”€β”€ robots.txt
β”‚   β”‚   β”œβ”€β”€ vercel.svg
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ next-env.d.ts
β”‚   β”œβ”€β”€ next.config.js
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ README.md
β”‚   └── tsconfig.json
β”œβ”€β”€ crypto/
β”‚   β”œβ”€β”€ contracts/
β”‚   β”‚   β”œβ”€β”€ examples/
β”‚   β”‚   β”‚   β”œβ”€β”€ NFT.sol
β”‚   β”‚   β”‚   β”œβ”€β”€ token.sol
β”‚   β”‚   β”‚   └── wallet.sol
β”‚   β”‚   β”œβ”€β”€ contract.sol
β”‚   β”‚   β”œβ”€β”€ Game.sol
β”‚   β”‚   β”œβ”€β”€ GHO.sol
β”‚   β”‚   β”œβ”€β”€ RaiseTheStakes.sol
β”‚   β”‚   └── RaiseTheStakesTester.sol
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ borrowgho.js
β”‚   β”‚   └── test.js
β”‚   β”œβ”€β”€ tools /
β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”œβ”€β”€ ui.jsx
β”‚   β”‚   └── README.md
β”‚   β”œβ”€β”€ sniff.cjs
β”‚   β”œβ”€β”€ upgrade-vite.cjs
β”‚   β”œβ”€β”€ vite.config.js
β”‚   β”œβ”€β”€ package.json
β”‚   └── README.md
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json
└── README.md

Replit Solidity Template

Welcome to the world of Ethereum and Web3! This is a beta template for Solidity development on Replit. Solidity is the language used to create Smart Contracts, which are programs that run on the Ethereum Blockchain.

Features include:

  • Hot reloading
  • Solidity error checking
  • Deploying multiple contracts
  • UI for testing out contracts
  • Replit testnet + faucet

Getting started

Just press the Run ▢️ button!

  • You should only need to do this once (and might take like 15s). This will install all relevant packages, start up the contract deployment UI, and compile your contract.sol file.

  • contract.sol will automatically recompile whenever you edit it, and all your contracts inside of this file will be available to deploy from the UI.

  • Pressing cmd-s or ctrl-s (windows) will reload the UI.

We have preinstalled packages from @openzeppelin/contracts. To install other solidity packages that are distributed on npm, make sure you install them using the Package Installer πŸ“¦ in the sidebar

Examples

We included a few example contracts in the examples folder. These will not be automatically deployed or accessible in the UI, but you can copy / paste them into your main contract.sol file or import them. They're there for your reference!

Future work

We're working on some other features for making development here a lot easier, which are included, but not limited to:

  • LSP support for solidity
  • Integration with hardhat for "local" (in-repl) testing
  • An actual solidity REPL for quickly prototyping / testing functions or lines.

Feedback

Please leave any comments on this repl's spotlight page here.

The UI is subject to change (and still needs some real responsive work), so we'd appreciate any feedback there.

We're also trying to improve the overall dev experience, especially for beginners, so any feedback there is appreciated.

xmcbgdevs's Projects

xmcbgdevs icon xmcbgdevs

The "RaiseTheStakes" game contract is a suitable for games or applications where players can participate, earn rewards, and interact with their in-game assets.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.