DEV Community

Cover image for Lumen Finance
permaintern
permaintern

Posted on

Lumen Finance

This is a submission for the Build Better on Stellar: Smart Contract Challenge : Build a dApp

What I Built

Lumen Finance

Image description

Image description

Small and medium enterprises (SMEs) often face cash flow challenges due to extended payment cycles, hindering their ability to invest in growth, pay suppliers, and meet operational expenses. Traditional invoice financing solutions can be costly, slow, and inaccessible to many businesses. Additionally, lenders face challenges in assessing risk and lack transparency into the underlying invoices.

Lumen Finance aims to solve this by creating a decentralized, on-chain invoice financing platform that leverages the Stellar blockchain to provide SMEs with improved access to liquidity while offering lenders a transparent and secure investment opportunity.

How it Works:

  1. Invoice Upload and Verification: SMEs can upload their outstanding invoices to the Lumen Finance platform, which will be verified and recorded on Stellar for transparency.

  2. Lending Pool: Everyone can become lenders by contribute funds to the Lumen Finance, which will be used to finance against the approved invoices. Lenders will receive share tokens in return to represent their portion of contribution and use for withdrawal later.

  3. Invoice Settlement: Once the invoices are paid by the debtors, the funds will be distributed proportionally to the lenders based on their ownership stakes, minus a small fee that goes into an insurance fund.

Key Features:

  • Decentralized and transparent: All invoices, lending activities, and transactions are recorded on the Stellar blockchain, ensuring transparency and immutability.
  • Improved liquidity for SMEs: SMEs can access liquidity by selling their outstanding invoices, improving their cash flow and enabling growth.
  • Diversified investment opportunities: Lenders can invest in a diversified portfolio of invoices, earning yields based on the invoice value and duration.
  • Risk mitigation: The platform will implement robust risk assessment mechanisms, including credit scoring and invoice verification, to mitigate lending risks.
  • Smart contract automation: Stellar's built-in smart contracts will automate invoice auctions, lending, and settlement processes, ensuring efficiency and reducing operational costs.
  • Seamless on-ramp and off-ramp: The Stellar blockchain provides seamless on-ramp and off-ramp capabilities, allowing users to easily convert between fiat and digital currencies.
  • Cost-effective and fast transactions: Stellar offers low transaction fees and fast confirmation times, making it ideal for financial applications.
  • Trusted by financial institutions: Stellar has gained trust and adoption from various financial institutions, ensuring regulatory compliance and stability.

By leveraging Stellar and its DeFi principles, Lumen Finance aims to revolutionize invoice financing, providing SMEs with improved access to liquidity while offering lenders a transparent and secure investment opportunity.

Demo

See the Video

Try out our demo
https://lumen-finance-react.vercel.app/

Process
There will be 3 wallet identities

  • Liquidity Provider (LP)
  • Admin
  • SME that wants to borrow money
  1. Have a Freighter wallet with some testnet tokens
  2. Mint some custom Lumen USDC tokens on our site
  3. Deposit the Lumen tokens into our site.
  4. Import the admin secret key into your wallet and change account.
  5. Whitelist the SME address which will want to do the borrowing.
  6. SME will do the request loan
  7. Admin will approve loan and set the fees
  8. SME will claim loan
  9. SME will repay loan upon maturity
  10. User can withdraw profits

Do note that you will need the admin account to approve loans and whitelist addresses. You can import the admin secret keys to your wallet to complete the entire loan cycle.

My Code

Our GitHub

https://github.com/dantgw/lumen_finance_react

The lumen smart contract has been deployed to testnet with ID: CASRJH25KUZS5YS2M4NV73QTDTJPW2LA4EBOWND462RDW2ID3A23FTDY

The custom token smart contract has been deployed to testnet with ID:
CD2HM6J5UML3XEH4EBU3TFWZDVF3AIU64HAPKYDYE43Q3DEWMKT5MZXT

Figma and Slides

https://www.figma.com/proto/s1v01T9wqT1VgYTJo8eqNC/Consensus-24?page-id=0%3A1&node-id=5-4978&viewport=1218%2C-460%2C0.08&t=oNTmfNTNB9dyru8h-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=5%3A4978

Journey

Motivation
We are interested in building Web3 projects with real world use cases. In many crypto projects, the source of the yield is hidden, which leads to projects failing. We see that invoice financing has a clear use case in Web2 and would benefit from the greater security and decentralisation of Web3.

Dapp
The website is built using Next.js and integrated with the Freighter wallet for smart contract calling. The Dapp is hosted on Vercel.

Smart Contract Design

Image description

It consists of 2 smart contracts:

  • Lumen smart contract for loans
  • Token smart contract to be used as the currency in the application.

The Lumen Smart Contract allows anyone to deposit funds to loan their capital in exchange for a return. It relies on an admin to whitelist addresses which can request a loan. This assumes that the admin will do the KYC and relevant checks to ensure the requester is legitimate and does not violate money laundering laws.

The business then requests for a loan using the invoice. The admin can then choose to approve the loan with a fee. This fee will be used to pay liquidity providers.

Once approved, the business can then claim the loan and use it for his business. When the loan has matured, the business will pay back the loan.

When liquidity providers withdraw their shares, they will receive more than what they have deposited due to the fees collected.

What I Learned

  • Writing the smart contracts on Stellar.
  • Learning how to make transfers using smart contract.
  • Testing smart contracts
  • Integration with the Freighter wallet for reading account balances and calling smart contracts

Difficulties Encountered

  • Difficulty of integrating the smart contracts with next.js
  • Initially contract calling was failing, due to various auth issues.
  • We created a custom token contract which anyone can mint from for demo purposes.

Proud of

  • We created a fully functional Dapp which completed the entire loan cycle. The transactions are all done on TestNet.

Roadmap

  • We would like to continue working on the project as it is interesting and have a real world impact.
  • We would like to seek funding and grants to take us further.
  • Refactoring of frontend and smart contracts to make it cleaner.

Image description

Additional Prize Categories: Super Sustainable

We’d like to be considered for super sustainable prize as we see real world applications with positive impact for entrepreneurs and SMEs to raise capital.

Team
@permaintern
@guigame
@zklim

Image description

Top comments (0)