Collateral Management

The user may add or remove collateral to / from an open position.

Adding collateral

Increase the margin of a position by depositing additional collateral.

function depositCollateral(bytes32 loanId, uint256 depositAmount) external payable nonReentrant whenNotPaused 

Arguments

Name
Type
Description

loanId

bytes32

A unique ID representing the loan.

depositAmount

uint256

The amount to be deposited in collateral tokens.

Removing collateral

Withdraw from the collateral. This reduces the margin of a position. Note that it is not possible to reduce the margin below the maintenance margin. If attempted, as much collateral as possible will be removed, leaving the position at the maintenance margin level.

function withdrawCollateral(bytes32 loanId, address receiver, uint256 withdrawAmount) external nonpayable nonReentrant whenNotPaused 
returns(actualWithdrawAmount uint256)

Arguments

Name
Type
Description

loanId

bytes32

A unique ID representing the loan.

receiver

address

The account getting the withdrawal.

withdrawAmount

uint256

The amount to be withdrawn in collateral tokens.

Returns

The amount withdrawn

Last updated