Magic Internet Money Review
When the Abracadabra team contacted me to license my isolated lending contract code (known from Kashi) for Abracadabra I didn’t quite understand how it would all work. But having recently just aped in with about $55k, I have to say it’s quite interesting.
What follows are just some personal notes, shared for others to maybe learn from to understand the protocol’s internals and to help the Abra team improve the UI. Sorry, not a very well written piece, more of a brain dump. It’s not advice of any kind and there could be plenty of mistakes.
The way I used it was to take USDT, deposit that into the USDT yearn vault v2, deposit that as collateral into Abracadabra, borrow MIM and sell the MIM for more USDT and then repeat the process. All the way to having $365k of yvUSDT as collateral. Since yvUSDT has an APY of around 8–9%, this should yield me about 55% APY.
There are obviously some risks:
- Exploits due to bad contracts
- Yield on yvUSDT drops
- Price of USDT drops and causes liquidation
- Other issues I haven’t thought of
There are also some interesting failure scenarios. If MIM loses it’s peg, I win… I would buy MIM for less than $1 and so it would become cheaper to repay my loan. But in turn this would drive the price of MIM up, so it would stabilize and soon recover peg. If MIM goes over $1, it’s a good time to borrow more and repay when MIM is back at $1. This again drives stability of the peg.
So overall I’m pretty happy with this investment and after doing a quick review of how the different values are calculated I may grow this position. My main concern is the stability of the yearn yield. I’ll revisit this in a few weeks to see what my actual APY has been.
This contract is similar to the Chainlink oracle used in Kashi markets. It get a price from Chainlink and then uses the following call to get the yearn vault price:
It’s important to note that the system assumes that the price of MIM = USD. So if the price of MIM would go over $1, this doesn’t seem to lead to liquidations.
This contract is based on Kashi and I licensed the code to Abracadabra for MIM. It’s a simplified version, because the interest rate is fixed and there is no lending, only borrowing.
My position is 314052741825296029002396 borrow parts and my collateral share is 365346401761. Let’s see what that means:
To convert from borrow parts to borrow token amount, we need to look at totalBorrow. We need to multiply our parts by the elastic and divide by the base:
314052741825296029002396 * 25445847382273525419267697 / 25442289703942533805642019 = 314,096,656,844,242,111,628,733
When you take the 18 decimals into account, we get 314,096.656 MIM borrowed. The UI currently shows parts, not amount. So keep this in mind. This will probably be fixed soon.
Now let’s check the collateral. We need to convert from share to amount using the BentoBox.toShare function. Although it’s still 1:1 right now. Then we need to get the price from the oracle by passing the oracleData on the cauldron contract into the peek function of the oracle. I get 990155. We have to divide to get the USD value of our collateral:
365346401761 / 990155 = $368,979.000 USD
This matches what is displayed in the UI. So my true collaterization ratio is 314,096.656 / 368,979.000 = 85.125% and the net value is 368,979.000 - 314,096.656 = $54882.344
Opening and closing a leveraged position is a little tricky at the moment, requiring ‘looping’. However, this is a UI limitation, as the contract has the ability to borrow MIM first, do all the swaps and then provide the collateral. As long as this is done in a single transaction and the collateral covers the MIM borrowed, this will work. Would be great to see this added to the UI :D
Update 27 June 2021
About 17 days have passed.
Borrow = 314052741825296029002396 * 21894779038779209323174401 / 21883650006387073379645963 = 314,212,454,813,558,623,568,379
Which is 314212.454 MIM (Increase of almost 116 MIM)
So it looks like the UI does show the borrow balance in MIM, but does NOT show the interest accrued.
The yearn price per share has gone up to 1.010276 This is an increase of 0.1207% over 17 days. That would imply an APR of 2.59%. (Yearn site is showing 2.71%, so it’s in the ballpark.)
The oracle now returns 988862, so the collateral is worth 365346401761 / 988862 = $369,461. This is a gain of $482. Subtract the borrow cost of 116 MIM and the net gain is $366. Which is a gain of 0.66% over the $55,000 principle. That’s an APR of 14.2% on USDT. Not as high as hoped, but yield have come down across the board it seems. The UI shows collateral of $369,103, which isn’t right.
Aave: 2.60–3.51% (+ 2.10–2.71% in stkAAVE?)
Compound: 2.24% (includes COMP rewards)
Yearn looped with MIM: 14.20%
Kashi xSUSHI-USDT market: 14.30% (mostly SUSHI rewards)
So far so good… at least it’s outperforming straight yearn by 5.23x
Update 8 August 2021
Another 6 weeks have passed. Total 59 days now.
Borrow = 314,487 MIM (Increase of 391 MIM, UI still not correct)
Yearn pricePerShare = 1015150, oracle = 984600
Collateral = 365346401761 / 984600 = $371,060
Gain = $2081-$391 = $1690 = 3% = 19% APR
Caveat: This assumes MIM — USDT exchange rate of 1:1 but currently MIM is a bit below peg. The borrow is only 308019 USDT. So currently it’s a bad time to open a position and a good time to get out.
P.S. I earn SPELL tokens because the licensing fee is paid in SPELL (vesting over 4 years)