Comment on page
FlashAngle - Instant AgToken liquidity
Flash loans on top of Angle Protocol stablecoins
FlashAngleis a contract to take flash loans on top of Angle Protocol AgTokens. With this contract and for a whitelisted stablecoin, any address can take a flash-loan of
The innovation here is that stablecoins given out in flash loans are minted during the transaction and burnt at the end of it: this means that this contract could be used to take theorically uncapped and free flash loans on Angle Protocol stablecoins.
Initializable. This contract is upgradeable.
core: Reference to the
stablecoinMap: Maps a stablecoin to its associated parameters and reference, that is to say: the
treasurycontract associated to the stablecoin, the maximum amount borrowable through a flash-loan and the fee taken on each flash loan.
Some functions can only be called by the
CoreBorrowcontract as such a custom modifier
onlyCorehas been defined. This contract also reads in its associated
corecontract to know whether addresses have the guardian role.
All standard ERC3156 methods are implemented, such as
bytes calldata data
) external returns (bool);
flashLoanimplementation differs from other standard implementations in that stablecoins are minted to the
This address must have a function
onFlashLoanto receive the flash-loan, and this function should return
keccak256("ERC3156FlashBorrower.onFlashLoan")after being called. If there are some fees setup for this function, then if
amountof stablecoins have been sent to the
amount + amount * feeswill have to be burnt from the
This function will revert if it is called on a token, that is to say a stablecoin, that has not been whitelisted.
If fees are taken, then this contract may make revenue. There is a
accrueInterestToTreasuryfunction to pass these fees to
Treasurycontract responsible for doing the accounting of profits and losses.
There can never be a loss by the
FlashAnglecontract can be made aware that it supports a new stablecoin by associating a non-zero treasury address to the stablecoin address in the
This can be done by the
corecontract in the
corecontract can also remove a stablecoin through the
removeStablecoinSupportfunction, or pass its role to another contract with the
Parameters for flash loans and for a given stablecoin can be changed by governance with the