# EXPIRED 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 - [x] liquidate - [ ] cancelRequestOnLowCollection ### Admin calls - [ ] updateBorrowLimitLimits - [ ] updateIdealCollateralRatioLimits - [ ] updateBorrowRateLimits - [ ] updateCollectionPeriodLimits - [ ] updateDurationLimits - [ ] updateDefaultGracePeriodLimits - [ ] updateGracePenaltyRateLimits - [ ] updateProtocolFeeFraction - [ ] updateProtocolFeeCollector ### State changing - [ ] initialize - [x] request - [x] depositCollateral - [ ] withdrawCollateral [only borower] - getting fixed (noted in another file) - [ ] withdrawCollateral [only borower] - always returns 0 for expired and cancelled - [ ] borrow [only borrower] - reverts for all expect active stage - [x] repay - [x] close [only borrower] - [ ] cancelRequest [only borrower] - can only be called in requested stage - [x] terminate [only admin] - [x] getStatusAndUpdate - TODO: get status and update has to be changed. the if condition with the active and ends at will have another if else that if principal is 0 make it close else expired. this handles the case that lenders can withdraw liquidity even if the borrower has not called close ### View - [ ] withdrawableCollateral - [ ] calculateTotalCollateralTokens - [ ] getRequiredCollateral - [ ] calculateBorrowableAmount - [ ] calculateInterestAccrued - [ ] calculateCurrentDebt - [ ] collateralTokensToLiquidate - [ ] calculateCurrentCollateralRatio - [ ] getPrincipal - [ ] getBorrowerAddress - [ ] getEndsAt ## Lender Pool ### Callbacks from PooledCreditLine - [x] create - [ ] borrowed - [x] repaid - [ ] requestCancelled - [x] terminate ### State changing - [ ] lend - this will revert once the PCL is active - [ ] start - this will revert once the PCL is active - [x] withdrawInterest - [ ] withdrawLiquidity - this will revert, cannot withdraw liquidity in EXPIRED state. this is a bug becuase the PCL goes to expired when it has not been started. the funds get locked in that case. - KNOWN ISSUE, borrower has to call `close` to take PCL to closed state - TODO: rename `cancelRequestOnLowCollection` to `cancelRequestByLenderPool` - TODO: in withdrawLiquidity() add `else if` in line 546 that if(status == REQUESTED && block.timestamp > endsAt), if true, call `cancelRequestByLenderPool` - TODO: remove condition check for timestamp > startsAt in `cancelRequestByLenderPool` because it is being checked in `withdrawLiquidity` already - Add comments when `cancelRequestByLenderPool` is called - when the principal is 0 which is possible if the PCL has ended, the lender cannot call withdraw liquidity. In that case the only option left for the lenders is to wait for the borrower to close the PCL. This is becuase withdraw liquidity only works for closed or liquidated state once the PCL has been activated. - [x] liquidate - this will revert if the principal is 0 otherwise it will work - [ ] withdrawLiquidation - same as withdraw liquidity, cannot do it in expired state - [x] Token transfer ### View - [ ] getLenderInterest - [ ] calculatePrincipalWithdrawable - [ ] getLenderInfo