FinishYourCredits
Problem Statement (by Ripple): Develop fintech applications leveraging XRPL and its new EVM Sidechain to minimize traditional costs associated with such ventures. These applications may encompass areas like insurance, wealth management, cross-border payments, lending, and more.
Try our application at: https://fintech2025.vercel.app/
(note: you will need to login using gmail, and connect to an external wallet, eg. metamask, connected on the EVM sidechain)
Introduction
The Bigger Picture
The food industry has largely adhered to traditional systems with minimal changes over time. These systems often prove inefficient, limiting their ability to adapt to modern demands. Traditional systems often rely on intermediaries who charge significant fees, which cut into the profits of food vendors. For example, Grab charges platform fees to both food vendors and buyers, and credit card companies often charge 1.5% to 4% of total value of transaction (with per transaction fees, which forms a larger proportion of fees in small transactions such as food).
To address this, we aim to revolutionize the industry by introducing a blockchain-based dining credit token system, powered by XRPL and its EVM sidechain. This eliminates intermediaries by directly connecting food vendors and buyers. Vendors can then pass on these savings to consumers in the form of lower prices, making food more affordable for all and ensuring inclusive growth.
However, as a proof of concept, we seek to restrict the scope to NUS due to time constraints in this hackathon, and tackle well-known issues faced by students and administration regarding dining credits in NUS residences.
Existing challenges in NUS Residences
1) Student Dissatisfaction
NUS students staying in most residences are required to purchase pre-paid breakfast and dinner credits (just enough to dine 6 days a week) every semester. However, many students attend events which end after dinner time, and the breakfast cutoff time of 10AM has proven to be too early for some students, resulting in missed meals. Others may find that the limited food options do not align with their preferences or lifestyle choices. Hence, students often find themselves with surplus dining credits that go unused at the end of the semester, leading to discontentment over the amount of money wasted.
2) Food Wastage
On the other hand, food vendors in residences are obliged to prepare enough food each day for all the students that could potentially dine there. However, due to the low number of students who actually claim their dining credits, there is often leftover food at the end of each dining period (often as much as 15% at Residential Colleges (RCs) – this number could be higher in Halls of Residence where the food is generally known to be less well-received by the students than the RCs, especially for less popular dishes). It is also difficult to predict the demand during each meal period due to numerous external factors like holidays, examinations, CCAs, residential activities and even a specific item on the menu.
Our solution seeks to address both these problems simultaneously. There are many students and staff looking for affordable food on campus who could benefit from cheap (or even free) dining credits to redeem meals from residences in NUS. Students who are more reliant on the dining system in NUS (such as international or exchange students) can also make use of these extra credits to redeem additional portions of their favourite food.
Our Solution
A blockchain-based peer-to-peer marketplace for NUS dining credits, leveraging XRPL and its EVM sidechain to enhance security, transparency, promote environmental sustainability through waste reduction, while promoting inclusivity.
Overview
Students with extra dining credits can sell them to other NUS students for any price, rather than having their credits expire at the end of the semester. They can also choose to donate their credits, which can be used to support students on financial aid, or for any cause deemed fit by NUS. This will eventually lead to more students being able to enjoy affordable food and less money wasted from the meal plan structure, improving student satisfaction, promoting inclusivity while reducing food waste from unclaimed food.
How it works
- Students can sign up for an account using their NUS email (for verification purposes, note that we allow any email for testing purposes)
- Students will connect to their wallet (metamask wallet or custodial wallet)
- Custodial wallet (for future development) serves to abstract away the web3 processes by introducing account abstraction to improve user experience, as it removes the need to handle fees and wallet private key management
- NUS Admins will distribute tokens to verified hall residents at the start of the semester
- Students can claim their meal credits directly on the app (which will burn a token) by scanning QR code or entering the day’s OTP
- Students show the confirmation screen to claim their meal
- Students can sell unused credits to other NUS students looking for cheap food alternatives in the marketplace, at any price
- Students buy dining credits in the marketplace using XRP (further development can abstract this to simply use fiat to pay)
- XRP will be stored in the vault, and sellers can claimed their XRP from the vault
- Students can also choose to donate unused credits, which can be given to students on financial aid.
Features
1) Publicly Accessible Pages
- Landing Page: Provides information about our application.
- Authentication Page:
- Includes sign-in/sign-out functionality with Gmail OAuth authentication.
- An additional layer of authentication is implemented beyond the use of wallets, enabling recognition of NUS students by their school emails.
- Facilitates distribution of meal credits at the start of the semester.
- Includes sign-in/sign-out functionality with Gmail OAuth authentication.
2) Authenticated-Only Pages
- Connect to Wallet: Available after signing in.
- Dashboard:
- View balance of XRP.
- View balance of dinner and breakfast credits.
- Claim credits using a QR code or OTP, with a confirmation screen for claiming credits.
- Withdraw balances from sales of tokens.
- Table of active listings with options to edit or delete listings.
- Credit claim history table with links to transactions on the ledger.
- Transaction history table with links to transactions on the ledger.
- View balance of XRP.
- Top Up XRP:
- For testing purposes, top up 10 XRP using a faucet wallet.
- For testing purposes, top up 10 XRP using a faucet wallet.
- Buy/Sell Marketplace:
- Trade breakfast and dinner credits.
- Includes an order book of all transactions.
- Displays the current market price.
- Trade breakfast and dinner credits.
- Donate Page: Allows users to donate unused credits.
3) Admin-Only Pages
[Note: For the purpose of showcase, public usage of admin pages is enabled.]
- Generate DINING Claim Code: For testing only.
- Manage All Account Information Table.
- Distribute BFAST/DINNER Tokens: Distribute tokens to selected users in a table.
- Mint Tokens: Restricted to the owner only.
4) Other Key Features
- Secure Tokenization: Dining hall credits are tokenized to enable peer-to-peer exchanges securely.
- Smart Contract-Based Transactions: Ensures fair trade and prevents misuse (refer to the technical implementation for smart contract details).
- Accessibility: Fully mobile-optimized for use on both desktop and mobile browsers, with no app downloads necessary.
- Chatbot: Guides users on how to use the application.
5) Other Works in Progress:
- Use of custodial wallets for account abstraction
- Improves user experience, as students and admins don’t have to deal with complex blockchain processes, such as owning a wallet, securing private key, etc
- Use of meta transactions (ERC 2771) to facilitate gasless transactions for claiming of dining credit
Technical Implementation
| Layer | Technology |
|---|---|
| Frontend | - Next.js (React framework) |
| - React.js | |
| - Shadcn-UI (customizable UI components) | |
| - Tailwind CSS (styling) | |
| Backend | - Next.js server actions |
| - Next.js API routes | |
| - Communication with blockchain using Wagmi and Viem | |
| Blockchain Layer | - Deploy smart contracts using Hardhat |
| - Solidity (smart contract logic) | |
| Database | - PostgreSQL (using Supabase) |
Smart contract Implementation Details
These contracts are deployed on the EVM sidechain using XRP as the main currency (which is bridged from XRPL).
Tradable.sol:
- Abstract contract which will be implemented by TokenContract.sol to give it the Tradable property
- Records all sell listing orders
- Allows place order, remove order, update order price, buy order, get order, list orders
TokenContract.sol(one each for BFAST token and DINNER token):- Implements Tradable.sol, ERC20.sol, Ownable.sol
- Basic ERC20 token functionalities: mint, burn
- Tradable functionalities: buy, remove, update, list orders, etc.
- Other functions: claim credit, donate, getTotalDonations
- Link to centralised vault, all XRP from sales will be deposited to the vault to be claimed by sellers
CentralizedVault.sol- Central vault for all sales
- Keeps track of seller’s sale balance, and allows withdrawal of XRP
What's next for FinishYourCredits
Due to the limited time frame of the hackathon, we decided to limit the scope of our project to NUS dining credits. This ensures our idea is feasible and makes user research and initial market acquisition easier.
However, we plan to expand FinishYourCredits by using the virtual token(s) we created to establish a global decentralised market for food, outside of NUS. This was inspired by the recent hike in the platform cost of various food delivery apps, credit card transaction fees, and middleman costs in general, which have caused food prices to skyrocket. Food has become less accessible around the world, standing between societies and their quest for inclusive growth.
Participating food vendors can sign up and list their food for sale for DINING credits, allowing the transaction to be carried out directly on the blockchain. This can lead to an overall reduction in the cost of food (as well as fairer wages for food delivery drivers) and reduction in food waste, for a few reasons:
- By establishing a universal network for food credit exchange, consumers, vendors and drivers no longer have to deal with intermediaries such as food delivery apps, which take a large cut of the transaction cost. Instead, drivers can be paid a full cut of the meal price, vendors can receive higher profits on their sales, and pass on these cost savings to their consumers.
- With the presence of 1 singular decentralised platform for food exchange, it reduces the need for aggressive marketing and possibly monopolies by profit-motivated food distribution platforms, which are wasteful and drive up costs.
- Food vendors can mark down prices for leftover food, or food nearing its expiry date. Currently, these markdowns are implemented at store-level, without any means to advertise them. They often go unnoticed by consumers who are not regular customers. With this system, consumers can easily view markdown items near them, diverting surplus food to those who need it, instead of to landfills.
Built With
- auth.js
- hardhat
- next.js
- postgresql
- prisma
- react
- shadcn
- solidity
- viem
- wagmi
Log in or sign up for Devpost to join the conversation.