Maple
  • Welcome to Maple
  • Maple for Lenders
    • Introduction
    • Lending
    • Defaults and Impairments
    • Margin Calls and Liquidations
    • Risk
    • Withdrawal Process
  • syrupUSDC for Lenders
    • Powered by Maple
    • Lending in syrupUSDC and syrupUSDT
    • Commitments
    • Drips Rewards
    • Withdrawals
    • Monthly Updates
    • Pendle Integration
  • SyrupUSDC Rewards Prize Draw Program Summary
  • FAQ
  • Maple for Borrowers
    • Introduction
    • Loan Management
  • Maple for Token Holders
    • Introduction to SYRUP
      • MPL to SYRUP Conversion
      • FAQs
    • SYRUP Tokenomics
      • Staking
      • Staking Smart Contract Details
    • Governance and Voting
    • Drips Rewards
    • Research and Media
      • Podcasts
      • News Articles
      • TV Segments
      • Research Reports
      • Data Dashboards
    • Additional Resources
  • Technical Resources
    • Protocol Overview
      • Background
      • Protocol Actors
      • Smart Contract Architecture
      • Glossary
      • Smart Contract Addresses
      • Fees
      • Composability
      • Proxies and Upgradeability
    • Security
      • Security
      • List of Assumptions
      • External Entry Points
      • Emergency Protocol Pause
      • Protocol Invariants
      • Test Report
    • Loans
      • Loans
      • Fixed Term Loans
      • Open Term Loans
      • Refinancing
      • Impairments
      • Defaults
    • Pools
      • Pools
      • Pool Creation
      • PoolManager
      • PoolDelegateCover
      • Accounting
        • Pool Accounting
        • Pool Exchange Rates
    • Strategies
      • Fixed Term Loan Manager
        • Overview
        • Claims
        • Advance Payment Accounting
        • Accounting Examples
      • Open Term Loan Manager
      • DeFi Strategies
    • Withdrawal Managers
      • WithdrawalManager (Cyclical)
      • WithdrawalManager (Queue)
    • Singletons
      • Globals
      • MapleTreasury
      • Oracles
      • Pool Permission Manager
    • Admin Functions
      • Governor Admin Actions
        • Operational Admin Actions
      • Pool Delegate Admin Actions
      • Timelocks
    • Operations
      • Protocol Deployment
      • Open Term Loan Deployment
      • December 2023 Deployment & Upgrade Procedure
      • Strategies Release Deployment Procedure
    • Interfaces
      • FixedTermLoan
      • FixedTermLoanFactory
      • FixedTermLoanFeeManager
      • FixedTermLoanInitializer
      • FixedTermLoanManager
      • FixedTermLoanManagerFactory
      • FixedTermLoanManagerInitializer
      • FixedTermLoanRefinancer
      • Globals
      • Liquidator
      • LiquidatorFactory
      • LiquidatorInitializer
      • OpenTermLoan
      • OpenTermLoanFactory
      • OpenTermLoanInitializer
      • OpenTermLoanManager
      • OpenTermLoanManagerFactory
      • OpenTermLoanManagerInitializer
      • OpenTermLoanRefinancer
      • Pool
      • PoolDelegateCover
      • PoolDeployer
      • PoolManager
      • PoolManagerFactory
      • PoolManagerInitializer
      • PoolPermissionManager
      • WithdrawalManager (Cyclical)
      • WithdrawalManagerFactory (Cyclical)
      • WithdrawalManagerInitializer (Cyclical)
      • WithdrawalManager (Queue)
      • WithdrawalManagerFactory (Queue)
      • WithdrawalManagerInitializer (Queue)
    • SYRUP Token
      • Architectural Overview
      • Base ERC20 Structure
      • Upgradability
      • Modules
      • Time Locks
      • Recapitalization Module
      • Emergency Module
      • Deployment and Migration Procedure
    • GraphQL API
    • SDK
      • Introduction
      • Installation
      • Protocol Actors
      • Usage Guide
  • Troubleshooting & Support
    • Intercom
  • Maple 1.0
    • Access to deprecated Maple 1.0
  • Legal
    • Borrower MLA
    • KYC
    • Interface Terms of Use
    • Privacy Policy
    • syrupUSDC and syrupUSDT - Risks
    • syrupUSDC and syrupUSDT - Defaults and Impairments
    • syrupUSDC and syrupUSDT - Available Jurisdictions
    • Interface Terms of Use [syrupUSDC and syrupUSDT]
    • Interface Terms of Use [Syrup.fi/convert/ and Syrup.fi/stake/]
    • syrupUSDC and syrupUSDT- Privacy Policy
    • SyrupUSDC Rewards Prize Draw Terms & Conditions
Powered by GitBook
On this page
  • Overview
  • Example 1: Single Loan - On Time Payment
  • Example 2: Single Loan - Early Payment
  • Example 3: Single Loan - Late Payment
  • Example 4: Double Loan - Single On-Time Payment
  • Loan 2 Funding
  • Loan 1 Payment
  • Example 5: Double Loan - Multiple On Time Payments
  • Loan 2 Funding
  • Loan 1 Payment 1
  • Loan 1 Payment 2
  • Example 6: Double Loan - Early Payment then On Time Payment
  • Loan 2 Funding
  • Loan 1 Payment 1
  • Loan 1 Payment 2
  • Example 7: Double Loan - Late Payment then On Time Payment
  • Loan 2 Funding
  • Loan 1 Payment 1
  • Loan 1 Payment 2
  1. Technical Resources
  2. Strategies
  3. Fixed Term Loan Manager

Accounting Examples

PreviousAdvance Payment AccountingNextOpen Term Loan Manager

Last updated 6 months ago

Overview

This section is intended to demonstrate multiple scenarios with loans to show how value is represented with totalAssets. During each payment, accounting state in the Fixed Term Manager contract is changed in the following way:

  1. accountedInterest is decreased. This is because the outstandingInterestoutstandingInterestoutstandingInterest portion of assetsUnderManagement must discretely decrease when a payment is made.

  2. domainStart is updated to the current timestamp.

  3. issuanceRate is updated based on the resulting state.

  4. domainEnd is set to the next earliest payment due date.

  5. Cash is sent to the pool.

Note 1: For all of the below examples, only interest is being paid so outstanding principal (principalOut) remains constant.

Note 2: For the purpose of simplicity, issuanceRate is represented as units/dayunits/dayunits/day in the equations below. In reality, it is represented as units×1e30/secondunits \times 1e30 / secondunits×1e30/second.

Note 3: None of the below diagrams are to scale.

Example 1: Single Loan - On Time Payment

In this example, there is a single Loan that makes a payment at the exact timestamp at which the payment is due. The payment is for 5000 units of fundsAsset.

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

accountedInterest=accountedInterest−5000issuanceRate=500020−10=500domainStart=10domainEnd=20\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 \\ \nonumber issuanceRate &= \frac{5000}{20-10} = 500 \\ \nonumber domainStart &= 10 \\ \nonumber domainEnd &= 20 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000=20−105000​=500=10=20​

totalAssets accounting gets updated as follows:

Since the payment was made at the exact time that it was due, the outstanding interest exactly equaled the actual interest paid, so no discrete change in totalAssets is observed.

Example 2: Single Loan - Early Payment

In this example, there is a single Loan that makes an early payment, two days before the payment is due. The interest due is 5000 units, but since the payment is made on day 8, only 4000 units have accrued in the LoanManager accounting.

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

When a payment is made early, there is a discrete increase in totalAssets since the cash balance in the pool increases more than the outstanding interest that was represented when the payment was made.

Example 3: Single Loan - Late Payment

In this example, there is a single Loan that makes a late payment, four days after the payment is due. The interest due is 5000 units, but since the payment is made late, there is an extra 3000 units of late interest that must be paid. In addition, since the payment is made on day 14, four days of interest (2000 units) has accrued in the second payment interval. Note that for a late payment, the issuance rate does not change.

Whenever the current timestamp is past the domainEnd in the LoanManager, assetsUnderManagement no longer accrues interest until the interest accrual formula is updated.

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

When a payment is made late, there is a discrete increase in totalAssets since the interest accruing in the second interval is not represented in the accounting until a payment is made, plus late fees are added.

Example 4: Double Loan - Single On-Time Payment

In this example, there are two outstanding Loans. Loan 2 gets funded on day 5. Loan 1 makes a payment exactly on time at day 10.

Loan 2 Funding

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Loan 1 Payment

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Example 5: Double Loan - Multiple On Time Payments

In this example, there are two outstanding Loans. Loan 2 gets funded on day 5. Loan 1 makes a payment exactly on time at day 10. Loan 1 makes another payment exactly on time on day 20.

Loan 2 Funding

Loan 1 Payment 1

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Loan 1 Payment 2

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Example 6: Double Loan - Early Payment then On Time Payment

In this example, there are two outstanding loans. Loan 2 gets funded on day 5. Loan 1 makes a payment early on day 8. Loan 1 makes another payment exactly on time on day 20.

Note that it is an edge case to make payments exactly on time. The second payment is more for illustrative purposes of how aggregate issuance rates are rendered with multiple loans and payments.

In this example, there are two different aggregate issuance rates since the issuance rate for Loan 1 changes when an early payment is made.

Loan 2 Funding

Loan 1 Payment 1

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Loan 1 Payment 2

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Example 7: Double Loan - Late Payment then On Time Payment

In this example, there are two outstanding Loans. Loan 2 gets funded on day 5. Loan 1 makes a payment late on day 12. Loan 1 makes another payment exactly on time on day 20.

Loan 2 Funding

Loan 1 Payment 1

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

Loan 1 Payment 2

It can be seen that during this transaction, outstanding interest accounting gets updated as follows:

totalAssets accounting gets updated as follows:

outstandingInterest=outstandingInterest−5000cash=cash+5000totalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 5000 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−5000=cash+5000=totalAssets​​
accountedInterest=accountedInterest−4000issuanceRate=500020−8=416.67domainStart=8domainEnd=20\large \begin{align} \nonumber accountedInterest &= accountedInterest - 4000 \\ \nonumber issuanceRate &= \frac{5000}{20-8} = 416.67 \\ \nonumber domainStart &= 8 \\ \nonumber domainEnd &= 20 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−4000=20−85000​=416.67=8=20​
outstandingInterest=outstandingInterest−4000cash=cash+5000totalAssets=totalAssets+1000\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 4000 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets + 1000 \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−4000=cash+5000=totalAssets+1000​​
accountedInterest=accountedInterest−5000+2000issuanceRate=5000−200020−14=30006=500domainStart=14domainEnd=20\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 + 2000 \\ \nonumber issuanceRate &= \frac{5000 - 2000}{20-14} = \frac{3000}{6} = 500 \\ \nonumber domainStart &= 14 \\ \nonumber domainEnd &= 20 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000+2000=20−145000−2000​=63000​=500=14=20​
outstandingInterest=outstandingInterest−3000cash=cash+8000totalAssets=totalAssets+5000\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 3000 \\ \nonumber cash &= cash + 8000 \\ \nonumber totalAssets &= totalAssets + 5000 \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−3000=cash+8000=totalAssets+5000​​

When there is more than one outstanding loan, the issuanceRate becomes an aggregate value, representing the units of fundsAsset accruing against both loans simultaneously. This value gets updated from IR1IR_1IR1​ to IR1,2IR_{1,2}IR1,2​ when Loan 2 gets funded and gets updated to IR2IR_2IR2​ when Loan 1 is paid.

accountedInterest=accountedInterest+2500issuanceRate=500+500020=750domainStart=5domainEnd=10\large \begin{align} \nonumber accountedInterest &= accountedInterest + 2500 \\ \nonumber issuanceRate &= 500 + \frac{5000}{20} = 750 \\ \nonumber domainStart &= 5 \\ \nonumber domainEnd &= 10 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest+2500=500+205000​=750=5=10​
outstandingInterest=outstandingInterest+2500cash=cashtotalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest + 2500 \\ \nonumber cash &= cash \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest+2500=cash=totalAssets​​
accountedInterest=accountedInterest−5000issuanceRate=750−500=250domainStart=10domainEnd=25\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 \\ \nonumber issuanceRate &= 750 - 500 = 250 \\ \nonumber domainStart &= 10 \\ \nonumber domainEnd &= 25 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000=750−500=250=10=25​
outstandingInterest=outstandingInterest−5000cash=cash+5000totalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 5000 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−5000=cash+5000=totalAssets​​

Accounting gets updated in the same way as .

accountedInterest=accountedInterest−5000issuanceRate=750−500+500=750domainStart=10domainEnd=20\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 \\ \nonumber issuanceRate &= 750 - 500 + 500 = 750 \\ \nonumber domainStart &= 10 \\ \nonumber domainEnd &= 20 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000=750−500+500=750=10=20​
outstandingInterest=outstandingInterest−5000cash=cash+5000totalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 5000 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−5000=cash+5000=totalAssets​​
accountedInterest=accountedInterest−5000issuanceRate=750−500=250domainStart=20domainEnd=25\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 \\ \nonumber issuanceRate &= 750 - 500 = 250 \\ \nonumber domainStart &= 20 \\ \nonumber domainEnd &= 25 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000=750−500=250=20=25​
outstandingInterest=outstandingInterest−5000cash=cash+5000totalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 5000 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−5000=cash+5000=totalAssets​​

Accounting gets updated in the same way as .

accountedInterest=accountedInterest−4000=750issuanceRate=750−500+500020−8=666.67domainStart=8domainEnd=20\large \begin{align} \nonumber accountedInterest &= accountedInterest - 4000 = 750 \\ \nonumber issuanceRate &= 750 - 500 + \frac{5000}{20 - 8} = 666.67 \\ \nonumber domainStart &= 8 \\ \nonumber domainEnd &= 20 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−4000=750=750−500+20−85000​=666.67=8=20​
outstandingInterest=outstandingInterest−4000=750cash=cash+5000totalAssets=totalAssets+1000=5750\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 4000 = 750 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets + 1000 = 5750 \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−4000=750=cash+5000=totalAssets+1000=5750​​
accountedInterest=accountedInterest−5000=4750issuanceRate=666.67−416.67=250domainStart=20domainEnd=25\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 = 4750 \\ \nonumber issuanceRate &= 666.67 - 416.67 = 250 \\ \nonumber domainStart &= 20 \\ \nonumber domainEnd &= 25 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000=4750=666.67−416.67=250=20=25​
outstandingInterest=outstandingInterest−5000cash=cash+5000totalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 5000 \\ \nonumber cash &= cash + 5000 \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−5000=cash+5000=totalAssets​​

Note that when the second payment is made, it is made after domainEnd. This means that the interest from Loan 1 is fully accounted for, the payment is removed from the sorted list, the issuance rate is reduced, and the interest is accrued to the current timestamp before updating the state. More details on how this works , specifically in example.

Accounting gets updated in the same way as .

accountedInterest=accountedInterest−5000+250×2+500×2=2750issuanceRate=750−500+5000−100020−12=750−500+500=750domainStart=12domainEnd=20\large \begin{align*} \nonumber accountedInterest &= accountedInterest - 5000 + 250 \times 2 + 500 \times 2 = 2750 \\ \nonumber issuanceRate &= 750 - 500 + \frac{5000 - 1000}{20 - 12} = 750 - 500 + 500 = 750 \\ \nonumber domainStart &= 12 \\ \nonumber domainEnd &= 20 \end{align*}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000+250×2+500×2=2750=750−500+20−125000−1000​=750−500+500=750=12=20​
outstandingInterest=outstandingInterest−3500=2750cash=cash+5000+3000totalAssets=totalAssets+250×2+500×2+3000=10750\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 3500 = 2750 \\ \nonumber cash &= cash + 5000 + 3000 \\ \nonumber totalAssets &= totalAssets + 250 \times 2 + 500 \times 2 + 3000 = 10750 \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−3500=2750=cash+5000+3000=totalAssets+250×2+500×2+3000=10750​​
accountedInterest=accountedInterest−5000=3750issuanceRate=750−500=250domainStart=20domainEnd=25\large \begin{align} \nonumber accountedInterest &= accountedInterest - 5000 = 3750 \\ \nonumber issuanceRate &= 750 - 500 = 250 \\ \nonumber domainStart &= 20 \\ \nonumber domainEnd &= 25 \end{align}accountedInterestissuanceRatedomainStartdomainEnd​=accountedInterest−5000=3750=750−500=250=20=25​
outstandingInterest=outstandingInterest−5000=3750cash=cash+5000=13000totalAssets=totalAssets\large \begin{align} \nonumber outstandingInterest &= outstandingInterest - 5000 = 3750 \\ \nonumber cash &= cash + 5000 = 13000 \\ \nonumber totalAssets &= totalAssets \\ \end{align}outstandingInterestcashtotalAssets​=outstandingInterest−5000=3750=cash+5000=13000=totalAssets​​
Example 4
Example 4
Example 4
here
this