Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
formatted test file
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdanDunkley committed Mar 17, 2024
1 parent 680c64e commit 9b09fd3
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions contracts/test/LeveredPositionTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ abstract contract LeveredPositionTest is MarketsTest {
vm.stopPrank();
}

function _configurePairAndLiquidator(address _collat, address _stable, IRedemptionStrategy _liquidator) internal {
function _configurePairAndLiquidator(
address _collat,
address _stable,
IRedemptionStrategy _liquidator
) internal {
_configurePair(_collat, _stable);
_configureTwoWayLiquidator(_collat, _stable, _liquidator);
}
Expand Down Expand Up @@ -282,10 +286,14 @@ abstract contract LeveredPositionTest is MarketsTest {
}
}

function _openLeveredPosition(
address _positionOwner,
uint256 _depositAmount
) internal returns (LeveredPosition _position, uint256 _maxRatio, uint256 _minRatio) {
function _openLeveredPosition(address _positionOwner, uint256 _depositAmount)
internal
returns (
LeveredPosition _position,
uint256 _maxRatio,
uint256 _minRatio
)
{
IERC20Upgradeable collateralToken = IERC20Upgradeable(collateralMarket.underlying());
collateralToken.transfer(_positionOwner, _depositAmount);

Expand Down Expand Up @@ -998,6 +1006,18 @@ contract ModeWethUSDTLeveredPositionTest is LeveredPositionTest {
address wethWhale = 0x7380511493DD4c2f1dD75E9CCe5bD52C787D4B51;
address USDTWhale = 0x082321F9939373b02Ad54ea214BF6e822531e679;

ICErc20[] memory cTokens = new ICErc20[](1);
cTokens[0] = ICErc20(USDTMarket);

uint256[] memory newBorrowCaps = new uint256[](1);
newBorrowCaps[0] = 1e36;

IonicComptroller comptroller = IonicComptroller(ICErc20(wethMarket).comptroller());

vm.prank(comptroller.admin());
comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);
vm.stopPrank();

_configurePair(wethMarket, USDTMarket);
_fundMarketAndSelf(ICErc20(wethMarket), wethWhale);
_fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);
Expand Down Expand Up @@ -1044,6 +1064,7 @@ contract ModeWbtcUSDCLeveredPositionTest is LeveredPositionTest {
(position, maxLevRatio, minLevRatio) = _openLeveredPosition(address(this), depositAmount);
}
}

contract ModeWbtcUSDTLeveredPositionTest is LeveredPositionTest {
function setUp() public fork(MODE_MAINNET) {}

Expand All @@ -1057,6 +1078,18 @@ contract ModeWbtcUSDTLeveredPositionTest is LeveredPositionTest {
address wbtcWhale = 0x3f3429D28438Cc14133966820b8A9Ea61Cf1D4F0;
address USDTWhale = 0x082321F9939373b02Ad54ea214BF6e822531e679;

ICErc20[] memory cTokens = new ICErc20[](1);
cTokens[0] = ICErc20(USDTMarket);

uint256[] memory newBorrowCaps = new uint256[](1);
newBorrowCaps[0] = 1e36;

IonicComptroller comptroller = IonicComptroller(ICErc20(wbtcMarket).comptroller());

vm.prank(comptroller.admin());
comptroller._setMarketBorrowCaps(cTokens, newBorrowCaps);
vm.stopPrank();

_configurePair(wbtcMarket, USDTMarket);
_fundMarketAndSelf(ICErc20(wbtcMarket), wbtcWhale);
_fundMarketAndSelf(ICErc20(USDTMarket), USDTWhale);
Expand Down

0 comments on commit 9b09fd3

Please sign in to comment.