Skip to main content

CreditLine

CreditLine

Deployment on Ethereum mainnet:

https://etherscan.io/address/0x86db002dbBb64D67ef4B43C76C432BF5BCBF7197

A contract that represents the agreement between Backers and a Borrower. Includes the terms of the loan, as well as the accounting state such as interest owed. A CreditLine instance belongs to a TranchedPool instance and is fully controlled by that TranchedPool instance. It should not operate in any standalone capacity and should generally be considered internal to the TranchedPool instance.

INTEREST_DECIMALS

uint256 INTEREST_DECIMALS

SECONDS_PER_DAY

uint256 SECONDS_PER_DAY

SECONDS_PER_YEAR

uint256 SECONDS_PER_YEAR

config

contract GoldfinchConfig config

borrower

address borrower

currentLimit

uint256 currentLimit

maxLimit

uint256 maxLimit

interestApr

uint256 interestApr

lateFeeApr

uint256 lateFeeApr

balance

uint256 balance

totalInterestPaid

uint256 totalInterestPaid

Cumulative interest paid back up to now

lastFullPaymentTime

uint256 lastFullPaymentTime

_totalInterestAccrued

uint256 _totalInterestAccrued

_totalInterestOwed

uint256 _totalInterestOwed

_checkpointedAsOf

uint256 _checkpointedAsOf

schedule

struct PaymentSchedule schedule

initialize

function initialize(address _config, address owner, address _borrower, uint256 _maxLimit, uint256 _interestApr, contract ISchedule _schedule, uint256 _lateFeeApr) public

Initialize a brand new credit line

pay

function pay(uint256 paymentAmount) external returns (struct ILoan.PaymentAllocation)

Process a bulk payment, allocating the payment amount based on the payment waterfall

pay

function pay(uint256 principalPayment, uint256 interestPayment) public returns (struct ILoan.PaymentAllocation)

Process a payment according to the waterfall described in Accountant.allocatePayment

II: insufficient interest

Parameters

NameTypeDescription
principalPaymentuint256principal payment amount
interestPaymentuint256interest payment amount

Return Values

NameTypeDescription
[0]struct ILoan.PaymentAllocationpayment allocation

drawdown

function drawdown(uint256 amount) external

Drawdown on the line

Parameters

NameTypeDescription
amountuint256amount to drawdown. Cannot exceed the line's limit

setLimit

function setLimit(uint256 newAmount) external

setMaxLimit

function setMaxLimit(uint256 newAmount) external

interestAccruedAsOf

function interestAccruedAsOf() public view virtual returns (uint256)

We keep this to conform to the ICreditLine interface, but it's redundant information now that we have checkpointedAsOf

isLate

function isLate() external view returns (bool)

withinPrincipalGracePeriod

function withinPrincipalGracePeriod() public view returns (bool)

interestOwed

function interestOwed() public view virtual returns (uint256)

interestOwedAt

function interestOwedAt(uint256 timestamp) public view returns (uint256)

Interest that would be owed at timestamp

totalInterestAccrued

function totalInterestAccrued() public view returns (uint256)

Cumulative interest accrued up to now

totalInterestAccruedAt

function totalInterestAccruedAt(uint256 timestamp) public view returns (uint256)

Cumulative interest accrued up to timestamp

totalInterestOwedAt

function totalInterestOwedAt(uint256 timestamp) public view returns (uint256)

Cumulative interest owed up to timestamp

limit

function limit() public view returns (uint256)

totalPrincipalPaid

function totalPrincipalPaid() public view returns (uint256)

Returns the total amount of principal thats been paid

totalInterestOwed

function totalInterestOwed() public view returns (uint256)

Cumulative interest owed up to now

interestAccrued

function interestAccrued() public view returns (uint256)

Interest accrued in the current payment period up to now. Converted to owed interest once we cross into the next payment period. Is 0 if the current time is after loan maturity (all interest accrued immediately becomes interest owed).

principalOwedAt

function principalOwedAt(uint256 timestamp) public view returns (uint256)

Principal owed up to timestamp

totalPrincipalOwedAt

function totalPrincipalOwedAt(uint256 timestamp) public view returns (uint256)

Cumulative principal owed at timestamp

principalOwed

function principalOwed() public view returns (uint256)

interestAccruedAt

function interestAccruedAt(uint256 timestamp) public view returns (uint256)

Interest accrued in the current payment period for timestamp. Coverted to owed interest once we cross into the payment period after timestamp. Is 0 if timestamp is after loan maturity (all interest accrued immediately becomes interest owed).

nextDueTime

function nextDueTime() external view returns (uint256)

nextDueTimeAt

function nextDueTimeAt(uint256 timestamp) external view returns (uint256)

termStartTime

function termStartTime() public view returns (uint256)

Time of first drawdown

termEndTime

function termEndTime() public view returns (uint256)

totalPrincipalOwed

function totalPrincipalOwed() public view returns (uint256)

Cumulative principal owed at current timestamp

_checkpoint

function _checkpoint() internal

Updates accounting variables. This should be called before any changes to balance!

_interestAccruedOverPeriod

function _interestAccruedOverPeriod(uint256 start, uint256 end) internal view returns (uint256)

_lateFeesAccuredOverPeriod

function _lateFeesAccuredOverPeriod(uint256 start, uint256 end) internal view returns (uint256)

_isLate

function _isLate(uint256 timestamp) internal view returns (bool)

PaymentSchedule

struct PaymentSchedule {
contract ISchedule schedule;
uint64 startTime;
}

PaymentScheduleLib

startAt

function startAt(struct PaymentSchedule s, uint256 timestamp) internal

previousDueTimeAt

function previousDueTimeAt(struct PaymentSchedule s, uint256 timestamp) internal view returns (uint256)

previousInterestDueTimeAt

function previousInterestDueTimeAt(struct PaymentSchedule s, uint256 timestamp) internal view returns (uint256)

principalPeriodAt

function principalPeriodAt(struct PaymentSchedule s, uint256 timestamp) internal view returns (uint256)

totalPrincipalPeriods

function totalPrincipalPeriods(struct PaymentSchedule s) internal view returns (uint256)

isActive

function isActive(struct PaymentSchedule s) internal view returns (bool)

termEndTime

function termEndTime(struct PaymentSchedule s) internal view returns (uint256)

termStartTime

function termStartTime(struct PaymentSchedule s) internal view returns (uint256)

nextDueTimeAt

function nextDueTimeAt(struct PaymentSchedule s, uint256 timestamp) internal view returns (uint256)

withinPrincipalGracePeriodAt

function withinPrincipalGracePeriodAt(struct PaymentSchedule s, uint256 timestamp) internal view returns (bool)

isActiveMod

modifier isActiveMod(struct PaymentSchedule s)