agent0.hyperfuzz.system_fuzz.run_fuzz_bots ========================================== .. py:module:: agent0.hyperfuzz.system_fuzz.run_fuzz_bots .. autoapi-nested-parse:: Helper function for running random fuzz bots. .. !! processed by numpydoc !! Attributes ---------- .. autoapisummary:: agent0.hyperfuzz.system_fuzz.run_fuzz_bots.ONE_HOUR_IN_SECONDS agent0.hyperfuzz.system_fuzz.run_fuzz_bots.ONE_DAY_IN_SECONDS agent0.hyperfuzz.system_fuzz.run_fuzz_bots.ONE_YEAR_IN_SECONDS agent0.hyperfuzz.system_fuzz.run_fuzz_bots.ONE_YEAR_IN_HOURS agent0.hyperfuzz.system_fuzz.run_fuzz_bots.INITIAL_LIQUIDITY_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.INITIAL_VAULT_SHARE_PRICE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.MINIMUM_SHARE_RESERVES_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.MINIMUM_TRANSACTION_AMOUNT_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.CIRCUIT_BREAKER_DELTA_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.POSITION_DURATION_HOURS_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.CHECKPOINT_DURATION_HOURS_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.INITIAL_TIME_STRETCH_APR_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.VARIABLE_RATE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.ADVANCE_TIME_SECONDS_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.FEE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.LP_SHARE_PRICE_VARIABLE_RATE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.LP_SHARE_PRICE_FLAT_FEE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.LP_SHARE_PRICE_CURVE_FEE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.LP_SHARE_PRICE_GOVERNANCE_LP_FEE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.LP_SHARE_PRICE_GOVERNANCE_ZOMBIE_FEE_RANGE agent0.hyperfuzz.system_fuzz.run_fuzz_bots.TRADE_COUNT_CHECK Functions --------- .. autoapisummary:: agent0.hyperfuzz.system_fuzz.run_fuzz_bots.generate_fuzz_hyperdrive_config agent0.hyperfuzz.system_fuzz.run_fuzz_bots.run_fuzz_bots Module Contents --------------- .. py:data:: ONE_HOUR_IN_SECONDS :value: 3600 .. py:data:: ONE_DAY_IN_SECONDS :value: 86400 .. py:data:: ONE_YEAR_IN_SECONDS :value: 31449600 .. py:data:: ONE_YEAR_IN_HOURS :value: 8736 .. py:data:: INITIAL_LIQUIDITY_RANGE :type: tuple[float, float] :value: (10, 100000) .. py:data:: INITIAL_VAULT_SHARE_PRICE_RANGE :type: tuple[float, float] :value: (0.5, 2.5) .. py:data:: MINIMUM_SHARE_RESERVES_RANGE :type: tuple[float, float] :value: (0.1, 1) .. py:data:: MINIMUM_TRANSACTION_AMOUNT_RANGE :type: tuple[float, float] :value: (0.1, 10) .. py:data:: CIRCUIT_BREAKER_DELTA_RANGE :type: tuple[float, float] :value: (0.15, 2) .. py:data:: POSITION_DURATION_HOURS_RANGE :type: tuple[int, int] .. py:data:: CHECKPOINT_DURATION_HOURS_RANGE :type: tuple[int, int] :value: (1, 24) .. py:data:: INITIAL_TIME_STRETCH_APR_RANGE :type: tuple[float, float] :value: (0.005, 0.5) .. py:data:: VARIABLE_RATE_RANGE :type: tuple[float, float] :value: (0, 1) .. py:data:: ADVANCE_TIME_SECONDS_RANGE :type: tuple[int, int] .. py:data:: FEE_RANGE :type: tuple[float, float] :value: (0.0001, 0.2) .. py:data:: LP_SHARE_PRICE_VARIABLE_RATE_RANGE :type: tuple[float, float] :value: (0, 0.1) .. py:data:: LP_SHARE_PRICE_FLAT_FEE_RANGE :type: tuple[float, float] :value: (0, 0) .. py:data:: LP_SHARE_PRICE_CURVE_FEE_RANGE :type: tuple[float, float] :value: (0, 0) .. py:data:: LP_SHARE_PRICE_GOVERNANCE_LP_FEE_RANGE :type: tuple[float, float] :value: (0, 0) .. py:data:: LP_SHARE_PRICE_GOVERNANCE_ZOMBIE_FEE_RANGE :type: tuple[float, float] :value: (0, 0) .. py:data:: TRADE_COUNT_CHECK :value: 100 .. py:function:: generate_fuzz_hyperdrive_config(rng: numpy.random.Generator, lp_share_price_test: bool, steth: bool) -> agent0.LocalHyperdrive.Config Fuzz over hyperdrive config. :param rng: Random number generator. :type rng: np.random.Generator :param lp_share_price_test: If True, uses lp share price test fuzz parameters. :type lp_share_price_test: bool :param steth: If True, uses steth instead of erc4626 :type steth: bool :returns: Fuzzed hyperdrive config. :rtype: LocalHyperdrive.Config .. !! processed by numpydoc !! .. py:function:: run_fuzz_bots(chain: agent0.Chain, hyperdrive_pools: agent0.Hyperdrive | Sequence[agent0.Hyperdrive], check_invariance: bool, num_random_agents: int | None = None, num_random_hold_agents: int | None = None, agents: Sequence[agent0.core.hyperdrive.interactive.hyperdrive_agent.HyperdriveAgent] | None = None, base_budget_per_bot: fixedpointmath.FixedPoint | None = None, eth_budget_per_bot: fixedpointmath.FixedPoint | None = None, slippage_tolerance: fixedpointmath.FixedPoint | None = None, raise_error_on_crash: bool = False, raise_error_on_failed_invariance_checks: bool = False, ignore_raise_error_func: Callable[[Exception], bool] | None = None, minimum_avg_agent_base: fixedpointmath.FixedPoint | None = None, minimum_avg_agent_eth: fixedpointmath.FixedPoint | None = None, log_to_rollbar: bool = True, run_async: bool = False, random_advance_time: bool = False, random_variable_rate: bool = False, num_iterations: int | None = None, lp_share_price_test: bool = False, whale_accounts: dict[eth_typing.ChecksumAddress, eth_typing.ChecksumAddress] | None = None, accrue_interest_func: Callable[[agent0.ethpy.hyperdrive.HyperdriveReadWriteInterface, fixedpointmath.FixedPoint, int], None] | None = None, accrue_interest_rate: fixedpointmath.FixedPoint | None = None) -> Sequence[agent0.core.hyperdrive.interactive.hyperdrive_agent.HyperdriveAgent] Runs fuzz bots on a hyperdrive pool. :param chain: The chain to run the bots on. :type chain: Chain :param hyperdrive_pools: The hyperdrive pool(s) to run the bots on. :type hyperdrive_pools: Hyperdrive | Sequence[Hyperdrive] :param check_invariance: If True, will run invariance checks after each set of trades. :type check_invariance: bool :param agents: The agents making trades. If None, will create random agents. :type agents: Sequence[HyperdriveAgent] | None, optional :param num_random_agents: The number of random agents to create. Defaults to 2. :type num_random_agents: int | None, optional :param num_random_hold_agents: The number of random agents to create. Defaults to 2. :type num_random_hold_agents: int | None, optional :param base_budget_per_bot: The base budget per bot. Defaults to 10_000_000 :type base_budget_per_bot: FixedPoint | None, optional :param eth_budget_per_bot: The ETH budget per bot. Defaults to 1_000 :type eth_budget_per_bot: FixedPoint | None, optional :param slippage_tolerance: The slippage tolerance. Defaults to 1% slippage :type slippage_tolerance: FixedPoint | None, optional :param raise_error_on_crash: If True, will exit the process if a bot crashes. Defaults to False. :type raise_error_on_crash: bool, optional :param raise_error_on_failed_invariance_checks: If True, will exit the process if the pool fails an invariance check. Defaults to False. :type raise_error_on_failed_invariance_checks: bool, optional :param ignore_raise_error_func: A function that determines if an exception should be ignored when raising error on crash. The function takes an exception as an an argument and returns True if the exception should be ignored. Defaults to raising all errors. :type ignore_raise_error_func: Callable[[Exception], bool] | None, optional :param minimum_avg_agent_base: The minimum average agent base. Will refund bots if average agent base drops below this. Defaults to 1/10 of base_budget_per_bot :type minimum_avg_agent_base: FixedPoint | None, optional :param minimum_avg_agent_eth: The minimum average agent eth. Will refund bots if average agent base drops below this. Defaults to 1/10 of eth_budget_per_bot :type minimum_avg_agent_eth: FixedPoint | None, optional :param log_to_rollbar: If True, log errors rollbar. Defaults to True. :type log_to_rollbar: bool, optional :param run_async: If True, will run the bots asynchronously. Defaults to False. :type run_async: bool, optional :param random_advance_time: If True, will advance the time randomly between sets of trades. Defaults to False. :type random_advance_time: bool, optional :param random_variable_rate: If True, will randomly change the rate between sets of trades. Defaults to False. :type random_variable_rate: bool, optional :param num_iterations: The number of iterations to run. Defaults to None (infinite) :type num_iterations: int | None, optional :param lp_share_price_test: If True, will test the LP share price. Defaults to False. :type lp_share_price_test: bool, optional :param whale_accounts: A mapping between token -> whale addresses to use to fund the fuzz agent. If the token is not in the mapping, fuzzing will attempt to call `mint` on the token contract. Defaults to an empty mapping. :type whale_accounts: dict[ChecksumAddress, ChecksumAddress] | None, optional :param accrue_interest_func: A function that will accrue interest on the hyperdrive pool. This function will get called after advancing time, with the following signature: `accrue_interest_func(hyperdrive_interface, variable_rate, block_number_before_advance)`. :type accrue_interest_func: Callable[[HyperdriveReadWriteInterface, FixedPoint, int], None] | None, optional :param accrue_interest_rate: The variable rate to be passed into the accrue_interest_func. Note this value is only used when forking, as variable interest is handled by a mock yield source when simulating. If `random_variable_rate` is True, this value will be ignored. :type accrue_interest_rate: FixedPoint | None, optional :returns: The set of agents making trades. :rtype: Sequence[HyperdriveAgent] .. !! processed by numpydoc !!