Repay

How to close a position on the Sovryn Protocol.

Close with Deposit

closeWithDeposit closes a loan partially or completely by depositing loan tokens to the Sovryn Protocol. Note: It is also possible to close with a swap, see Margin Trading.

function closeWithDeposit(bytes32 loanId, address receiver, uint256 depositAmount) public payable nonReentrant globallyNonReentrant iTokenSupplyUnchanged whenNotPaused 
returns(loanCloseAmount uint256, withdrawAmount uint256, withdrawToken address)

Arguments

Name
Type
Description

loanId

bytes32

The id of the loan.

receiver

address

The receiver of the remainder.

depositAmount

uint256

Defines how much of the position should be closed. It is denominated in loan tokens. If depositAmount > principal, the complete loan will be closed.

Returns

the amount of the loan which was closed, the amount of the collateral token which was withdrawn to the receiver, the collateral token address of the loan

Last updated