Managing Borrow Positions
Moving assets between positions and opening/closing borrow positions is easy with the BorrowPositionRouter. You can find the address on the Smart Contract Addresses page.
Transferring Assets
library AccountBalanceLib {
/// Checks that either BOTH, FROM, or TO accounts do not have negative balances
enum BalanceCheckFlag {
Both,
From,
To,
None
}
}
interface IBorrowPositionRouter {
/**
* @param _isolationModeMarketId The market ID of the isolation mode token
* (0 if not using isolation mode)
* @param _fromAccountNumber The source account number
* @param _toAccountNumber The destination account number
* @param _marketId The ID of the market to transfer
* @param _amount The amount to transfer
* @param _balanceCheckFlag Flag indicating how to validate account balances
*/
function transferBetweenAccounts(
uint256 _isolationModeMarketId,
uint256 _fromAccountNumber,
uint256 _toAccountNumber,
uint256 _marketId,
uint256 _amount,
AccountBalanceLib.BalanceCheckFlag _balanceCheckFlag
) external;
}Examples
Opening a Borrow Position
Examples
Closing a Borrow Position
Examples
Last updated
Was this helpful?