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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions contracts/UnionLens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,34 @@
userInfo.accountBorrow = uToken.getBorrowed(user);
}

function getBorrowerAddresses(address underlying, address account) public view returns (address[] memory) {
IUserManager userManager = IUserManager(marketRegistry.userManagers(underlying));

Check warning on line 78 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L78

Added line #L78 was not covered by tests

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

Check warning on line 81 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L80-L81

Added lines #L80 - L81 were not covered by tests

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

Check warning on line 85 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L83-L85

Added lines #L83 - L85 were not covered by tests
}

return addresses;

Check warning on line 88 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L88

Added line #L88 was not covered by tests
}
Comment on lines +77 to +89

Check warning

Code scanning / Slither

Unused return Medium


function getStakerAddresses(address underlying, address account) public view returns (address[] memory) {
IUserManager userManager = IUserManager(marketRegistry.userManagers(underlying));

Check warning on line 92 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L92

Added line #L92 was not covered by tests

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

Check warning on line 95 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L94-L95

Added lines #L94 - L95 were not covered by tests

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

Check warning on line 99 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L97-L99

Added lines #L97 - L99 were not covered by tests
}

return addresses;

Check warning on line 102 in contracts/UnionLens.sol

View check run for this annotation

Codecov / codecov/patch

contracts/UnionLens.sol#L102

Added line #L102 was not covered by tests
}
Comment on lines +91 to +103

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?


function getVouchInfo(
address underlying,
address staker,
Expand Down
Loading