Flash Loans Specifically for AlgoFi Version Transitioning

Proposal to add a version transitioning support mechanism for quickly transferring collateral/debt between platform versions.

I am by no means an expert on how to implement, potential pitfalls, nor can I provide good examples of how this might work. However, I highly doubt the v2 transition will be the last major upgrade to the platform, and I believe the flash loan capability, when applied with a very narrow focus of transitioning between platform versions, may be of use to the community.

I hope the subsequent discussion on this temperature check will be educational for those of us who are in support of AlgoFi and are lacking some deeper technical understanding.


This is a good thought, but unfortunately it is not possible. As John said its something we probably could figure out for the v2 to any future products, but the v1 is not composable (just one of the many things we improved in the v2), so you can’t string multiple operations together.

This type of thing DEFFINITELY can be done in the v2, but no need for a governance vote, the protocol itself is permission-less and and any algorand dev could string together transactions with flash loans to do more complicated things atomically. I think the really good idea here is if we build something requiring a migration in the future (I don’t think we will, the v2 is designed to be modular so things can keep getting built on top), but if we do we should try to add a 0 cost flash loan (current flash loans cost 0.1%) that allows atomic 1 click migration, if possible depending on the use case.


On Reddit there was a post from someone asking for a way to repay loans from collateral with a single button press. Could the idea outlined here be used as a way to have a repay from collateral in a single button press?

I expected that this type of solution would not work for a v1>>v2 transition. And with v2’s modularity, it may be a moot point. At the same time, while a third-party may be able to provide a solution, it presents a sensitive trust issue to employ a third-party for this purpose.

If a new version is required in the future, IMO, it would be best if AlgoFi provided an official migration tool. It eliminates the trust issue, and could also help create a defined sunset period for the previous version. Users can choose to migrate at will, or be forced to migrate after a certain deadline.

I think it would make more sense to (atomically) borrow from the newer protocol version, repay the old protocol’s debt, withdraw the old protocol’s collateral, then deposit the collateral into the new protocol. I believe this method would make the old protocol’s liquidity irrelevant, only the liquidity of the new protocol would matter.

The biggest challenge in my mind is the vAlgo locked into governance. The tool would have to check whether vaulted Algo’s are contributing significantly to the user’s collateral. If all non-vAlgo assets are sufficient collateral for the new loan, the atomic transaction could proceed. If that check failed, the atomic transaction could not proceed.

Yh @pcolella I think the V2 should handle a lot of good stuff on the Algofi protocol and we are here to support the platform’s growth.

I have heard nothing but down sides for flash loans and allowing for manipulation. What purpose of implementing flash loans actually serve besides. Wanting a one button solution?

Flash loans are already implemented on Algofi. I think this proposal was to use flash loans for a one button press for moving assets between versions of the lending markets.

You are correct, the intent was to provide a simplified migration solution.

1 Like