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.
-
Player Data Management: The DApp allows users to create player profiles and manage their gaming data, including rankings, reward percentages, stakes, and items.
-
Staking Mechanism: Users can stake a certain amount of tokens to participate in games and competitions, increasing their chances of winning rewards.
-
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.
-
Reward Distribution: The DApp automatically calculates and distributes rewards to players based on their performance and staked amounts.
-
Transparency: All gaming-related data and transactions are recorded on the Ethereum blockchain, ensuring transparency and preventing manipulation.
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.
To get started with the RaiseTheStakes DApp, follow these steps:
- Install project dependencies:
npm install
- Compile the smart contract:
npx hardhat compile
- Deploy the smart contract:
npx hardhat run scripts/deploy.js
- Start the DApp:
npx start
- Visit http://localhost:3000 in your web browser to interact with the DApp.
To run tests on the RaiseTheStakes.sol smart contract, use the following commands:
- Compile the smart contract:
npx hardhat compile
- Run the contract tests:
npx hardhat test
-
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.
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
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
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
orctrl-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
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!
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.
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.