Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ bytes memory loanDataBytes

```receiver``` is the user's address.

```swapAmount``` defines how much of the position should be closed and is denominated in collateral tokens (e.g. rBTC on a iSUSD contract). If ```swapAmount >= collateral```, the complete position will be closed. Else ```(swapAmount/collateral) * principal``` will be swapped (partial closure).
```swapAmount``` defines how much of the position should be closed and is denominated in collateral tokens (e.g. rBTC on a iSUSD contract). If ```swapAmount >= collateral```, the complete position will be closed. Else if `returnTokenIsCollateral == True` ```(swapAmount/collateral) * principal``` will be swapped (partial closure). Else the closure amount will be the principal's covered amount

```returnTokenIsCollateral``` pass ```true``` if you want to withdraw remaining collateral + profit in collateral tokens (e.g. rBTC on a iSUSD contract), ```false``` if you want to withdraw it in loan tokens (e.g. sUSD on a iSUSD contract).

Expand Down
6 changes: 4 additions & 2 deletions contracts/modules/LoanClosings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ contract LoanClosings is State, LoanClosingsEvents, VaultController, InterestUse
* @param receiver the receiver of the remainder (unused collatral + profit)
* @param swapAmount defines how much of the position should be closed and is denominated in collateral tokens.
* If swapAmount >= collateral, the complete position will be closed.
* Else (swapAmount/collateral) * principal will be swapped (partial closure).
* Else if returnTokenIsCollateral, (swapAmount/collateral) * principal will be swapped (partial closure).
* Else coveredPrincipal
* @param returnTokenIsCollateral defines if the remainder should be paid out in collateral tokens or underlying loan tokens
* */
function closeWithSwap(
Expand Down Expand Up @@ -487,7 +488,8 @@ contract LoanClosings is State, LoanClosingsEvents, VaultController, InterestUse
* @param receiver the receiver of the remainder (unused collatral + profit)
* @param swapAmount defines how much of the position should be closed and is denominated in collateral tokens.
* If swapAmount >= collateral, the complete position will be closed.
* Else (swapAmount/collateral) * principal will be swapped (partial closure).
* Else if returnTokenIsCollateral, (swapAmount/collateral) * principal will be swapped (partial closure).
* Else coveredPrincipal
* @param returnTokenIsCollateral defines if the remainder should be paid out in collateral tokens or underlying loan tokens
* */
function _closeWithSwap(
Expand Down
Loading