---
# System prepended metadata

title: CLOSED stage callable functions
tags: [sublime]

---

# CLOSED stage callable functions

###### tags: `sublime`

links:
[PCL stages](https://github.com/sublime-finance/sublime-v1-private/blob/master/contracts/interfaces/IPooledCreditLineEnums.sol)
[PCL.sol](https://github.com/sublime-finance/sublime-v1-private/blob/master/contracts/PooledCreditLine/PooledCreditLine.sol)
[LP.sol](https://github.com/sublime-finance/sublime-v1-private/blob/master/contracts/PooledCreditLine/LenderPool.sol)

## PooledCreditLine

### Callbacks from LenderPool

- [ ] accept
- [ ] liquidate
- [ ] cancelRequestOnLowCollection

### Admin calls

- [ ] updateBorrowLimitLimits
- [ ] updateIdealCollateralRatioLimits
- [ ] updateBorrowRateLimits
- [ ] updateCollectionPeriodLimits
- [ ] updateDurationLimits
- [ ] updateDefaultGracePeriodLimits
- [ ] updateGracePenaltyRateLimits
- [ ] updateProtocolFeeFraction
- [ ] updateProtocolFeeCollector

### State changing

- [ ] initialize
- [x] request
- [ ] depositCollateral
    - can only be called in ACTIVE or EXPIRED
- [x] withdrawCollateral [only borower]
    - NOTE: withdrawCollateral() and it's other variation will have different behaviour if withdrawable collateral is 0. withdrawCollateral(uint256 _id, uint256 _amount, bool _toSavingsAccount) will revert, while withdrawCollateral(uint256 _id, bool _toSavingsAccount) will reutrn without transferring anything
- [x] withdrawCollateral [only borower]
    - TODO: rename withdrawCollateral(uint256 _id, bool _toSavingsAccount) to withdrawAllCollateral()
- [ ] borrow [only borrower]
    - can only be called in ACTIVE
- [ ] repay
    - only ACTIVE or EXPIRED
- [ ] close [only borrower]
    - only ACITVE or EXPIRED
- [ ] cancelRequest [only borrower]
    - only REQUESTED
- [x] terminate [only admin]
- [x] getStatusAndUpdate

### View

- [ ] withdrawableCollateral
- [ ] calculateTotalCollateralTokens
- [ ] getRequiredCollateral
- [ ] calculateBorrowableAmount
- [ ] calculateInterestAccrued
- [ ] calculateCurrentDebt
- [ ] collateralTokensToLiquidate
- [ ] calculateCurrentCollateralRatio
- [ ] getPrincipal
- [ ] getBorrowerAddress
- [ ] getEndsAt

## Lender Pool

### Callbacks from PooledCreditLine

- [x] create
- [ ] borrowed
- [ ] repaid
- [ ] requestCancelled
- [x] terminate

### State changing

- [ ] lend
    - cannot lend once ACTIVE
- [ ] start
    - cannot start once ACTIVE
- [x] withdrawInterest
- [x] withdrawLiquidity
- [ ] liquidate
    - cannot be called when principal is 0, so this will revert because of this
- [x] withdrawLiquidation
    - TODO: should only be callable in LIQUIDATED stage
- [x] Token transfer

### View

- [ ] getLenderInterest
- [ ] calculatePrincipalWithdrawable
- [ ] getLenderInfo