2ī¸Flash Loan
An uncollateralized loan in NAVI that must be repaid within the same Sui transaction.
The following functions provide users the ability to take out and repay flash loans from a specified pool. A flash loan allows users to borrow assets with the condition that the loan must be repaid within the same Sui transaction. If the loan is not fully repaid, the transaction reverts, ensuring that no loss occurs for the pool.
flashloan_with_ctx
This function allows a user to take out a flash loan of a specified amount of a certain coin type from a pool. The loan must be repaid within the same transaction. A FlashLoanReceipt
is generated to keep track of the loan details.
example:
https://suivision.xyz/txblock/8LfrMrZL5msEvYWtayX8ELXZJRnXGnzZJSBgTjfsah5Y
repay_with_ctx
This function handles the repayment of a flash loan. It takes in the loan receipt, the repayment balance object, and updates the pool's balance accordingly. If the loan is not repaid in full, the transaction will revert. The rest will be returned as a balance object.
example:
https://suivision.xyz/txblock/8LfrMrZL5msEvYWtayX8ELXZJRnXGnzZJSBgTjfsah5Y
flashloan_with_account_cap
This function facilitates the repayment of a flash loan while leveraging an AccountCap
. It adjusts the poolâs balance and ensures the loan is settled. If the loan is not fully repaid, the transaction will revert. The rest will be returned as a balance object.
example:
https://suivision.xyz/txblock/8LfrMrZL5msEvYWtayX8ELXZJRnXGnzZJSBgTjfsah5Y
repay_with_account_cap
This function allows a user to take out a flash loan while utilizing an AccountCap
. The AccountCap
serves as an agent layer during the loan process. The function returns both the loan balance and the receipt for tracking the loan.
example:
https://suivision.xyz/txblock/8LfrMrZL5msEvYWtayX8ELXZJRnXGnzZJSBgTjfsah5Y
Last updated