Skip to main content

Accountant

Accountant

Deployment on Ethereum mainnet:

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

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

PaymentAllocation

struct PaymentAllocation {
uint256 interestPayment;
uint256 principalPayment;
uint256 additionalBalancePayment;
}

calculateInterestAndPrincipalAccrued

function calculateInterestAndPrincipalAccrued(contract CreditLine cl, uint256 timestamp, uint256 lateFeeGracePeriod) public view returns (uint256, uint256)

calculateInterestAndPrincipalAccruedOverPeriod

function calculateInterestAndPrincipalAccruedOverPeriod(contract CreditLine cl, uint256 balance, uint256 startTime, uint256 endTime, uint256 lateFeeGracePeriod) public view returns (uint256, uint256)

calculatePrincipalAccrued

function calculatePrincipalAccrued(contract ICreditLine cl, uint256 balance, uint256 timestamp) public view returns (uint256)

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 interestOwed)

calculateInterestAccrued

function calculateInterestAccrued(contract CreditLine cl, uint256 balance, uint256 timestamp, uint256 lateFeeGracePeriodInDays) public view returns (uint256)

calculateInterestAccruedOverPeriod

function calculateInterestAccruedOverPeriod(contract CreditLine cl, uint256 balance, uint256 startTime, uint256 endTime, uint256 lateFeeGracePeriodInDays) public view returns (uint256 interestOwed)

lateFeeApplicable

function lateFeeApplicable(contract CreditLine cl, uint256 timestamp, uint256 gracePeriodInDays) public view returns (bool)

allocatePayment

function allocatePayment(uint256 paymentAmount, uint256 balance, uint256 interestOwed, uint256 principalOwed) public pure returns (struct Accountant.PaymentAllocation)