Open a Borrow Position
Opening a borrow position is simple
Depositing or withdrawing into Dolomite is easy with the
BorrowPositionProxyV1
. You can find the address for BorrowPositionProxyV1
here.library AccountBalanceLib {
/// Checks that either BOTH, FROM, or TO accounts do not have negative balances
enum BalanceCheckFlag {
Both,
From,
To,
None
}
}
event BorrowPositionOpen(
address indexed _borrower,
uint256 indexed _borrowAccountNumber
);
/**
* @dev Transfers collateral from the source account number to the destination account
* number. Emits a `BorrowPositionOpen` event before the Operation executes.
* This enables the offchain data indexers to see the position being opened and
* start watching for Actions.
*
* @param _fromAccountNumber The index from which `msg.sender` will be sourcing the
* deposit
* @param _toAccountNumber The index into which `msg.sender` will be depositing
* @param _collateralMarketId The ID of the market being deposited
* @param _amountWei The amount, in Wei, to deposit
* @param _balanceCheckFlag Flag used to check if `_fromAccountNumber`,
* `_toAccountNumber`, or both accounts can go negative
* after the transfer settles. Setting the flag to
* `BalanceCheckFlag.None=3`
* results in neither account being checked.
*/
function openBorrowPosition(
uint256 _fromAccountNumber,
uint256 _toAccountNumber,
uint256 _collateralMarketId,
uint256 _amountWei,
AccountBalanceLib.BalanceCheckFlag _balanceCheckFlag
) external;
This part of the docs is still under construction 🚧