Accrued Interest Calculation

Describes how accrued interest is calculated and where and when this happens

Formulae

chevron-rightInterest = (r * x * t) / 1yr / 10000hashtag

r = APR in basis points (e.g. 5% = 500bp)

x = amount of tokens

t = time (in seconds)

1 year = 365.25 days (in seconds)

chevron-rightFull Accrued Interest formulahashtag

InterestAccrued =

(rate.dRate * drawnBalance * timespan) / INTEREST_DENOMINATOR

+

(rate.fRate * (facilityBalance - drawnBalance) * timespan) / INTEREST_DENOMINATOR

Parameters

chevron-rightinterestAccruedhashtag

Interest owed by a Borrower but not yet repaid to the Line of Credit contract

chevron-rightInterest denominator = 365.25 days * Base denominatorhashtag

chevron-rightBase denominatorhashtag

10000 (adjustment factor since rates are expressed in basis points (bps) --> e.g. 5% rate is expressed as 500bp so we need to divide by 100 to get a % and then by another 100 to arrive at the decimal (500/100/100 = 0.05)

chevron-rightOne yearhashtag

One Julian astronomical year, has 365.25 days: 1 year = 365.25 days = (365.25 days) × (24 hours/day) × (3600 seconds/hour) = 31557600 seconds

chevron-rightdRatehashtag

The annual interest rate charged to a Borrower on borrowed / drawn down funds (in basis points to 4 decimals, e.g. 1000bp = 10% and 1234bp = 12.34% and 1234.56bp = 12.3456%)

chevron-rightdrawnBalancehashtag

The balance of funds that a Borrower has drawn down on the Line of Credit

chevron-rightfRatehashtag

The annual interest rate charged to a Borrower on the remaining funds available, but not yet drawn down aka rate charged on the available facility headroom(in basis points to 4 decimals).

chevron-rightfacilityBalancehashtag

The remaining balance of funds that a Borrower can still drawn down on the Line of Credit (aka headroom)

chevron-righttimespan= block.timestamp - rate.lastAccruedhashtag

The number of seconds for which interest will be accrued

chevron-rightblock.timestamphashtag

The block timestamp for the block during which interest is calculated, in seconds

Contract workflow

Please see here for an overview of the contract and function workflow.

The definitions below are useful for that.

chevron-rightPrincipalhashtag

The amount of a Lender's Deposit that has actually been drawn down by the Borrower (USD)

chevron-rightDeposithashtag

The sum of the total liquidity provided by a Lender in a given token on a Line of Credit

chevron-rightidhashtag

Reference id for the Credit Position made available to a Borrower by a single Lender for a given token on a Line

Last updated

Was this helpful?