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

FuseERC4626 Vaults : unit & integration tests #6

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
"solhint:check": "solhint --config ./.solhint.json 'src/**/*.sol'",
"lint": "npm run prettier && npm run solhint",
"lint:check": "npm run prettier:check && npm run solhint:check"

"lint:check": "npm run prettier:check && npm run solhint:check",
"test": "forge test --no-match-contract Integration -vvv",
"test:integration": "FORK_BLOCK=14473700; forge test -vvv --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract Integration",
"test:integration:latest": "forge test -vvv --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --match-contract Integration"
},
"devDependencies": {
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.6"
}
}
}
11 changes: 11 additions & 0 deletions src/external/CToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ abstract contract CToken is CERC20 {
function comptroller() external view virtual returns (address);

function getCash() external view virtual returns (uint256);

function getAccountSnapshot(address)
external
view
virtual
returns (
uint256,
uint256,
uint256,
uint256
);
}
38 changes: 30 additions & 8 deletions src/external/Unitroller.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;

import {CERC20} from "libcompound/interfaces/CERC20.sol";

abstract contract Unitroller {
struct Market {
bool isListed;
Expand All @@ -22,6 +20,27 @@ abstract contract Unitroller {
mapping(address => address) public cTokensByUnderlying;
mapping(address => uint256) public supplyCaps;

function getAccountLiquidity(address account)
public
view
virtual
returns (
uint256 err,
uint256 liquidity,
uint256 shortfall
);

function getAssetsIn(address account)
external
view
virtual
returns (address[] memory);

function enterMarkets(address[] memory cTokens)
public
virtual
returns (uint256[] memory);

function _setPendingAdmin(address newPendingAdmin)
public
virtual
Expand All @@ -30,12 +49,12 @@ abstract contract Unitroller {
function _setBorrowCapGuardian(address newBorrowCapGuardian) public virtual;

function _setMarketSupplyCaps(
CERC20[] calldata cTokens,
address[] calldata cTokens,
uint256[] calldata newSupplyCaps
) external virtual;

function _setMarketBorrowCaps(
CERC20[] calldata cTokens,
address[] calldata cTokens,
uint256[] calldata newBorrowCaps
) external virtual;

Expand All @@ -44,12 +63,12 @@ abstract contract Unitroller {
virtual
returns (uint256);

function _setMintPaused(CERC20 cToken, bool state)
function _setMintPaused(address cToken, bool state)
public
virtual
returns (bool);

function _setBorrowPaused(CERC20 cToken, bool borrowPaused)
function _setBorrowPaused(address cToken, bool borrowPaused)
public
virtual
returns (bool);
Expand All @@ -74,7 +93,7 @@ abstract contract Unitroller {
returns (uint256);

function _setCollateralFactor(
CERC20 cToken,
address cToken,
uint256 newCollateralFactorMantissa
) public virtual returns (uint256);

Expand Down Expand Up @@ -125,7 +144,10 @@ abstract contract Unitroller {
bool[] calldata statuses
) external virtual returns (uint256);

function _unsupportMarket(CERC20 cToken) external virtual returns (uint256);
function _unsupportMarket(address cToken)
external
virtual
returns (uint256);

function _toggleAutoImplementations(bool enabled)
public
Expand Down
Loading