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

retro tests #32

Merged
merged 15 commits into from
Sep 12, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ contract LeveredPositionFactoryFirstExtension is
error PositionNotClosed();

function _getExtensionFunctions() external pure override returns (bytes4[] memory) {
uint8 fnsCount = 8;
uint8 fnsCount = 9;
bytes4[] memory functionSelectors = new bytes4[](fnsCount);
functionSelectors[--fnsCount] = this.removeClosedPosition.selector;
functionSelectors[--fnsCount] = this.closeAndRemoveUserPosition.selector;
functionSelectors[--fnsCount] = this.getMinBorrowNative.selector;
functionSelectors[--fnsCount] = this.getRedemptionStrategies.selector;
functionSelectors[--fnsCount] = this.getBorrowableMarketsByCollateral.selector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ contract LiquidatorsRegistryExtension is LiquidatorsRegistryStorage, DiamondExte
strategyData = solidlyLpTokenLiquidatorData(inputToken, outputToken);
} else if (isStrategy(strategy, "UniswapV2LiquidatorFunder")) {
strategyData = uniswapV2LiquidatorData(inputToken, outputToken);
} else if (isStrategy(strategy, "UniswapV3Liquidator")) {
strategyData = uniswapV3LiquidatorData(inputToken, outputToken);
} else if (isStrategy(strategy, "UniswapV3LiquidatorFunder")) {
strategyData = uniswapV3LiquidatorFunderData(inputToken, outputToken);
} else if (isStrategy(strategy, "AlgebraSwapLiquidator")) {
strategyData = algebraSwapLiquidatorData(inputToken, outputToken);
} else if (isStrategy(strategy, "GammaAlgebraLpTokenLiquidator")) {
Expand Down Expand Up @@ -433,7 +433,7 @@ contract LiquidatorsRegistryExtension is LiquidatorsRegistryStorage, DiamondExte
strategyData = abi.encode(outputToken);
}

function uniswapV3LiquidatorData(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken)
function uniswapV3LiquidatorFunderData(IERC20Upgradeable inputToken, IERC20Upgradeable outputToken)
internal
view
returns (bytes memory strategyData)
Expand Down
6 changes: 5 additions & 1 deletion contracts/test/AccrueInterestTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import { IERC20Upgradeable } from "openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol";

import { UpgradesBaseTest } from "./UpgradesBaseTest.sol";
import { CErc20Delegate } from "../compound/CErc20Delegate.sol";
import { ICErc20 } from "../compound/CTokenInterfaces.sol";
Expand Down Expand Up @@ -183,9 +185,11 @@ contract AccrueInterestTest is UpgradesBaseTest {
function testMintGated() public fork(POLYGON_MAINNET) {
address newMarket = 0x26EA46e975778662f98dAa0E7a12858dA9139262;
address assetWhale = 0xEd41f5967252248412E6C69475ae8a5A4274A6f8;

// approve spending
vm.startPrank(assetWhale);
IERC20Upgradeable(CErc20Delegate(newMarket).underlying()).approve(newMarket, 1e6);
require(CErc20Delegate(newMarket).mint(1e6) == 0, "!mint failed");
vm.stopPrank();
}

function testDeployCToken() public debuggingOnly fork(POLYGON_MAINNET) {
Expand Down
6 changes: 4 additions & 2 deletions contracts/test/AnyLiquidationTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ contract AnyLiquidationTest is BaseTest {
}

function testSpecificRandom() public debuggingOnly {
testBscAnyLiquidation(1668);
testPolygonAnyLiquidation(14341);
// testPolygonAnyLiquidation(101);
}

Expand Down Expand Up @@ -223,7 +223,7 @@ contract AnyLiquidationTest is BaseTest {
(, PoolDirectory.Pool[] memory pools) = PoolDirectory(ap.getAddress("PoolDirectory")).getActivePools();

uint256 initRandom = random;
while (random - initRandom < 100) {
while (true) {
// get a random pool and a random borrower from it
(vars.comptroller, vars.borrower) = getPoolAndBorrower(random, pools);

Expand All @@ -240,6 +240,8 @@ contract AnyLiquidationTest is BaseTest {
}
}
}
// fail gracefully when there are no positions to liquidate
if (random - initRandom < 100) return;
random++;
}

Expand Down
1 change: 1 addition & 0 deletions contracts/test/AuthoritiesRegistryTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ contract AuthoritiesRegistryTest is WithPool {
vm.expectRevert("not owner or pool");
registry.reconfigureAuthority(address(comptroller));

vm.prank(registry.owner());
registry.reconfigureAuthority(address(comptroller));
}

Expand Down
Loading
Loading