Files
proxmox/scripts/deployment/compute-mainnet-truu-liquidity-amounts.sh
defiQUG dbd517b279 Sync workspace: config, docs, scripts, CI, operator rules, and submodule pointers.
- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains
- Omit embedded publish git dirs and empty placeholders from index

Made-with: Cursor
2026-04-12 06:12:20 -07:00

79 lines
2.5 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
# Print base_raw / quote_raw for Mainnet cW/TRUU PMM adds at 1:1 USD notional per leg
# (same ratio as seeds: B_ref=1_500_000 cW raw, Q_ref=372_348_929_900_893 TRUU raw).
#
# Usage:
# bash scripts/deployment/compute-mainnet-truu-liquidity-amounts.sh --usd-per-leg=125000
# bash scripts/deployment/compute-mainnet-truu-liquidity-amounts.sh --usd-per-leg=50000 --print-cast=0
#
# After funding the deployer wallet, run (existing pool → addLiquidity only):
# bash scripts/deployment/deploy-mainnet-pmm-cw-truu-pool.sh \
# --pair=cwusdt-truu --initial-price=<I> --base-amount=<base_raw> --quote-amount=<quote_raw>
#
# See: docs/03-deployment/MAINNET_PMM_TRUU_CWUSD_PEG_AND_BOT_RUNBOOK.md section 11
USD_PER_LEG=""
PRINT_CAST=1
I_DEFAULT="${PMM_TRUU_INITIAL_I:-2482326199339289065}"
for arg in "$@"; do
case "$arg" in
--usd-per-leg=*) USD_PER_LEG="${arg#*=}" ;;
--print-cast=*) PRINT_CAST="${arg#*=}" ;;
*)
echo "[fail] unknown arg: $arg" >&2
exit 2
;;
esac
done
if [[ -z "$USD_PER_LEG" ]]; then
echo "[fail] required: --usd-per-leg=N (USD notional on cW leg = TRUU leg at reference ratio)" >&2
exit 1
fi
command -v python3 >/dev/null 2>&1 || {
echo "[fail] python3 required" >&2
exit 1
}
read -r BASE_RAW QUOTE_RAW <<EOF
$(python3 - <<PY
from decimal import Decimal
usd = Decimal("$USD_PER_LEG")
if usd <= 0:
raise SystemExit("usd must be positive")
base = int(usd * Decimal(10) ** 6)
b_ref = 1_500_000
q_ref = 372_348_929_900_893
quote = base * q_ref // b_ref
print(base, quote)
PY
)
EOF
echo "=== Mainnet cW/TRUU add — 1:1 USD legs (reference ratio) ==="
echo "usd_per_leg=$USD_PER_LEG"
echo "base_raw (cWUSDT or cWUSDC, 6 dec)=$BASE_RAW"
echo "quote_raw (TRUU, 10 dec)=$QUOTE_RAW"
truu_full="$(python3 -c "print($QUOTE_RAW / 10**10)")"
echo "TRUU full tokens ≈ $truu_full"
echo "implied USD/TRUU if legs 1:1 ≈ $(python3 -c "print(float($USD_PER_LEG) / ($QUOTE_RAW / 10**10))")"
echo
echo "Both pools at this size need 2× cW (cWUSDT + cWUSDC) and 2× TRUU quote if funded to the same USD each."
echo
if [[ "$PRINT_CAST" == "1" ]]; then
echo "deploy-mainnet-pmm-cw-truu-pool.sh --pair=cwusdt-truu \\"
echo " --initial-price=$I_DEFAULT \\"
echo " --base-amount=$BASE_RAW \\"
echo " --quote-amount=$QUOTE_RAW"
echo
echo "deploy-mainnet-pmm-cw-truu-pool.sh --pair=cwusdc-truu \\"
echo " --initial-price=$I_DEFAULT \\"
echo " --base-amount=$BASE_RAW \\"
echo " --quote-amount=$QUOTE_RAW"
fi