Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added cumulative account borrow and repay stats #15

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0xmDreamy
Copy link
Contributor

@0xmDreamy 0xmDreamy commented Nov 10, 2023

Added stats for cumulativeBorrowAmount, cumulativeRepayAmount and borrowFeesPaid on AccountState. These are intended to be used to calculate the interest paid in total on a cauldron using the following formula:

$$ residualRepayAmount = \begin{cases} \frac{borrowPart \times totalBorrow.elastic}{totalBorrow.base}, & \text{if }totalBorrow.base \neq 0\\ 0, & \text{otherwise} \end{cases} $$

$$ interestPaid = cumulativeRepayAmount + residualRepayAmount - cumulativeBorrowAmount - borrowFeesPaid $$

The number for totalBorrow.elastic should ideally include the unaccrued interest.

@0xmDreamy 0xmDreamy force-pushed the features/cumulative-account-state-stats-cauldrons branch from 8f92340 to 0053eee Compare November 10, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant