Background Circle Background Circle

How to Borrow & Lend Crypto with MarginFi

Cryptocurrencies are not just for buying and selling. They can also be lent and borrowed. But how exactly can we facilitate such transactions on a blockchain like Solana? In this post based on a tutorial, we explore lending and borrowing crypto on Solana using the decentralized app (dApp), Marginfi.

Prefer video content? Watch the video on YouTube

Getting Started With Marginfi

Marginfi provides a platform for lending our cryptocurrencies to earn an APY (Annual Percentage Yield), and we can also borrow cryptocurrencies if needed. Here’s an example: if we have some Ethereum (on the Solana blockchain), wrapped BTC, or SOL, we can deposit it into the protocol, earn a small yield and then borrow, say, some USDC or USDT.

Other dApps facilitate borrowing and lending, like Solend, where you can see the supply APR and the borrow APR. However, this post focuses on Marginfi for several reasons including its user interface and its unique feature of margin points.

*NOTE: The context of this blog post is July 3, 2023, but it’s worth noting that product features may evolve with time.*

Marginfi Points

Users can earn points by lending and borrowing assets and referring new users.

Lending Points = Every dollar lent earns 1 point per day. The more you lend, the more points you earn.

Borrowing Points = $1 borrowed will earn 4 points per day.

Referral Points = A referring user will get 10% of the points the users they refer earn.

Marginfi also has a referral and leaderboard system and gives a detailed explanation of the point system on Twitter (X). The exact use of these points is yet to be determined but they add an interesting layer to the overall user experience.

Exploring Stablecoins: UXD, USDC, and USDT

Now, before we get into the nitty-gritty of lending and borrowing, let’s get familiar with a stablecoin, UXD. This is similar to other stablecoins like USDC or USDT except that when borrowing UXD, the annual cost is slightly higher. However, lending UXD provides a better return compared to lending USDC or USDT.

UXD is essentially a protocol that hosts a decentralized stablecoin stabilized by an asset liability management module. It is live not just on the Solana blockchain, but also on Ethereum Virtual Network Arbitrum and coming soon to Optimism (another Ethereum Virtual Network).

With UXD, you can swap your UXD to mint USDC/USDT, and when you swap your USDC back to UXD, you get the same amount minus a small swap fee.

Lending and Borrowing Process: A How-to Guide

To lend or borrow assets on Marginfi, the first step is to connect a wallet, preferably Phantom.

Having connected your wallet, you can deposit some assets. Here’s a step-by-step guide on the same:

Step 1: Swap your USDC into UXD.

Step 2: Click on Max to add all of your UXD or manually input the amount you want to deposit.

Step 3: Click on Supply, approve the creation of an account with a small amount of SOL, and in the next transaction, send the UXD.

At this point, you would have deposited into your UXD. You can also deposit SOL or USDC, the protocol constraints apply. The next step is to borrow.

To borrow a token:

Step 1: Go to the Borrow section.

Step 2: Choose the token you want to borrow. I’m borrowing SOL and ETH as shown in the screenshot below.

Step 3: Input how much you want to borrow and approve the transaction.

A critical component to observe while borrowing is the health factor, which should be kept in the green as a good practice. If the health factor decreases or is in the red, the UXD and USDC we deposited will be sold to pay back the loans for SOL and ETH if their prices increase.

Paying Back the Loan

If you want to repay your loan, scroll down to the bottom and click on Max and Repay. If you receive an insufficient fund error, do a small swap to cover the interest and try paying back the loan again.

Such a process helps in keeping your stablecoins earning yield. If you’re lending with UXD, you earn UXP, the protocol token.

To claim your token, you need to pay a small amount of SOL rent reserve, following which you can claim your token and they will be stored in your wallets.

You can swap your UXP on Jupiter, or you can use it as you deem fit.

Final Thoughts

Margin lending gives crypto owners and traders an efficient way to earn, give loans, and take loans. Its interface is user-friendly and the process is smooth. It works with risk, interest, and benefits, like any financial system. As the ecosystem grows, one can expect such platforms to evolve and offer much better services. Stay curious, and catch you in the next post!

Disclaimer: This is a helpful blog. Follow me on my socials but remember this is NOT FINANCIAL ADVICE. I won Royale 2, and I am making this content as a community member because it is great to learn crypto, playing on Solana is fun, and it is easy to onboard friends into the space with a game like this.
My opinions are my own, research more if you wish, and if you decide to degen, that is your decision!

Follow me on X: https://x.com/SebMontgomery

Leave a Reply

Your email address will not be published. Required fields are marked *