mirror of
https://github.com/lux-apps/papers.git
synced 2026-10-30 18:15:21 +00:00
Restructured from flat .tex/.pdf files into per-paper subdirectories. Added Antje Worring as co-author on all papers. Synced PDFs to pdfs/ for download site.
39 lines
1.1 KiB
TeX
39 lines
1.1 KiB
TeX
\section{Appendix C: MPC Integration Pseudocode}
|
|
|
|
|
|
\begin{lstlisting}[language=Python, basicstyle=\footnotesize\ttfamily]
|
|
# BTC deposit via M-Chain threshold custody
|
|
def deposit_btc_collateral(btc_amount, user_address):
|
|
# Generate threshold custody address
|
|
custody_address = mchain.generate_threshold_address(
|
|
threshold=15,
|
|
total_validators=21,
|
|
network="bitcoin"
|
|
)
|
|
|
|
# User sends BTC to custody address
|
|
btc_tx = user.send_btc(btc_amount, custody_address)
|
|
|
|
# Wait for confirmations
|
|
await btc.wait_for_confirmations(btc_tx, required=6)
|
|
|
|
# Verify on M-Chain
|
|
proof = mchain.create_spv_proof(btc_tx)
|
|
verified = mchain.verify_btc_deposit(proof)
|
|
|
|
if verified:
|
|
# Calculate max loan at 80% LTV for BTC
|
|
max_loan = btc_amount * btc_price * 0.80
|
|
|
|
# Create Lux Credit loan
|
|
loan_id = lux_credit.create_loan(
|
|
collateral_asset="BTC",
|
|
collateral_amount=btc_amount,
|
|
loan_amount=max_loan,
|
|
custody_proof=proof
|
|
)
|
|
|
|
return loan_id
|
|
\end{lstlisting}
|
|
|