Skip to content

Add getTotalCredit() to UnionLens#185

Open
maxweng wants to merge 1 commit into
masterfrom
feature/uni-2184-add-function-to-retrieve-total-credit-limit-to-lens-contract
Open

Add getTotalCredit() to UnionLens#185
maxweng wants to merge 1 commit into
masterfrom
feature/uni-2184-add-function-to-retrieve-total-credit-limit-to-lens-contract

Conversation

@maxweng

@maxweng maxweng commented Dec 10, 2024

Copy link
Copy Markdown
Member

No description provided.

@linear

linear Bot commented Dec 10, 2024

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 10, 2024

Copy link
Copy Markdown

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 thread contracts/UnionLens.sol
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

UnionLens.getTotalCredit(address,address) (contracts/UnionLens.sol#166-176) ignores return value by (staker,trust,None,None) = userManager.vouchers(borrower,i) (contracts/UnionLens.sol#171)
Comment thread contracts/UnionLens.sol
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

UnionLens.getTotalCredit(address,address) (contracts/UnionLens.sol#166-176) ignores return value by (None,stakedAmount,None,None,None,None) = userManager.stakers(staker) (contracts/UnionLens.sol#172)
@openzeppelin-code

Copy link
Copy Markdown

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.

2 participants