From 7c62a5cddaf8a5aadc67f777780f16c527d5d0a0 Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 9 Dec 2024 19:37:40 +1300 Subject: [PATCH] updated to fix dust issue --- app/liquidation/liquidation_bot.py | 12 ------------ config.yaml | 2 +- contracts/Liquidator.sol | 7 +++++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/app/liquidation/liquidation_bot.py b/app/liquidation/liquidation_bot.py index 72bf794..e756a5e 100644 --- a/app/liquidation/liquidation_bot.py +++ b/app/liquidation/liquidation_bot.py @@ -1725,18 +1725,6 @@ def get_account_monitor_and_evc_listener(): if __name__ == "__main__": try: - # acct_monitor = AccountMonitor(True, True) - # acct_monitor.load_state(config.SAVE_STATE_PATH) - - # evc_listener = EVCListener(acct_monitor) - - # evc_listener.batch_account_logs_on_startup() - - # threading.Thread(target=acct_monitor.start_queue_monitoring).start() - # threading.Thread(target=evc_listener.start_event_monitoring).start() - - # while True: - # time.sleep(1) pass except Exception as e: # pylint: disable=broad-except diff --git a/config.yaml b/config.yaml index 8469bcc..bb73f5f 100644 --- a/config.yaml +++ b/config.yaml @@ -59,7 +59,7 @@ SWAPPER: "0x2Bba09866b6F1025258542478C39720A09B728bF" SWAP_VERIFIER: "0xae26485ACDDeFd486Fe9ad7C2b34169d360737c7" # LIQUIDATOR_CONTRACT: "0xe730e2548Abf263a5B4E42ACA8F8b31Cd4045a93" -LIQUIDATOR_CONTRACT: "0x9265e58b8bB373F84F0e6708D3eB1B9FA528CaDE" +LIQUIDATOR_CONTRACT: "0xbbF43565242af471B39D135747A8905C58F450b0" PYTH: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6" diff --git a/contracts/Liquidator.sol b/contracts/Liquidator.sol index dcbafd6..a4a6d5a 100644 --- a/contracts/Liquidator.sol +++ b/contracts/Liquidator.sol @@ -113,7 +113,8 @@ contract Liquidator { // Use swapper contract to repay borrowed asset multicallItems[1] = - abi.encodeCall(ISwapper.repay, (params.borrowedAsset, params.vault, params.repayAmount, address(this))); + // abi.encodeCall(ISwapper.repay, (params.borrowedAsset, params.vault, params.repayAmount, address(this))); + abi.encodeCall(ISwapper.repay, (params.borrowedAsset, params.vault, type(uint256).max, address(this))); // Sweep any dust left in the swapper contract multicallItems[2] = abi.encodeCall(ISwapper.sweep, (params.borrowedAsset, 0, params.receiver)); @@ -136,6 +137,8 @@ contract Liquidator { data: abi.encodeCall(IEVC.enableCollateral, (address(this), params.collateralVault)) }); + (uint256 maxRepay, ) = ILiquidation(params.vault).checkLiquidation(address(this), params.violatorAddress, params.collateralVault); + // Step 3: Liquidate account in violation batchItems[2] = IEVC.BatchItem({ onBehalfOfAccount: address(this), @@ -143,7 +146,7 @@ contract Liquidator { value: 0, data: abi.encodeCall( ILiquidation.liquidate, - (params.violatorAddress, params.collateralVault, params.repayAmount, 0) // TODO: adjust minimum collateral + (params.violatorAddress, params.collateralVault, maxRepay, 0) // TODO: adjust minimum collateral ) });