Skip to main content

Waterfall

Waterfall

struct Waterfall {
struct Tranche[] _tranches;
uint256[31] __padding;
}

WaterfallLogic

MINIMUM_WATERFALL_TRANCHES

uint256 MINIMUM_WATERFALL_TRANCHES

initialize

function initialize(struct Waterfall w, uint256 nTranches) internal

pay

function pay(struct Waterfall w, uint256 principalAmount, uint256 interestAmount, uint256 reserveTranchesIndexStart) internal

apply a payment to tranches in the waterfall. The principal payment is applied to the tranches in order of priority The interest payment is applied to the tranches pro rata

Parameters

NameTypeDescription
wstruct Waterfall
principalAmountuint256
interestAmountuint256
reserveTranchesIndexStartuint256

drawdown

function drawdown(struct Waterfall w, uint256 principalAmount) internal

move

function move(struct Waterfall w, uint256 principalOutstanding, uint256 toCallRequestPeriodTrancheId) internal returns (uint256 principalDeposited, uint256 principalPaid, uint256 principalReserved, uint256 interestPaid)

Move principal and paid interest from one tranche to another

withdraw

function withdraw(struct Waterfall w, uint256 principalAmount) internal

Withdraw principal from the uncalled tranche. Assumes that the caller is allowed to withdraw.

deposit

function deposit(struct Waterfall w, uint256 principalAmount) internal

Deposits principal into the uncalled tranche. Assumes that the caller is allowed to deposit.

settleReserves

function settleReserves(struct Waterfall w, uint256 currentTrancheIndex) internal

Settle all past due tranches as well as the last tranche.

Parameters

NameTypeDescription
wstruct Waterfall
currentTrancheIndexuint256- Index of the current tranche. All previous tranches are due.

getTranche

function getTranche(struct Waterfall w, uint256 trancheId) internal view returns (struct Tranche)

numTranches

function numTranches(struct Waterfall w) internal view returns (uint256)

uncalledCapitalTrancheIndex

function uncalledCapitalTrancheIndex(struct Waterfall w) internal view returns (uint256)

totalPrincipalDeposited

function totalPrincipalDeposited(struct Waterfall w) internal view returns (uint256 sum)

Returns the total amount of principal paid to all tranches

totalInterestPaid

function totalInterestPaid(struct Waterfall w) internal view returns (uint256 sum)

Returns the total amount of interest paid to all tranches

totalPrincipalPaidAfterSettlementUpToTranche

function totalPrincipalPaidAfterSettlementUpToTranche(struct Waterfall w, uint256 trancheIndex) internal view returns (uint256 sum)

Returns the total amount of principal paid to all tranches

totalPrincipalPaid

function totalPrincipalPaid(struct Waterfall w) internal view returns (uint256 totalPrincipalPaidSum)

Returns the total amount of principal paid to all tranches

totalPrincipalOutstandingBeforeReserves

function totalPrincipalOutstandingBeforeReserves(struct Waterfall w) internal view returns (uint256 sum)

totalPrincipalOutstandingAfterReserves

function totalPrincipalOutstandingAfterReserves(struct Waterfall w) internal view returns (uint256 sum)

totalPrincipalReservedUpToTranche

function totalPrincipalReservedUpToTranche(struct Waterfall w, uint256 trancheIndex) internal view returns (uint256 sum)

Parameters

NameTypeDescription
wstruct Waterfall
trancheIndexuint256Exclusive upper bound (i.e. the tranche at this index is not included)

totalPrincipalDepositedUpToTranche

function totalPrincipalDepositedUpToTranche(struct Waterfall w, uint256 trancheIndex) internal view returns (uint256 sum)

Parameters

NameTypeDescription
wstruct Waterfall
trancheIndexuint256Exclusive upper bound (i.e. the tranche at this index is not included)