Remove temporary USDC cleanup scripts from repo.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 12:34:09 +08:00
parent 2854d94e6b
commit 4b1c629d26
2 changed files with 0 additions and 100 deletions
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/env python3
import paramiko
import sys
HOST = "47.245.56.5"
USER = "root"
PASSWORD = "woaini88@"
def main():
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASSWORD, timeout=20)
cmd = (
"cd /opt/coinox && git fetch origin main && git reset --hard origin/main && "
"git log -1 --oneline && pm2 restart coinox --update-env && sleep 2 && "
"grep -n '仅支持币本位' lib/options/options_register.py | head -3 && "
"grep -n 'TRADE_BUDGET_USDC' lib/env/env_ui_manifest.py || echo NO_USDC_BUDGET_IN_UI"
)
_, o, e = c.exec_command(cmd, timeout=90)
print(o.read().decode("utf-8", "replace")[:4000])
err = e.read().decode("utf-8", "replace")
if err.strip():
print("ERR:", err[:1000])
c.close()
if __name__ == "__main__":
main()
-70
View File
@@ -1,70 +0,0 @@
#!/usr/bin/env python3
"""Strip dead USDC quote/open paths from options_register.py."""
from __future__ import annotations
from pathlib import Path
P = Path(__file__).resolve().parents[1] / "lib" / "options" / "options_register.py"
text = P.read_text(encoding="utf-8")
MARKER_Q = 'return jsonify({"ok": False, "msg": f"币本位报价失败: {e}"})'
MARKER_O = 'return jsonify({"ok": False, "msg": f"币本位开仓失败: {e}"})'
ROUTE_OPEN = ' @app.route("/api/options/open", methods=["POST"])'
ROUTE_PENDING = ' @app.route("/api/options/orders/pending")'
iq = text.find(MARKER_Q)
io = text.find(MARKER_O)
i_open = text.find(ROUTE_OPEN)
i_pending = text.find(ROUTE_PENDING)
if min(iq, io, i_open, i_pending) < 0:
raise SystemExit(f"anchors missing q={iq} o={io} open={i_open} pending={i_pending}")
# after quote coin except → reject; drop USDC quote body
q_end = text.find("\n", iq) + 1
new_q = (
text[:q_end]
+ "\n return jsonify({\"ok\": False, \"msg\": \"CoinOX 仅支持币本位期权\"})\n\n"
+ text[i_open:]
)
# recompute open anchors on new text
io = new_q.find(MARKER_O)
i_pending = new_q.find(ROUTE_PENDING)
o_end = new_q.find("\n", io) + 1
new_text = (
new_q[:o_end]
+ "\n return jsonify({\"ok\": False, \"msg\": \"CoinOX 仅支持币本位期权\"})\n\n"
+ new_q[i_pending:]
)
# Replace convert + spot swap handlers with 410 stubs (keep route names for old UI)
import re
def stub_route(src: str, route_sig: str, stub_body: str) -> str:
m = re.search(
rf"( @app\.route\({re.escape(route_sig)}.*?\)\n @lr\n def \w+\(.*?\):\n)",
src,
flags=re.S,
)
if not m:
print("warn: route not found", route_sig)
return src
start = m.end()
# find next route at same indent
n = re.search(r"\n @app\.route\(", src[start:])
end = start + n.start() + 1 if n else len(src)
return src[:start] + stub_body + src[end:]
stub = ' return jsonify({"ok": False, "msg": "CoinOX 已移除 USDC 兑换"}), 410\n\n'
for sig in ('"/api/options/convert/quote", methods=["POST"]', '"/api/options/convert/execute", methods=["POST"]', '"/api/options/spot/swap", methods=["POST"]'):
new_text = stub_route(new_text, sig, stub)
# transfer default USDC -> USDT
new_text = new_text.replace(
'ccy = (data.get("ccy") or "USDC").upper()',
'ccy = (data.get("ccy") or "USDT").upper()',
)
P.write_text(new_text, encoding="utf-8")
print("updated", P)
print("size", len(text), "->", len(new_text))