Skip to content

Commit

Permalink
fix: remove deprecation (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Nov 22, 2024
1 parent 1bc10cd commit f9e12a1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
16 changes: 8 additions & 8 deletions src/ProtocolV2TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ contract ProtocolV2TestBase is CommonTestBase, DiffUtils {
function e2eTest(ILendingPool pool) public {
ReserveConfig[] memory configs = _getReservesConfigs(pool);
ReserveConfig memory collateralConfig = _getGoodCollateral(configs);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
for (uint256 i; i < configs.length; i++) {
if (_includeInE2e(configs[i])) {
e2eTestAsset(pool, collateralConfig, configs[i]);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}
}
}
Expand All @@ -147,19 +147,19 @@ contract ProtocolV2TestBase is CommonTestBase, DiffUtils {
_getTokenAmountByEthValue(pool, collateralConfig, 100)
);
_deposit(testAssetConfig, pool, testAssetSupplier, testAssetAmount);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
// test withdrawal
_withdraw(testAssetConfig, pool, testAssetSupplier, testAssetAmount / 2);
_withdraw(testAssetConfig, pool, testAssetSupplier, type(uint256).max);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
// test variable borrowing
if (testAssetConfig.borrowingEnabled) {
_e2eTestBorrowRepay(pool, collateralSupplier, testAssetConfig, testAssetAmount, false);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
// test stable borrowing
if (testAssetConfig.stableBorrowRateEnabled) {
_e2eTestBorrowRepay(pool, collateralSupplier, testAssetConfig, testAssetAmount, true);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ contract ProtocolV2TestBase is CommonTestBase, DiffUtils {
uint256 amount,
bool stable
) internal {
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
this._borrow(testAssetConfig, pool, borrower, amount, stable);
// switching back and forth between rate modes should work
if (testAssetConfig.stableBorrowRateEnabled) {
Expand All @@ -203,7 +203,7 @@ contract ProtocolV2TestBase is CommonTestBase, DiffUtils {
pool.swapBorrowRateMode(testAssetConfig.underlying, stable ? 1 : 2);
}
_repay(testAssetConfig, pool, borrower, amount, stable);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/ProtocolV3TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
function e2eTest(IPool pool) public {
ReserveConfig[] memory configs = _getReservesConfigs(pool);
ReserveConfig memory collateralConfig = _getGoodCollateral(configs);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
for (uint256 i; i < configs.length; i++) {
if (_includeInE2e(configs[i])) {
e2eTestAsset(pool, collateralConfig, configs[i]);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
} else {
console.log('E2E: TestAsset %s SKIPPED', configs[i].symbol);
}
Expand Down Expand Up @@ -166,20 +166,20 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
// GHO is a special case as it cannot be supplied
if (testAssetConfig.underlying == AaveV3EthereumAssets.GHO_UNDERLYING) {
_deposit(collateralConfig, pool, collateralSupplier, collateralAssetAmount);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
// test variable borrowing
if (testAssetConfig.borrowingEnabled) {
_e2eTestBorrowRepay(pool, collateralSupplier, testAssetConfig, testAssetAmount);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}
} else {
_deposit(collateralConfig, pool, collateralSupplier, collateralAssetAmount);
_deposit(testAssetConfig, pool, testAssetSupplier, testAssetAmount);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
// test withdrawal
_withdraw(testAssetConfig, pool, testAssetSupplier, testAssetAmount / 2);
_withdraw(testAssetConfig, pool, testAssetSupplier, type(uint256).max);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
// test variable borrowing
if (testAssetConfig.borrowingEnabled) {
if (
Expand All @@ -190,7 +190,7 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
return;
}
_e2eTestBorrowRepay(pool, collateralSupplier, testAssetConfig, testAssetAmount);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions tests/ProtocolV3TestBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,17 @@ contract ProtocolV3TestOptimismSnapshot is ProtocolV3TestBase {
vm.createSelectFork('optimism', 117408311);
}

function test_snapshot() public {
function test_snapshotState() public {
createConfigurationSnapshot('snapshot', AaveV3Optimism.POOL, true, false, false, false);
}
}


contract ProtocolV3TestFantomSnapshot is ProtocolV3TestBase {
function setUp() public {
vm.createSelectFork('fantom', 86731015);
}

function test_snapshot() public {
function test_snapshotState() public {
createConfigurationSnapshot('snapshotFtm', AaveV3Fantom.POOL, true, false, false, false);
}
}
14 changes: 7 additions & 7 deletions zksync/src/ProtocolV3TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
function e2eTest(IPool pool) public {
ReserveConfig[] memory configs = _getReservesConfigs(pool);
ReserveConfig memory collateralConfig = _getGoodCollateral(configs);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
for (uint256 i; i < configs.length; i++) {
if (_includeInE2e(configs[i])) {
e2eTestAsset(pool, collateralConfig, configs[i]);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
} else {
console.log('E2E: TestAsset %s SKIPPED', configs[i].symbol);
}
Expand Down Expand Up @@ -210,20 +210,20 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
// GHO is a special case as it cannot be supplied
if (testAssetConfig.underlying == AaveV3EthereumAssets.GHO_UNDERLYING) {
_deposit(collateralConfig, pool, collateralSupplier, collateralAssetAmount);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
// test variable borrowing
if (testAssetConfig.borrowingEnabled) {
_e2eTestBorrowRepay(pool, collateralSupplier, testAssetConfig, testAssetAmount);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}
} else {
_deposit(collateralConfig, pool, collateralSupplier, collateralAssetAmount);
_deposit(testAssetConfig, pool, testAssetSupplier, testAssetAmount);
uint256 snapshot = vm.snapshot();
uint256 snapshot = vm.snapshotState();
// test withdrawal
_withdraw(testAssetConfig, pool, testAssetSupplier, testAssetAmount / 2);
_withdraw(testAssetConfig, pool, testAssetSupplier, type(uint256).max);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
// test variable borrowing
if (testAssetConfig.borrowingEnabled) {
if (
Expand All @@ -234,7 +234,7 @@ contract ProtocolV3TestBase is RawProtocolV3TestBase, CommonTestBase {
return;
}
_e2eTestBorrowRepay(pool, collateralSupplier, testAssetConfig, testAssetAmount);
vm.revertTo(snapshot);
vm.revertToState(snapshot);
}
}
}
Expand Down

0 comments on commit f9e12a1

Please sign in to comment.