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

UNI-1316 Borrower/Staker addresses functions #170

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0xbarbs
Copy link
Contributor

@0xbarbs 0xbarbs commented Sep 17, 2023

Adds getBorrowerAddresses and getStakerAddresses functions to the union lens contractt

@linear
Copy link

linear bot commented Sep 17, 2023

UNI-1316 data columns missing from optimism and opgoe members table

Columns Missing:

  • Vouches given
  • Vouches Received
  • Max Credit Limit / trust? - this one needs checked cause i dont know what "trust" column is displaying on the others, but the useful piece of data would be Their theoretical max Credit Limit. I think in the app we call this Credit limit.

@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

Merging #170 (7399a0d) into master (1e5229b) will increase coverage by 0.25%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #170      +/-   ##
==========================================
+ Coverage   82.64%   82.90%   +0.25%     
==========================================
  Files          20       20              
  Lines         922      936      +14     
  Branches      173      173              
==========================================
+ Hits          762      776      +14     
  Misses         98       98              
  Partials       62       62              
Files Coverage Δ
contracts/UnionLens.sol 35.00% <100.00%> (+35.00%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment on lines +77 to +89
function getBorrowerAddresses(address underlying, address account) public view returns (address[] memory) {
IUserManager userManager = IUserManager(marketRegistry.userManagers(underlying));

uint256 voucheeCount = userManager.getVoucheeCount(account);
address[] memory addresses = new address[](voucheeCount);

for (uint256 i = 0; i < voucheeCount; i++) {
(address borrower, ) = userManager.vouchees(account, i);
addresses[i] = borrower;
}

return addresses;
}

Check warning

Code scanning / Slither

Unused return Medium

Comment on lines +91 to +103
function getStakerAddresses(address underlying, address account) public view returns (address[] memory) {
IUserManager userManager = IUserManager(marketRegistry.userManagers(underlying));

uint256 voucherCount = userManager.getVoucherCount(account);
address[] memory addresses = new address[](voucherCount);

for (uint256 i = 0; i < voucherCount; i++) {
(address staker, , ,) = userManager.vouchers(account, i);
addresses[i] = staker;
}

return addresses;
}

Check warning

Code scanning / Slither

Unused return Medium

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xbarbs How about add some unit tests for the new functions?

Copy link
Member

@maxweng maxweng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants