Skip to content

Commit

Permalink
updated to fix dust issue
Browse files Browse the repository at this point in the history
  • Loading branch information
leemount96 committed Dec 9, 2024
1 parent 07501aa commit 7c62a5c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
12 changes: 0 additions & 12 deletions app/liquidation/liquidation_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SWAPPER: "0x2Bba09866b6F1025258542478C39720A09B728bF"
SWAP_VERIFIER: "0xae26485ACDDeFd486Fe9ad7C2b34169d360737c7"

# LIQUIDATOR_CONTRACT: "0xe730e2548Abf263a5B4E42ACA8F8b31Cd4045a93"
LIQUIDATOR_CONTRACT: "0x9265e58b8bB373F84F0e6708D3eB1B9FA528CaDE"
LIQUIDATOR_CONTRACT: "0xbbF43565242af471B39D135747A8905C58F450b0"

PYTH: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6"

Expand Down
7 changes: 5 additions & 2 deletions contracts/Liquidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -136,14 +137,16 @@ 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),
targetContract: params.vault,
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
)
});

Expand Down

0 comments on commit 7c62a5c

Please sign in to comment.