The Glued Loan Receiver simplify the management and development of Flash Loans and Glued Loans Get Flash-Loans from collateral, our library to natively interact with Glue and take advantage of native Glue functions. To start up your Loan Receiver implement Expansions Pack to your project:
To implement the Expansions Pack you can go on Github or easily install via npm
npm install @glue-finance/expansions-pack
After import Expansions Pack to your project you just need to import GluedLoanReceiver
into your asset:
import {GluedLoanReceiver} from "@glueExpansionsPack/contracts/base/GluedLoanReceiver.sol";
// If you need external interactions import also IStickyAsset Interface
import {IGluedLoanReceiver} from "@glueExpansionsPack/contracts/interfaces/IGluedLoanReceiver.sol";
// Enounce Sticky asset in your contract
contract MyArbitrageBot is .., .., GluedLoanReceiver {...}
🎉 Congratulations! You've successfully implemented Sticky Asset! Here are all the advantages you now have access to:
By implementing GluedLoanReceiver, you can drastically simplify your flash loan development and focus on complex arbitrage logic. You won't need to worry about implementing loan requests and repayments—whether for single flash loans or multiple Glue glued loans.
Here are the advantages of using GluedLoanReceiver in your contracts:
👁️🗨️ Advanced Integrations: Native integrations with simplified functions like maxLoan
, multiMaxLoan
, getFlashLoanFeeCalculated
, and getLoanPlan
to check loan status before executing it.
🥹 Simplified Requests: Loan functions and logic are built in—just input the amount, asset, and Glues you want to borrow from..
🤖 Auto-Repayment: Both simple repayment logic for a single FlashLoan and multi-Glue Glued loans are automated—you only need to implement the loan logic, and we handle the rest.
🧠 Rich Data: All necessary information like repayment amounts and received amounts are automatically passed to _executeFlashLoanLogic
, the function where you implement your arbitrage logic
Expansions pack comes with Glued Math integrated, our math library that simplifies classic math operations in Solidity programming. It includes ultra-precise fixed-point math operations and tools to adjust decimal places between different tokens and ETH.
We built Glue and Glue Expansions using GluedMath.sol, and it's been transformative! Both GluedLoanReceiver and StickyAsset come with GluedMath's capabilities built in, making it easy to implement these functions in your own logic.