Skip to content

Added rate limiter on RPC calls. Defaulted notify and execute_liquidation to True. #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7e68aa4
Added logging idx/total_accounts
dandagow3t Jan 23, 2025
2314863
Added some more logs
dandagow3t Jan 23, 2025
8fd0594
New logs
dandagow3t Jan 23, 2025
bf4bf31
Added liquidation-bot to run as a system service.
dandagow3t Jan 23, 2025
994c108
Activated notify and executeLiquidation
dangow3 Jan 27, 2025
ca74a75
Added rate limiting.
dangow3 Jan 28, 2025
c1ecd80
Merge branch 'v03' into main
dandagow3t Jan 28, 2025
d709b9c
Merge pull request #2 from dandagow3t/main
dandagow3t Jan 28, 2025
350070f
Fixed utils.py after merge from main.
dangow3 Jan 28, 2025
42d11d6
Small log.
dangow3 Jan 28, 2025
a06058f
Small typo correction.
dangow3 Jan 29, 2025
63fbbb6
Removed shell_routines.txt
dangow3 Jan 29, 2025
6ae271b
Merge pull request #3 from dandagow3t/v03
dandagow3t Jan 29, 2025
d48d980
Small revisions.
dangow3 Jan 29, 2025
72ce7cc
Found another place candidate to rate limiting.
dangow3 Feb 9, 2025
d530816
Some more places that needed rate limiting.
dangow3 Feb 9, 2025
445b3cf
Removed time.sleeps as they were not needed and speed up loading by s…
dangow3 Feb 18, 2025
5c8224a
added 1inch api key
dangow3 Feb 19, 2025
c2ae51b
Removed the hs inf check on load.
dangow3 Feb 19, 2025
6b9f0a6
Removed 1inch and stuff. Switched to swap api.
dangow3 Feb 24, 2025
aaebeba
Added back the removal of an unhealthy account.
dangow3 Mar 8, 2025
718b138
Added Berrachain
dangow3 Mar 19, 2025
fa02ecc
Updated Berra's EVC deployment block.
dangow3 Mar 19, 2025
7d328a3
Added configs for Liquidator on Berachain.
dangow3 Mar 20, 2025
5716a49
Patch in scan_block_range_for_account_status_check; Added all other c…
dangow3 Apr 2, 2025
ab5f253
Updated one parameter in config.yaml.
dangow3 Apr 2, 2025
64b48c4
Activated all chains in code.
dangow3 Apr 2, 2025
1d826f9
Added logging with chainId and route for getting details on a specifi…
dangow3 Apr 2, 2025
1253506
More logs and optimisations.
dangow3 Apr 3, 2025
32597ac
New change to gitignore.
dangow3 Apr 3, 2025
48cbf0b
Some more fixes for the logging in order to support the logging optim…
dangow3 Apr 3, 2025
ca3d535
Added back support for logging into a file.
dangow3 Apr 3, 2025
b10b258
Added BOB.
dangow3 Apr 3, 2025
90bec10
Found one more place where the chain aware logging was not done.
dangow3 Apr 3, 2025
212cccd
New routes;
dangow3 Apr 3, 2025
c87120e
Ported main-base/commit/a76bad5
dangow3 Apr 4, 2025
3a31a37
Updated config.yaml per main-base.
dangow3 Apr 4, 2025
c344523
Took some fixes from parent.
dangow3 Apr 4, 2025
1aefd1b
Deployed Liquidator.sol on BOB
dangow3 Apr 4, 2025
73da263
Fix for account monitor.
dangow3 Apr 8, 2025
3af4ecd
Fixed pyth bug.
dandagow3t Apr 14, 2025
2bd5229
Merge pull request #4 from dandagow3t/patch_003
dandagow3t Apr 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ venv/

# Logs and save state
logs/
state/

# Python cache files
__pycache__/
*.pyc
*.pyo
*.pyd

/redstone_script/node_modules
/redstone_script/node_modules

.flaskenv

/state
/my_docs
temp.txt
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,47 @@ To run the basic test script & broadcast to the configured RPC, modify the [Liqu
forge script test/LiquidationSetupWithVaultCreated.sol --rpc-url $RPC_URL --broadcast --ffi -vvv --slow --evm-version shanghai
```

This test is intended to create a position on an existing vault. To test a liquitation, you can either wait for price fluctuations to happen or manually change the LTV of the vault using the create.euler.finance UI if it is a governed vault that you control.
This test is intended to create a position on an existing vault. To test a liquitation, you can either wait for price fluctuations to happen or manually change the LTV of the vault using the create.euler.finance UI if it is a governed vault that you control.

## To run the liquidation bot as a service

Define service in /etc/systemd/system/liquidation-bot.service
```
[Unit]
Description=Liquidation Bot Service
After=network.target

[Service]
User=admin
WorkingDirectory=/home/admin/liq-bot-v2
Environment="PATH=/home/admin/liq-bot-v2/venv/bin"
Environment="FLASK_APP=application.py"
Environment="FLASK_RUN_HOST=0.0.0.0"
Environment="FLASK_RUN_PORT=8080"
Environment="FLASK_ENV=production"
Environment="FLASK_DEBUG=False"

# Using flask instead of python3
ExecStart=/home/admin/liq-bot-v2/venv/bin/flask run --host=0.0.0.0 --port=8080

Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
```

Reload systemd:
```
sudo systemctl daemon-reload
```

Run service:
```
sudo systemctl start liquidation-bot.service
```

Check service status:
```
sudo systemctl status liquidation-bot.service
```
16 changes: 15 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ def create_app():
def health_check():
return jsonify({"status": "healthy"}), 200

chain_ids = [1]
chain_ids = [
1, # Ethereum mainnet
80094, # Berachain
60808, # BOB
# 10, # Optimism
# 56, # Binance Smart Chain
# 100, # Gnosis Chain
# 130, # Unichain
# 137, # Polygon
# 480, # World Chain
# 8453, # Base
# 42161, # Arbitrum One
# 43114, # Avalanche
# 57073, # Ink
]

monitor_thread = threading.Thread(target=start_monitor, args=(chain_ids,))
monitor_thread.start()
Expand Down
Loading