GammaSwap Docs
Search
K

Technical Documentation

How to use GammaSwap Flash Loans
Functions for Flash Loans
function _rebalanceExternally (uint256 tokenId) - Allows the withdrawal of collateral from the GammaPool measured in terms of liquidity invariant units. The user just has to return this collateral amount in terms of liquidity invariant units in the same transaction. The user needs to have an existing loan to do this and if the loan has collateral, the loan collateral can be returned in a different ratio. However collateral borrowed beyond the loan’s collateral amount must be returned in the same amounts that were borrowed. This function works by calling the ExternalLongStrategy contract.
function _liquidateExternally (uint256 tokenId) - Works the same way as rebalanceExternally but during loan liquidations. For that reason an existing loan a user does not own that is undercollateralized can be used to borrow liquidity out of the GammaPool. The liquidator must repay the borrowed liquidity in the same transaction and liquidate the loan fully at the end of the transaction.