Glue's implementation of single flash loans, providing a secure and efficient borrowing mechanism. This implementation offers several key advantages:
- Standardization: Glue ensures interoperability with other platforms and protocols that implement this standard.
- Security: The implementation includes strict checks on loan repayment and uses OpenZeppelin's safe transfer functions to prevent reentrancy attacks.
- Transparency: Each successful flash loan emits a GlueLoan event, enhancing traceability and auditability.
- Low fees: Glue charges a competitive 0.01% fee for flash loans, making it an attractive option for arbitrage and other short-term borrowing needs.
Technical Implementation
<aside>
š”
To use this function, you must use GlueERC20
or GlueERC721
contract of a specific Sticky Token. To better understand the Glue Ecosystem architecture and find the correct deployment addresses, visit visit Lore and Architecture | License & Deployments
</aside>
Technical Flow:
- Borrower callsĀ
flashLoan()
Ā for a specific amount of an asset from a Glue address
- Contract transfers tokens to borrower
- Executes borrower'sĀ
onFlashLoan()
Ā callback
- Verifies repayment of loan + 0.01% fee
- Reverts if repayment fails
Implementation Details
The implementation of Glue's Flash Loans are designed to provide a secure, efficient, and standardized borrowing mechanism. Single Flash Loan are designed to call a precompiled and simplified Glued Loan (more info Glued Loans, to start a Flash Loan you need:
- Calldata
- Callback
- Pre-calculated payback data (no math operations required)
- Balances Check
Building a Glued Loan Receiver