project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

SpaceTokenHunt

🛰️Dive into #SpaceTokenHunt, an interactive game that simplifies learning DeFi! Navigate a spaceship through a crypto universe, understand LTV & Health Factor, and master DeFi strategies risk-free. 🌌 #DeFiEducation #LearnCrypto #BlockchainGaming

SpaceTokenHunt

Created At

LFGHO

Project Description

Documentation for the SpaceTokenHunt project

Abstract

LTV - the Maximum LTV ratio represents the maximum borrowing power of a specific collateral. For example, if a collateral has an LTV of 75%, the user can borrow up to 0.75 worth of ETH in the principal currency for every 1 ETH worth of collateral.

Health Factor - crucial metric representing the safety of a user's borrowed position. It is calculated based on the ratio of the total collateral value a user has provided to the platform against the total value of assets they have borrowed. Essentially, the Health Factor indicates the level of risk associated with the user's position. A higher Health Factor means a safer position, reducing the likelihood of the position being liquidated. If the Health Factor falls below a certain threshold (typically 1), it signals a high risk of liquidation, where the user's collateral might be sold off to repay the borrowed assets. This metric helps users manage their borrowing and lending activities, ensuring they maintain a healthy balance between the assets borrowed and the collateral provided.

Problems

One of the team members, who is also an educator in the field of cryptocurrencies and DeFi, encountered a significant challenge while teaching these complex subjects. During their experience of instructing over 3000 students, they consistently faced the difficulty of effectively conveying intricate DeFi concepts such as collateralization, loan-to-value (LTV) ratios, and the Health Factor. Traditional educational methods often proved insufficient in fully capturing the dynamic nature of DeFi markets and the practical implications of these concepts.

This problem is further compounded by the abstract and often complex nature of DeFi, which can be daunting for newcomers. The educator noticed a gap in practical, interactive learning tools that could simplify and demystify DeFi for students. Many learners struggled to grasp the full extent of risk management in DeFi, particularly regarding asset collateralization and the impact of market volatility.

Proposed solution

Recognizing these educational challenges, the team member was inspired to create a solution that could bridge this gap. The game concept was thus born out of a need for a more engaging, intuitive, and risk-free way to educate users about DeFi. By gamifying the learning experience, the game aims to make DeFi concepts more accessible and relatable, offering a hands-on approach to understanding and navigating the DeFi ecosystem. This initiative reflects a commitment to improving financial literacy in the DeFi space, empowering users to make informed decisions in their DeFi engagements.

Gameplay

The proposed game begins with the player selecting an initial asset to deposit as their starting balance as well as native cryptocurrency, to pay for transactions.. This balance, represented in a chosen token, sets the limit for their in-game wallet expenditure. However, it's crucial to note that these assets are not immediately provided as collateral; they merely constitute the player's balance.

As the player navigates the game, they encounter various "bubbles" representing different tockens, they can be providing as a collateral or taking as a loans. Players use four types of laser shots to interact with these tokens: one color for collateralizing a token (opening a deposit), another for borrowing the token, a third to repay the loan and a fourth to withdraw the deposit.

A key aspect of the gameplay involves matching the asset type: if the player attempts to provide an asset different from their initial deposit, an error message indicates that they cannot use this asset for collateral. Similarly, attempting to take a loan without first providing collateral also results in an error.

The correct initial action for the player is to find and interact with a token that matches the asset they initially deposited. Upon successfully shooting this bubble, the player's balance is provided as collateral to a smart contract, activating key parameters like the Health Factor and Net worth, which are displayedon head of screen.

Once the player has provided collateral, they can start taking loans by shooting at bubbles representing different loanable assets. Since they have collateral in place, they can now borrow any asset. After acquiring a loaned asset, the player can opt to provide it back as collateral, enabling a strategy to build a "liquidity pyramid."

To bring variety and strategic depth to the gameplay, bubbles can be differentiated not only by asset type but also by percentage of assets, for example, the user can customize the size of the interaction by setting the percentage of available assets. This feature will allow players to fine tune their strategies and manage their portfolio.

The game's core challenge is maintaining a healthy Health Factor, which decreases with each borrowed asset. If the Health Factor approaches or falls below 1.5, the game ends, and the player's spaceship is destroyed. The game concludes with a summary of the player's impact on the total value locked (TVL) in DeFi, illustrating how they increased their portfolio through various borrowing and collateral actions, thereby contributing to the DeFi liquidity pyramid.

The game could feature multiple modes, including an educational mode, and a real mode, where each action might constitute an actual transaction in the DeFi ecosystem. This diversity in gameplay modes offers varying levels of engagement and learning opportunities for players with different levels of familiarity with DeFi concepts.

Overall, this game aims to educate players about DeFi strategies and risk management in an interactive and engaging environment, using gamification to demystify complex financial concepts and encourage prudent financial behaviour in the DeFi space.

Overall, this game aims to educate players about DeFi strategies and risk management in an interactive and engaging environment, using gamification to demystify complex financial concepts and encourage prudent financial behaviour in the DeFi space.

How it's Made

In our project, we leveraged Next.js, an SSR (Server-Side Rendering) capable framework, to create a robust front-end architecture. For rendering 3D graphics, we integrated React Three Fiber, which combines the power of Three.js WebGL library with React's declarative capabilities. Global state management is efficiently handled by Zustand, ensuring minimal performance overhead. Tailwind CSS was chosen for its utility-first approach, significantly reducing the need for custom CSS.

For backend communication, Axios is used as the HTTP client, facilitating seamless interactions with our server-side logic. On the blockchain side, we utilized Thirdweb and KonnectKit to manage blockchain functionalities. These include wallet connectivity and interactions with the Aave protocol, aided by the @aave/utilities library.

Here's a concise list of the frameworks and technologies we used:

Frontend:

Next.js: A SSR-ready framework for React applications. React Three Fiber: Enables declarative 3D graphics in React. Zustand: A lightweight solution for state management. Tailwind CSS: A utility-first CSS framework to minimize custom styling. Axios: A robust HTTP client for backend communication. Thirdweb: Integrates blockchain protocols. KonnectKit: Manages blockchain wallet connectivity.

Backend:

NestJS: A scalable server-side framework. PostgreSQL: A powerful relational database system. Redis: Used for in-memory caching, particularly for JWT and the intermediary storage of spaceship positions. Socket.IO: Facilitates real-time communication between client and server. Ethers.js: Enables interactions with blockchain. @aave/contract-helpers: For integrating with the Aave protocol.

background image mobile

Join the mailing list

Get the latest news and updates