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

chg: usage of ternary made more readable. #43

Merged
Merged
Changes from all commits
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
7 changes: 3 additions & 4 deletions contracts/asset/AssetManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ contract AssetManager is Controller, ReentrancyGuardUpgradeable, IAssetManager {
/**
* @dev Returns the amount of the lending pool balance minus the amount of total staked.
* @param tokenAddress ERC20 token address
* @return Amount can be borrowed
* @return loanAmount Amount can be borrowed
Copy link
Contributor

Choose a reason for hiding this comment

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

@twygod @maxweng this should be "lendableAmount"

*/
function getLoanableAmount(address tokenAddress) public view override returns (uint256) {
function getLoanableAmount(address tokenAddress) public view override returns (uint256 loanAmount) {
uint256 poolBalance = getPoolBalance(tokenAddress);
if (poolBalance > totalPrincipal[tokenAddress]) return poolBalance - totalPrincipal[tokenAddress];
return 0;
loanAmount = poolBalance > totalPrincipal[tokenAddress] ? poolBalance - totalPrincipal[tokenAddress] : 0;
}

/**
Expand Down