Recent Blockchain Financial Discoveries

in LeoFinance2 months ago

Hi all,
long time no posting, as usual, I can say I'm particularly sorry this time, but I think i will let you understand it while explaining my discoveries.
Because there's always a happy side of things, even if what recently happened kept me away from writing for a long time it fostered my hunger for knowledge, and allowed me to discover many different financial realities that with my 2021 blockchain mind I didn't really recognize.

So as far as it seems there's bound for earning more this year on the blockchain, in a more decetralized way, hopefully.

Angle Protocol

While starting a solidity internship that should have allowed me to finally find some dev to work with on the ethereum ecosystem, I was recruited by two internship projects, one that I was interested in, a gaming project built to leverage yield tokens (erc4626) as long as Liquid pools erc20 tokens to create a basic play to earn dynamic and an investing dashboard project built on top of the angle protocol.
Angle protocol

The experience with both projects was a complete, total disaster, but I realized the reason is because there are more decetralized ways to get recognised on ethereum as a solidity developer, here is the most used.

So I'm guessing, the people on that bootcamp/internship were either ignorant of the ethereum developers ways (like me) or incapable of completing the speedrun bounties to get recognized.

But that's not the only thing I learned.

I won't speak about the two ethereum projects, in part because I know that you guys hate paying high amount of gas, (being used to hive efficiency doesn't allow for ethereum's L1 to be much digestible for us anymore, does it?) and in part because as I said before, I got hungry, and realized there's much more than the infamous Angle protocol out there, for that I have to thank my daily practice of dexscreener and defillama.

Mars protocol

mars protocol

The fact that I like the Cosmos blockchain shouldn't be a surprise, the interchain network is so much similar to how my dear Axelar network works, and Osmosis has some of the most interesting opportunities in DeFi these days, not mentioning the amount of gas that you pay there is not only low for the blockchain itself it's low interchain.

We'll dive into that when I'll explain IBS, please trust the process and follow my path, because I know many of you are looking for a way to get more out of their HIVE or HBD, so I will explain technicalities once they become meaningful.

Briefly Mars Hub which is a blockchain built on Osmosis to host the Mars Protocol financial services (loans and farms) happened to orbit right under my radar while i was poking with Axelar (use this link if you are a bot developer and you like rust, there's a lot to study over there, they can make you rich), and it's worth mentioning, because these guys are really smart.

What I'm gonna do here is explain how the Mars lending/borrowing smart contract works starting from a user point of view, and I'll be talking about their version 2 because the v1 is getting shut down soon, lots of people suggest v1 investing strategies on youtube for example, I want you guys to be more updated (and i don't like the looping strategy used on that channel, it's risky).

mission report

In the next post, given the fact that I am a rust dev, with more experience in rust than solidity, and clearly capable of making my two mentors angry by showing what I can already do, I'll be showing you guys how to query the loans smart contract for liquidations and run your own liquidation bot.
This way you'll be able to collect some initial funds to invest on mars even if you don't have money to invest now.

Liquidators can use flash loans to liquidate unhealthy debt positions on mars just like they do on angle protocol and they get rewards for cleaning up the mess, that's how you can collect the first tokens to invest.
Obviously the amount of gas is WAAAAAY lower on any cosmos blockchain, and that is the very reason why I'm talking to you guys about it.

This way you will slowly get the money to start earning from lending or farming.

Loan and Borrow on the Red Bank

I suggest using the Keplr wallet to login into the v2 mars lending interface.

On that page people mostly borrow stablecoins to spend by depositing a token they think will raise in value as collateral.
So you can deposit stablecoins for people to borrow and earn interest on it, while depositing you automatically open a credit position, so the mechanics of "automatically paying debt" may be at place if you make your calculations well.
After you have deposited you can borrow on the borrow UI, remember you must have a small amount of OSMO in you wallet (used for the gas fees).

HLS-markets.png

If you create a deposit and then credit account you are minting an NFT with metadata on the red bank smart contract.

asset-specific-risk-params.png

In the picture above you can find asset specific params for each deposit/borrowed token, I asked about this data in their discord and I was told that the liquidation bonuses and Loan to Value rations have changed,
this is the list of new params:

| Asset | Current Max. LTV | Current Liq. LTV | Current L. Bonus |
| axlUSDC | 79.5% | 80% | 7.5% |
| axlWBTC | 78% | 80% | 10% |
| axlWETH | 78% | 80% | 10% |
| ATOM | 74% | 75% | 10% |
| OSMO | 73% | 75% | 10% |

The mechanics of the smart contract are very different from what you would expect, it's never your wallet that borrows, it all happens in the smart contract, and this is the reason why liquidations are so cheap and there's no need for overcollateralization.

The multiple red bank smart contracts are connected to a liquidation engine that can liquidate any position, allowing the Red Bank to maintain its solvency, they are the real borrowers and your liquidation bot communicates with the contract in a dutch auction to liquidate unhealthy position.

The NFTs called "Rovers" are peculiar credit positions used to access Farms, that are liquid pools erc20 tokens investing strategies, approved by the mars council DAO.

HLS - High Leverage Strategies

HSL are specific borrowing strategies within the cosmos ecosystem created for capital efficiency up to 10x leverage, they can be described as specialized forms of credit accounts built for specific high rewards scenarios, the most important were built for liquid staking LP tokens.
Advantages of these strategies are a lowered liquidation risk based on details such as the correlation of borrowed assets.

farms-strategies.png

Steps to follow are:

  1. mint a HSL account
  2. supply assets (stATOM or stOSMO) into the relevant market
  3. choose the desired leverage (high = higher risks)
  4. approve transaction

Mars then loops the user's position until the desired leverage is achieved (yes this means this is looping).
Sadly these positions are the most lucrative on Mars by now, but I would keep this protocol checked weekly if I were you, apr/apy change quickly.

Each HLS has its own lending paramenters:

hls-params-risk.png

HSL-markets-example.png

Farms

On Mars Protocol you can farm Osmosis Liquid pool shares/tokens over a Rover account deposits and borrow against them as collateral.

If a user is exposed over the osmo token price (deposited on the rover account) but as long as the osmo farming rewards value exceeds the interest rate there's no risk of liquidation.

If instead of the single token the collateral consists of a Liquid Pool's tokens/shares (for example atom/osmo) then we need to look at the ratio of debt to collateral, if it exceeds a certain level (margin requirement) defined in the smart contract the LP share is liquidated to pay the debt back.

fields-of-mars1-farming-borrowing.png

Borrowing params against rover accounts and LP tokens:

farms-params.png

| Asset | Current Max. LTV | Current Liq. LTV | Current L. Bonus |
| axlWETH/OSMO LP | 75% | 77% | 12.5% |
| axlWBTC/OSMO LP | 75% | 77% | 12.5% |
| axlUSDC/OSMO LP | 75% | 77% | 12.5% |
| ATOM/OSMO LP | 73% | 75% | 12.5% |
| stATOM/ATOM LP | 64% | 65% | 15% |

Please use these last images to understand the risk assessment you need to do to manage your rover positions, first is a healthy position and second is a liquidation example:

fields-of-mars2-farming-borrowing-profit.png

fields-of-mars3-LP-shares-Liquidation.png

Looking forward for the next article, it will be posted on a dev community as I will go deeper into:

  1. how to build a data indexer to find unhealthy debt positions to liquidate
    2)how to run the standard liquidation bot against the red bank smart contract on Osmosis and neutron.
    We will need to understand how the interchain tokens are built in order to understand the debt position data so i will also explain IBS and how to decode them.

See you soon!

Sort:  

A beautiful post. I know very little about the Cosmos blockchain environment. Thanks for talking about it

I'll be posting something more soon, you're very welcome

This is interesting. I don't usually use these networks but I will definitely look into them. There are so many things in the crypto market that one cannot keep up with everything.

I agree, having to study it on the bootcamp really helped me in understanding how the earning works, I will probably swap my hbd to invest there if I find apy higher than 20%

But think that this 20% must be constant and take into account the rates. Otherwise you run the risk of chasing profitability.
It's a great article, promote it with the ecency points.

Ok, I'm trying it now, thanks for reading!!

!HUG

Dear @florakese, you just got hugged.
I sent 1.0 HUG on behalf of @jilt.
(1/3)

Congratulations @jilt! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You distributed more than 19000 upvotes.
Your next target is to reach 20000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP