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

Commit 311a4d6

Browse files
added test for withdrawal of native asset
1 parent 6b2178b commit 311a4d6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

contracts/test/liquidators/IonicLiquidatorTest.sol

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,31 @@ contract IonicLiquidatorTest is UpgradesBaseTest {
157157
liquidator.safeLiquidateToTokensWithFlashLoan(vars);
158158
}
159159

160+
function testWithdrawalLiquidator() public debuggingOnly fork(MODE_MAINNET) {
161+
TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress("IonicUniV3Liquidator")));
162+
IonicUniV3Liquidator implV3 = new IonicUniV3Liquidator();
163+
IonicUniV3Liquidator liquidatorV3 = IonicUniV3Liquidator(payable(ap.getAddress("IonicUniV3Liquidator")));
164+
ProxyAdmin proxyAdmin = ProxyAdmin(ap.getAddress("DefaultProxyAdmin"));
165+
166+
vm.startPrank(proxyAdmin.owner());
167+
proxyAdmin.upgrade(proxyV3, address(implV3));
168+
vm.stopPrank();
169+
170+
vm.prank(0x4200000000000000000000000000000000000016);
171+
(bool success, ) = address(liquidatorV3).call{ value: 1 ether }("");
172+
require(success, "transfer of funds failed");
173+
174+
uint256 beforeBalance = liquidatorV3.owner().balance;
175+
176+
vm.prank(liquidatorV3.owner());
177+
liquidatorV3.withdrawAll();
178+
179+
emit log_named_uint("balance of liquidator", liquidatorV3.owner().balance);
180+
181+
assertEq(liquidatorV3.owner().balance, beforeBalance + 1 ether);
182+
assertEq(address(liquidatorV3).balance, 0);
183+
}
184+
160185
function testLiquidateAfterUpgradeLiquidator() public debuggingOnly forkAtBlock(MODE_MAINNET, 9382006) {
161186
// upgrade IonicLiquidator
162187
TransparentUpgradeableProxy proxyV3 = TransparentUpgradeableProxy(payable(ap.getAddress("IonicUniV3Liquidator")));

0 commit comments

Comments
 (0)