PSP22 FlashMint
This example shows how you can reuse the implementation of PSP22 token with PSP22FlashMint extension, which allows the user to perform a flash loan on the token by minting the borrowed amount and then burning it along with fees for the loan.
#
1. Implement the FlashMint extensionFor your smart contract to use this extension, you need to implement the PSP22FlashMint
trait in your PSP22
smart contract. Import everything from brush::contracts::psp22::extensions::flashmint::*
and inherit the implementation for PSP22FlashMint
trait. You can also customize (override) the original functions from PSP22FlashMint
.
use brush::contracts::psp22::extensions::flashmint::*;
impl FlashLender for MyPSP22FlashMint {}
And that's it! Your PSP22
is now extended by the PSP22FlashMint
extension and ready to use its functions!
You can check the full example of the implementation of this extension here.
You can also check the documentation for the basic implementation of PSP22.