Loan Repayment
Last updated
Last updated
When you are ready to settle your debt and release your collateral, you “close” the Margin Account.
Closing is a single on-chain transaction that (1) repays the borrowed amount plus all accrued interest to the Liquidity Pool and (2) returns every remaining asset in the Margin Account back to your wallet.
As each Margin Account is associated with a loan it has taken from the Liquidity Pool, "Repaying the Loan" means "closing Margin Account".
Debt + Accrued Interest in the account
The Margin Account must already hold the exact borrowed asset (e.g., USDC, USDT, wETH) in a quantity covering Total Debt + Accrued Interest.
Healthy gas balance in your signing wallet
You will need ETH for gas to sign the close-account transaction.
No pending trades in your WalletConnect session
Pending swaps can change balances; complete or cancel them before closing.
If the Margin Account balance is short of the required debt amount, the Proceed button in the Portal remains disabled.
Within "Borrow" -> "Opened", choose the Margin Account you want to close and click on it.
By clicking on a specific Margin Account, a user is navigated to a dedicated page for interacting with that Margin Account.
Below the Trade with Wallet Connect button, you can find "Close Credit Account," which refers to repaying the loan and closing the Margin Account.
To repay the loan (close Margin Account), the Margin Account address must have the borrowed amount of the asset plus accrued interest.
By clicking "Close Credit Account" an Asset Manager is navigated to the page to initiate the process of the Margin Account loan repayment.
However, if the Margin Account does not contain enough borrowed asset tokens and accrued interest (also in borrowed asset tokens), the Proceed button will be disabled.
Proceed is disabled until Margin Account contains enough of Total Debt
There are two ways how an Asset Manager can get Debt + Accrued interest to the Margin Account:
Direct deposit to the Margin Account address the necessary amount of tokens (48.81413 USDT in this example). - The Arkis team recommends this option as the fastest and easiest to implement.
Sell, exit from available positions on the Margin Account, and swap them to the necessary amount of Total Debt.
Once the Margin Account has the necessary amount of borrowed tokens, the Proceed button will become active.
Once an Asset Manager signs the transaction to close the Margin Account, the protocol does the following:
Analyses the amount of borrowed assets (Total Debt + Accrued Interest) to be sent into the liquidity pool. Please note that the protocol will only take the total debt plus the interest amount. Any surplus will be returned to the wallet of the Asset Manager who originated the loan.
All other whitelisted assets (tokens, PT, LP positions) within the Margin Account will be transferred back to the Asset Manager's wallet.
Why is this important?
As you can see, when Margin Account is closed, the protocol takes only what Margin Account owes to the Liquidity Pool, the rest is returned to Asset Manager's wallet.
If an Asset Manager wants to liquidate Margin Account portfolio themselves (using other protocols, or some specific techniques) or don't want to exit positions at all to close the loan - they only need to send borrowed amount + interest to the Margin Account address and they will get everything else back to their own wallet once Close Margin Account procedure is successfull.