SCF #12
Award Completed
XycLoans
by

A flash loans protocol with its own liquidity management on Soroban.

Awarded
Awarded
Budget request:
$
31,800
*
WebsiteCode

Project Stage

Development

Category

Soroban
DeFi

Based in

Team size

2

Active since

Products & Services

Our goal is to finish building in ~3 months the working prototype of a decentralized ecosystem to borrow money through flash loans and to generate healthy yield by lending.

As the term "ecosystem" hints, we envision XycLoans not only as a protocol but as a protocol + other components, making it effectively an ecosystem.

There are 4 main components in XycLoans:

- the smart contracts.

- backend functions to build a database, scale, and make the front end faster.

- a web app to graphically develop contracts that use flash loans without coding knowledge.

- a high-quality web app for lenders to manage their liquidity.

## The Protocol

We have already written the PoC contracts for the protocol, which can be found here. We also already have simple tests that show how borrowing and lending would work and we are looking forward to making more complex tests for edge cases. The specifics of how the protocol works are written in the Litepaper, which we recommend reading (sections 4 and 5) if you wish to understand the math and workflows under the hood when lending and borrowing.

## Backend functions

In order to scale more efficiently and make the front ends faster, we'll write and deploy a set of backend functions that listen for contract events such as when the vault mints new fee shares or when the vault pays out the yield to lenders. The functions will subsequently build a database that can be queried by the front end (for example, the total profit of a lending token pool).

## Contract-building app

Flash loans usually target developers and other DeFi protocols, but having a web app like Furucombo that allows leveraging flash loans and profit from them will expand the target audience also network-wise.

## Lenders app

In a DeFi protocol, a high-quality web app that allows investors to manage their money is crucial. This web app will allow lenders to efficiently provide and monitor their liquidity in the various token pools, and know how much yield they are earning.

No items found.
Previous Project(s)
SCF #11
Award recipient
sTeX
A modern cloud LaTeX editor with a google docs alike UX and UI, and a built-in Stellar decentralised documents marketplace.
Learn more
SCF #10
Award recipient
Xycloo: sTeX & Stensitive
Stellar-based modern LaTeX editor, sensitive data storage on Stellar & more.
Learn more
Progress so far
Goals
To get there, we request a budget of  
$
31,800
*
  to:
Additional information

# What are flash loans?

Flash loans are a financial instrument that makes uncollateralized borrowing possible thanks to a smart contract’s ability to revert a state-changing transaction in the event that a particular condition is or is not met.

This allows a contract to lend money and revert the transaction if the borrower doesn’t return the money plus interest. Flash loans thus happen within one transaction, which will fail if the borrower can’t repay the loan.

Their use case is still being pioneered, but there already are some well-known activities that are improved with flash loans:

- arbitrage trading.

- CDP liquidation.

- Collateral swapping.

- Unwinding debt positions.

These use cases are better described in the last section of the Litepaper.

# Budget

The "Deliverables & Budget" section will show what we intend to use the budget for. Most of the budget is for our development and deployment costs, but deliverables like:

- the app for lenders and possibly also the contract-building app will require us to hire a professional front-end developer in order to deliver a high-quality application. We will however take care of everything related to querying data and interacting with Soroban.

- the instructional videos and graphics will require us to hire a digital video expert.

# The lenders' app

The app will have:

- a dashboard where the lenders can monitor where their money is and how much they're earning.

- a page for every pool the lender has put money into, with stats about the investment (how many fee shares they own, how much money they amount to, etc) and with controls to provide more liquidity or withdraw fees.

- a page to explore the various pools available in the protocol.

- a page with the stats of each pool (total value, historical earnings, etc).

Pitch deck
No items found.
Deliverables
First Deliverable

As the code of the protocol is already prototyped, the next step for us is to deploy our own standalone network, build the whole protocol there, and perform continuous testing of different scenarios on both cargo tests and on the network in order to flush out any potential scaling/security issues.

Completing this deliverable for us means having the protocol working on our standalone network with no major bugs and scaling issues.

Also, given the latest Soroban SDK release, we'll have to update our contracts.


Reviewer instructions

The first part of our first deliverable was to upgrade the contracts to the latest soroban sdk (0.6.0) with all the auth next changes as well. This was completed by the end of February and can be verified by looking at the Xycloans workspace on GitHub:

The second part of the first deliverable was deploying the whole current version of the protocol to a standalone network, but after some thought, we leaned towards deploying it on futurenet (the entire code is public anyways).

To verify this, you can try the protocol out on Futurenet by providing liquidity and/or borrowing from our XLM flash loan, here's the documentation for doing so.


The last part was testing on both the Rust and on-chain sides. On the rust side we've tested (some of these already existed, we just had to adapt them to the newest sdk release and other updates):


On the on-chain side, we've made a lot of progress since we've been able to tackle some issues we've encountered along the way of running outside rust tests (you can take a look at our GitHub commits and PRs to see what the issues where and how we fixed them).

After deploying, we've done some testing and written a documentation repo on how to use XycLoans on Futurenet. In that repo, you'll also find scripts that will simplify the process and let you avoid directly using the soroban CLI.

Tests we made are:

  • auth tests.
  • deposits.
  • successful/unsuccessful flash loans.
  • providing liquidity.
  • fee withdrawals.


You can go ahead and try the scripts out to verify that these tests are passing (remember to change the params in the scripts according to the README as running the scripts on the pre-existing accounts may result in expected errors, such as for example not having enough balance for the deposit anymore (changing parameters is not needed for the unsuccessful flash loan and the auth tests)).


We're thrilled with the results of this first deliverable: we've cleared some important bugs that we didn't catch in rust tests and this testing period allowed us to deliver a fully-working protocol which also proved to be pretty upgradeable (and we are waiting for the next release where we'll be able to build addresses from contract id bytes without the testutils to make vaults and flash loan independent from each other which will further help upgradeability).

Links:

Team

Federico De Ponti

Studying economics. Passionate about programming, blockchain, and scalable management technologies.

Tommaso De Ponti

Full stack developer with extensive experience with Stellar, also part of the Soroban Stellar Quest team.

We think our team has the potential to deliver this project because:

- we are already familiar with the stellar ecosystem and its community.

- we have been working closely with soroban since its early releases.

- we have contributed to Soroban with learning material and tools, check them out at https://xycloo.com/

- we are giving regular updates about the development of sTeX (previous SCF winner) and will do the same for XycLoans (which is also already open source).