Skip to content
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

No trades on pools fix #1726

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions scripts/fork_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"0xdC035D45d973E3EC169d2276DDab16f1e407384F": "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD",
# sUSDe
"0x9D39A5DE30e57443BfF2A8307A4256c8797A3497": "0xb99a2c4C1C4F1fc27150681B740396F6CE1cBcF5",
# WXDAI
"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
}

GNOSIS_WHALE_ADDRESSES = {
Expand Down
6 changes: 5 additions & 1 deletion src/agent0/core/hyperdrive/policies/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ def open_long_with_random_amount(

# TODO fix all crashes in calc_max_short and calc_max_long and instead return 0 for max short
try:
maximum_trade_amount = interface.calc_max_long(wallet.balance.amount, interface.current_pool_state)
# There's an issue around calc_max_long where it overestimates the max trade amount
# Hence, we multiply it by 0.9 to go under
maximum_trade_amount = interface.calc_max_long(
wallet.balance.amount, interface.current_pool_state
) * FixedPoint(0.9)
# TODO pyo3 throws a PanicException here, which is derived from BaseException
# Ideally, we would import the exact exception in python here, but pyo3 doesn't
# expose this exception. Need to (1) fix the underlying calc_max_short bug, or
Expand Down
Loading