Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 5 additions & 8 deletions src/core/RiskEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ contract RiskEngine is Ownable, IRiskEngine {
uint amt
)
external
view
returns (bool)
{
uint borrowValue = _valueInWei(token, amt);
Expand All @@ -101,7 +100,6 @@ contract RiskEngine is Ownable, IRiskEngine {
uint amt
)
external
view
returns (bool)
{
if (IAccount(account).hasNoDebt()) return true;
Expand All @@ -118,7 +116,7 @@ contract RiskEngine is Ownable, IRiskEngine {
@param account Address of account
@return isAccountHealthy Returns whether an account is healthy or not.
*/
function isAccountHealthy(address account) external view returns (bool) {
function isAccountHealthy(address account) external returns (bool) {
return _isAccountHealthy(
_getBalance(account),
_getBorrows(account)
Expand All @@ -130,7 +128,7 @@ contract RiskEngine is Ownable, IRiskEngine {
@param account Address of account
@return balance Total account balance
*/
function getBalance(address account) external view returns (uint) {
function getBalance(address account) external returns (uint) {
return _getBalance(account);
}

Expand All @@ -139,15 +137,15 @@ contract RiskEngine is Ownable, IRiskEngine {
@param account Address of account
@return borrows Total account borrows
*/
function getBorrows(address account) external view returns (uint) {
function getBorrows(address account) external returns (uint) {
return _getBorrows(account);
}

/* -------------------------------------------------------------------------- */
/* Internal Functions */
/* -------------------------------------------------------------------------- */

function _getBalance(address account) internal view returns (uint) {
function _getBalance(address account) internal returns (uint) {
address[] memory assets = IAccount(account).getAssets();
uint assetsLen = assets.length;
uint totalBalance;
Expand All @@ -160,7 +158,7 @@ contract RiskEngine is Ownable, IRiskEngine {
return totalBalance + account.balance;
}

function _getBorrows(address account) internal view returns (uint) {
function _getBorrows(address account) internal returns (uint) {
if (IAccount(account).hasNoDebt()) return 0;
address[] memory borrows = IAccount(account).getBorrows();
uint borrowsLen = borrows.length;
Expand All @@ -177,7 +175,6 @@ contract RiskEngine is Ownable, IRiskEngine {

function _valueInWei(address token, uint amt)
internal
view
returns (uint)
{
return oracle.getPrice(token)
Expand Down
10 changes: 5 additions & 5 deletions src/interface/core/IRiskEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {IOracle} from "oracle/core/IOracle.sol";

interface IRiskEngine {
function initDep() external;
function getBorrows(address account) external view returns (uint);
function getBalance(address account) external view returns (uint);
function isAccountHealthy(address account) external view returns (bool);
function getBorrows(address account) external returns (uint);
function getBalance(address account) external returns (uint);
function isAccountHealthy(address account) external returns (bool);
function isBorrowAllowed(address account, address token, uint amt)
external view returns (bool);
external returns (bool);
function isWithdrawAllowed(address account, address token, uint amt)
external view returns (bool);
external returns (bool);
function oracle() external view returns (IOracle);
}