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

Add getTotalCredit() to UnionLens #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maxweng
Copy link
Member

@maxweng maxweng commented Dec 10, 2024

No description provided.

Copy link

linear bot commented Dec 10, 2024

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 9.09091% with 10 lines in your changes missing coverage. Please review.

Project coverage is 87.38%. Comparing base (b4555b4) to head (a01f6fc).

Files with missing lines Patch % Lines
contracts/UnionLens.sol 9.09% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
- Coverage   88.06%   87.38%   -0.69%     
==========================================
  Files          21       21              
  Lines        1274     1284      +10     
  Branches      179      179              
==========================================
  Hits         1122     1122              
- Misses        151      161      +10     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +166 to +176
function getTotalCredit(address underlying, address borrower) external view returns (uint256 total) {
IUserManager userManager = IUserManager(marketRegistry.userManagers(underlying));

uint256 voucherCount = userManager.getVoucherCount(borrower);
for (uint256 i = 0; i < voucherCount; i++) {
(address staker, uint96 trust, , ) = userManager.vouchers(borrower, i);
(, uint96 stakedAmount, , , , ) = userManager.stakers(staker);
total += _min(stakedAmount, trust);
}
return decimalReducing(total, userManager.stakingTokenDecimal());
}

Check warning

Code scanning / Slither

Unused return Medium

Comment on lines +166 to +176
function getTotalCredit(address underlying, address borrower) external view returns (uint256 total) {
IUserManager userManager = IUserManager(marketRegistry.userManagers(underlying));

uint256 voucherCount = userManager.getVoucherCount(borrower);
for (uint256 i = 0; i < voucherCount; i++) {
(address staker, uint96 trust, , ) = userManager.vouchers(borrower, i);
(, uint96 stakedAmount, , , , ) = userManager.stakers(staker);
total += _min(stakedAmount, trust);
}
return decimalReducing(total, userManager.stakingTokenDecimal());
}

Check warning

Code scanning / Slither

Unused return Medium

Copy link

Add getTotalCredit() to UnionLens

Generated at commit: a01f6fc60c408670e21bdeb4962ac3c6bc5c2cc9

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
1
0
7
33
42
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@kingjacob kingjacob requested a review from 0xbarbs December 23, 2024 10:25
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