Accountant
Accountant
Deployment on Ethereum mainnet:
https://etherscan.io/address/0x6CE93728877396D43874eFdd6345E8c251dFE008
Library for handling key financial calculations, such as interest and principal accrual.
FP_SCALING_FACTOR
uint256 FP_SCALING_FACTOR
INTEREST_DECIMALS
uint256 INTEREST_DECIMALS
SECONDS_PER_DAY
uint256 SECONDS_PER_DAY
SECONDS_PER_YEAR
uint256 SECONDS_PER_YEAR
AllocatePaymentParams
struct AllocatePaymentParams {
uint256 principalPayment;
uint256 interestPayment;
uint256 balance;
uint256 interestOwed;
uint256 interestAccrued;
uint256 principalOwed;
}
calculateWritedownFor
function calculateWritedownFor(contract ICreditLine cl, uint256 timestamp, uint256 gracePeriodInDays, uint256 maxDaysLate) public view returns (uint256, uint256)
calculateWritedownForPrincipal
function calculateWritedownForPrincipal(contract ICreditLine cl, uint256 principal, uint256 timestamp, uint256 gracePeriodInDays, uint256 maxDaysLate) public view returns (uint256, uint256)
calculateAmountOwedForOneDay
function calculateAmountOwedForOneDay(contract ICreditLine cl) public view returns (struct FixedPoint.Unsigned)
splitPayment
function splitPayment(uint256 paymentAmount, uint256 balance, uint256 interestOwed, uint256 interestAccrued, uint256 principalOwed) external pure returns (uint256 interestPayment, uint256 principalPayment)
Given a lump sum, returns the amount of the payment that should be allocated to paying interest, and the amount that should be allocated to paying principal
allocatePayment
function allocatePayment(struct Accountant.AllocatePaymentParams params) public pure returns (struct ILoan.PaymentAllocation)
Allocate a payment.
- interestOwed must be paid before principalOwed
- principalOwed must be paid before interestAccrued
- interestAccrued must be paid before the rest of the balance
IO - Interest Owed PO - Principal Owed AI - Accrued Interest
Parameters
Name | Type | Description |
---|---|---|
params | struct Accountant.AllocatePaymentParams | specifying payment amounts and amounts owed |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct ILoan.PaymentAllocation | payment allocation |