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

Don't use whales to fund, instead limit amount of base per agent #1643

Merged
merged 6 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 4 additions & 8 deletions scripts/fork_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@
# Note that if a token is missing in this mapping, we will try to
# call `mint` on the trading token to fund.
SEPOLIA_WHALE_ADDRESSES = {
# We ignore DAI since the underlying base token is mintable
# EZETH
"0xDD0D63E304F3D9d9E54d8945bE95011867c80E4f": "0x54A93937EE00838d659795b9bbbe904a00DdF278",
# RETH
"0x4713c86d0e467064A4CD2a974b7fDA79F7efc338": "0x8DFc7c74331162FE2FCc2Ee83173d806E4Ca2CE8",
# STETH
"0x7c485f458aD1F32FF66BC45306fd32974C963c32": "0xb59b98209e82Fc0549Bb2572809B7CD10289Bb91",
# Note all base tokens are mintable up to 500, so we don't need whales here
}
# TODO set the static block we fork at, in case whales change

Expand Down Expand Up @@ -189,7 +183,9 @@ def main(argv: Sequence[str] | None = None) -> None:
random_advance_time=False,
random_variable_rate=False,
lp_share_price_test=False,
base_budget_per_bot=FixedPoint(1000),
# TODO all base tokens are mintable up to 500 base
# If we want more, we need to put minting in a loop.
base_budget_per_bot=FixedPoint(500),
whale_accounts=SEPOLIA_WHALE_ADDRESSES,
)
except Exception as e: # pylint: disable=broad-except
Expand Down
4 changes: 4 additions & 0 deletions src/agent0/core/hyperdrive/interactive/hyperdrive_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ def add_funds(
# Impersonate + transfer to agent here
whale_account_addr = whale_accounts[base_token_contract.address]

# Ensure the whale account used here isn't the hyperdrive pool itself
if whale_account_addr == pool.interface.hyperdrive_address:
raise ValueError(f"Cannot use the hyperdrive pool itself as the whale for {pool.name}.")

# Ensure whale has enough base to transfer
whale_balance = base_token_contract.functions.balanceOf(whale_account_addr).call()
if whale_balance < base.scaled_value:
Expand Down
1 change: 1 addition & 0 deletions src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def run_fuzz_bots(
lp_share_price_test=lp_share_price_test,
crash_report_additional_info=hyperdrive_pool._crash_report_additional_info,
log_anvil_state_dump=chain.config.log_anvil_state_dump,
pool_name=hyperdrive_pool.name,
)
if len(fuzz_exceptions) > 0 and raise_error_on_failed_invariance_checks:
# If we have an ignore function, we filter exceptions
Expand Down
Loading