Files
proxmox/scripts/omnl/omnl-m1-clearing-102b-chunked.sh
defiQUG 7ac74f432b chore: sync docs, config schemas, scripts, and meta task alignment
- Institutional / JVMTM / reserve-provenance / GRU transport + standards JSON
- Validation and verify scripts (Blockscout labels, x402, GRU preflight, P1 local path)
- Wormhole wiring in AGENTS, MCP_SETUP, MASTER_INDEX, 04-configuration README
- Meta docs, integration gaps, live verification log, architecture updates
- CI validate-config workflow updates

Operator/LAN items, submodule working trees, and public token-aggregation edge
routes remain follow-up (see TODOS_CONSOLIDATED P1).

Made-with: Cursor
2026-03-31 22:31:39 -07:00

66 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# OMNL Fineract — Move USD 102,000,000,000.00 from FROM_OFFICE to TO_OFFICE using chunked M1 clearing.
# Fineract journal line amounts must stay within DB limits; this repo verified 1B USD (100_000_000_000 cents) per line.
#
# Prerequisites: omnl-fineract/.env (or root .env) with OMNL API credentials.
# Live: COMPLIANCE_AUTH_REF, COMPLIANCE_APPROVER, DRY_RUN=0
#
# Usage (repo root):
# DRY_RUN=1 bash scripts/omnl/omnl-m1-clearing-102b-chunked.sh
# DRY_RUN=0 COMPLIANCE_AUTH_REF=... COMPLIANCE_APPROVER="..." bash scripts/omnl/omnl-m1-clearing-102b-chunked.sh
#
set -euo pipefail
REPO_ROOT="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
DRY_RUN="${DRY_RUN:-1}"
FROM_OFFICE="${FROM_OFFICE:-21}"
TO_OFFICE="${TO_OFFICE:-22}"
# 102 billion USD in cents = 102 * 10^9 * 100
TOTAL_CENTS=$((102000000000 * 100))
# Per-chunk: 1 billion USD in cents (Fineract-safe on this tenant)
CHUNK_CENTS="${CHUNK_CENTS:-100000000000}"
COMPLIANCE_AUTH_REF="${COMPLIANCE_AUTH_REF:-}"
COMPLIANCE_APPROVER="${COMPLIANCE_APPROVER:-}"
STAMP="${STAMP:-20260331}"
if [ "$DRY_RUN" != "1" ]; then
if [ -z "$COMPLIANCE_AUTH_REF" ] || [ -z "$COMPLIANCE_APPROVER" ]; then
echo "ERROR: Live run requires COMPLIANCE_AUTH_REF and COMPLIANCE_APPROVER" >&2
exit 1
fi
fi
n_full=$((TOTAL_CENTS / CHUNK_CENTS))
rem=$((TOTAL_CENTS % CHUNK_CENTS))
chunks=()
i=1
while [ "$i" -le "$n_full" ]; do
chunks+=("$CHUNK_CENTS")
i=$((i + 1))
done
if [ "$rem" -gt 0 ]; then
chunks+=("$rem")
fi
total_chunks=${#chunks[@]}
echo "Total USD (major): 102,000,000,000.00 | total cents: $TOTAL_CENTS | chunk cents: $CHUNK_CENTS | chunks: $total_chunks | DRY_RUN=$DRY_RUN" >&2
idx=0
for amt in "${chunks[@]}"; do
idx=$((idx + 1))
REFERENCE_BASE="OMNL-102B-CH${idx}-OF${FROM_OFFICE}-TO${TO_OFFICE}-${STAMP}"
SETTLEMENT_CONTEXT="OMNL 102B USD chunked M1 realloc chunk ${idx}/${total_chunks} (${amt} cents)"
export REFERENCE_BASE SETTLEMENT_CONTEXT
echo "--- Chunk $idx / $total_chunks | AMOUNT=$amt | ref=$REFERENCE_BASE ---" >&2
DRY_RUN="$DRY_RUN" \
FETCH_AMOUNT_FROM_API=0 \
AMOUNT="$amt" \
FROM_OFFICE="$FROM_OFFICE" \
TO_OFFICE="$TO_OFFICE" \
COMPLIANCE_AUTH_REF="$COMPLIANCE_AUTH_REF" \
COMPLIANCE_APPROVER="$COMPLIANCE_APPROVER" \
bash "${REPO_ROOT}/scripts/omnl/omnl-m1-clearing-transfer-between-offices.sh" || {
echo "ERROR: chunk $idx failed" >&2
exit 1
}
done
echo "Done. Posted $total_chunks chunk pairs (unwind + book)." >&2