I think it’s fairly straightforward to add flash loans into mango. The design is something like:
- transfer requested amount from Mango vault into user account
- invoke requested program (CPI)
- transfer the loaned amount back into Mango
One example use case is trading on any serum dex market using the mango SRM or MSRM for fee discount. For example:
- transfer 1m SRM into user’s account
- place serum dex trade
- transfer 1m SRM back into Mango vault
- should there be a fee to use this?
- Who should get the fee? Lenders? Mango DAO? (it’s a bit tricky to give the fee to lenders)
Here are the flash loan fees for some protocols on Ethereum:
- Aave: 0.09% (call
- Maker: 0% (call
toll() here), was lowered to 0 after dY/dX released the free product
- dY/dX: 0%
All flash loan fees I’ve seen go to the relevant DAO, which makes sense since lenders aren’t taking on any additional risk by providing them. Intuitively, t’s a protocol service rather than p2p.
My impression is that we will inevitably lower & and then get rid of the fee altogether once competing protocols emerge, but starting with a 0.05% fee or something like that, going to the DAO, makes sense to me.
How composable would this be with other protocols beyond Serum? Like, flash loaning and then going through some of the AMM’s on Solana to find arbs?
5 basis points (of the borrowed amount) is way too much to be worth it to get reduced fees while trading on serum dex. Feel there is little value in offering flash loans as it is a 0 fee product that any of the dedicated lending protocols can build.
Fully composable in theory, but in practice, not that much because of compute limits and tx size limits.
But it’s really easy to build and I could get it into the next release (I think). I imagine main use case is to reduce fees on all serum trades. It will give people a reason to open up our git repo and learn enough to use this feature. And we can later build out the UI to make the Mango UI also a Serum spot UI.
Main value is in getting more people to take a look at Mango.
Agree with both Max and Daffy.
Doubt it will be used much but it makes mango protocol more feature complete.
thoughts on mango having tradFi type total return swaps?
go long mango without owning it,
get paid base rate+interest payments over time for lending mangos out over a locked amount of time, 3mo 6mo 12mo etc
do you think mango would benefit from something like this