import sys; sys.path.insert(0, "/home/vpavlin/devel/m1-local/harness"); import h I = h.I; RAY = 10**27 def show(label): h.wait_next_block() s = {"redemption": h.inspect("stablecoin", I["REDEMPTION"], "RedemptionPriceState"), "fee_acc": h.inspect("stablecoin", I["FEE_ACC"], "StabilityFeeAccumulator"), "position2": h.inspect("stablecoin", I["POSITION2"], "Position"), "vault2": h.holding(I["POS2_VAULT"]), "user_sc": h.holding(I["SC_USER_HOLD"])} h.log_note("SC snapshot: " + label, s); print(" ", s) def tx(label, instr, **a): h.act(label, "stablecoin", "stablecoin", instr, snap=False, **a); show(label) tx("SC7 refresh_globals (permissionless) - project redemption price under the saturated rate", "refresh_globals", caller=I["HOLD_A"], protocol_parameters=I["PROTO_PARAMS"], stability_fee_accumulator=I["FEE_ACC"], redemption_price_state=I["REDEMPTION"], market_price_oracle=I["SCO_PRICE"], clock=I["CLOCK"]) tx("SC8 open_position by auth-transfer-initialized POS_OWNER2, 1e18 A", "open_position", owner=I["POS_OWNER2"], position=I["POSITION2"], vault=I["POS2_VAULT"], user_collateral_holding=I["HOLD_A"], collateral_definition=I["DEF_A"], protocol_parameters=I["PROTO_PARAMS"], clock=I["CLOCK"], position_nonce=0, initial_collateral_amount=10**18) tx("SC9 generate_debt 1e15 by POS_OWNER2 (tiny vs collateral; blocked only if redemption price exploded)", "generate_debt", owner=I["POS_OWNER2"], position=I["POSITION2"], stablecoin_definition=I["SC_DEF"], user_stablecoin_holding=I["SC_USER_HOLD"], stability_fee_accumulator=I["FEE_ACC"], redemption_price_state=I["REDEMPTION"], market_price_oracle=I["SCO_PRICE"], protocol_parameters=I["PROTO_PARAMS"], clock=I["CLOCK"], amount=10**15) tx("SC10 deposit_collateral 1e17 by POS_OWNER2 (second signed op on the same owner)", "deposit_collateral", owner=I["POS_OWNER2"], position=I["POSITION2"], vault=I["POS2_VAULT"], user_collateral_holding=I["HOLD_A"], protocol_parameters=I["PROTO_PARAMS"], amount=10**17) tx("SC11 admin set_controller_gains (admin's SECOND action ever)", "set_controller_gains", admin=I["SC_ADMIN"], protocol_parameters=I["PROTO_PARAMS"], new_proportional_gain=0, new_integral_gain=0)