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

Is the calculation formula correct or not? #178

Open
Stevewu1234 opened this issue Dec 7, 2021 · 1 comment
Open

Is the calculation formula correct or not? #178

Stevewu1234 opened this issue Dec 7, 2021 · 1 comment

Comments

@Stevewu1234
Copy link

Regarding to the function of distributeBorrowerComp() in https://github.com/compound-finance/compound-protocol/blob/master/contracts/Comptroller.sol,
the formula of calculating account borrow amount is:
uint borrowerAmount = div_(CToken(cToken).borrowBalanceStored(borrower), marketBorrowIndex);

I saw the borrowAmount calculation in cToken is:
recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex

Is the borrowerAmount in distributeBorrowerComp() correct or not?

@StillFantastic
Copy link

Hi @Stevewu1234, did you figure this out at the end? I also have the same question and just came across this issue.

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

No branches or pull requests

5 participants
@StillFantastic @Stevewu1234 and others