IPortfolio

Git Source

Functions

tranches

Returns the address of the tranche pool contract

function tranches(uint256 index) external view returns (ITranchePool);

status

Returns current portfolio status

function status() external view returns (Status);

startTimestamp

Returns the timestamp when the portfolio started

function startTimestamp() external view returns (uint40);

calculateWaterfall

calculate each tranche values based only on the current assets.

It does not take account of loans value.

function calculateWaterfall() external view returns (uint256[] memory);

Returns

NameTypeDescription
<none>uint256[]Array of current tranche values

calculateWaterfallForTranche

function calculateWaterfallForTranche(uint256 waterfallIndex) external view returns (uint256);

calculateWaterfallWithLoans

calculate each tranche values given the (current assets + loans value).

function calculateWaterfallWithLoans() external view returns (uint256[] memory);

calculateWaterfallWithLoansForTranche

function calculateWaterfallWithLoansForTranche(uint256 waterfallIndex) external view returns (uint256);

loansValue

calculate the total value of all active loans in the contract.

function loansValue() external view returns (uint256);

getTokenBalance

get token balance of this contract

function getTokenBalance() external view returns (uint256);

getAssumedCurrentValues

get assumed current values

function getAssumedCurrentValues()
    external
    view
    returns (uint256 equityValue, uint256 fixedRatePoolValue, uint256 overdueValue);

Returns

NameTypeDescription
equityValueuint256The value of equity tranche
fixedRatePoolValueuint256The value of fixed rate pool tranches
overdueValueuint256The value of overdue loans

start

Starts the portfolio to issue loans.

  • changes the state to Live
  • gathers assets to the portfolio from every tranche.*
function start() external;

closeSenior

Allow the senior tranche to withdraw.

  • changes the state to SeniorClosed
  • Distribute the remaining assets to the senior tranche.*
function closeSenior() external;

closeEquity

Allow the equity tranche to withdraw.

  • changes the state to EquityClosed
  • Distribute the remaining assets to the equity tranche.*
function closeEquity() external;

addLoan

Create loan

function addLoan(AddLoanParams calldata params) external returns (uint256 loanId);

Parameters

NameTypeDescription
paramsAddLoanParamsLoan params

fundLoan

Fund the loan

function fundLoan(uint256 loanId) external returns (uint256 principal);

Parameters

NameTypeDescription
loanIduint256Loan id

repayLoan

Repay the loan

function repayLoan(uint256 loanId) external returns (uint256 amount);

Parameters

NameTypeDescription
loanIduint256Loan id

repayDefaultedLoan

Repay the loan

function repayDefaultedLoan(uint256 loanId, uint256 amount) external;

Parameters

NameTypeDescription
loanIduint256Loan id
amountuint256amount

cancelLoan

Cancel the loan

function cancelLoan(uint256 loanId) external;

Parameters

NameTypeDescription
loanIduint256Loan id

markLoanAsDefaulted

Cancel the loan

function markLoanAsDefaulted(uint256 loanId) external;

Parameters

NameTypeDescription
loanIduint256Loan id

increaseTokenBalance

Increase the current token balance of the portfolio

This function is used to track the token balance of the portfolio. Only the tranche pool contract can call

function increaseTokenBalance(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256Amount to increase

Events

PortfolioStatusChanged

event PortfolioStatusChanged(Status status);

Errors

NotTranche

error NotTranche();

NotGovernance

error NotGovernance();

NotManagerOrCollateralOwner

error NotManagerOrCollateralOwner();

EquityAprNotZero

error EquityAprNotZero();

ActiveLoansExist

error ActiveLoansExist();

AlreadyStarted

error AlreadyStarted();

NotReadyToCloseSenior

error NotReadyToCloseSenior();

NotFullyFunded

error NotFullyFunded();

NotReadyToCloseEquity

error NotReadyToCloseEquity();

AddLoanNotAllowed

error AddLoanNotAllowed();

FundLoanNotAllowed

error FundLoanNotAllowed();

RepayLoanNotAllowed

error RepayLoanNotAllowed();

RepayDefaultedLoanNotAllowed

error RepayDefaultedLoanNotAllowed();

StopPortfolioWithInvalidStatus

error StopPortfolioWithInvalidStatus();

StopPortfolioWithInvalidValues

error StopPortfolioWithInvalidValues();

RestartPortfolioWithInvalidStatus

error RestartPortfolioWithInvalidStatus();

RestartPortfolioWithInvalidValues

error RestartPortfolioWithInvalidValues();

RestartPortfolioOverDuration

error RestartPortfolioOverDuration();

DepositInvalidStatus

error DepositInvalidStatus();