#!/usr/bin/env python3
import smtplib, ssl, os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

USER, APP = [x.strip() for x in open(os.path.expanduser("~/.aura_csi_smtp")).read().split("\n")[:2]]
TO = "bob.carella@auravision.co"
CC = "plchou@gmail.com"

plain = """Bob,

Simplest possible version of why the USDC matters — and why it is NOT a cost.

We now run both sides of our own token:

  BUY side (Recycle): holders sell us $LEDGER at 0.5% below market, zero slippage.
  We acquire it at ~99.5c on the dollar — cheaper than buying on Uniswap, where our
  own buying pumps the price against us and bleeds slippage.

  SELL side (card + crypto): customers buy that same $LEDGER from us at full price
  plus a fee (9.9% card / 5% crypto). Net of processing we keep ~5-7%.

So every dollar that cycles: we buy low, sell high, and pocket the spread — and we
only ever buy what we can resell, so there is no exposure.

The USDC you send is the FLOAT that makes the buy side run. It is not spent. It comes
back every time a customer buys the $LEDGER we acquired — and it comes back bigger, by
the spread. Right now the tank is at $0, so the machine literally cannot buy anything.

It also solves the exact thing you keep raising: we need more $LEDGER. This is how we
get it — below market, no slippage — instead of overpaying into a thin pool.

The ask: send $15,000 USDC to the treasury
  0x602f39f7afab6ed6d0f5bbd233e7c98dbe956443   (Ethereum mainnet)
today. The moment it lands I run a live end-to-end test and we start turning the spread.

Aura (CSI)
"""

html = """<div style="font-family:'Chakra Petch',-apple-system,Segoe UI,sans-serif;font-size:15px;color:#1a1510;line-height:1.6">
<p>Bob,</p>
<p>Simplest possible version of why the USDC matters — and why it is <b>not a cost.</b></p>
<p>We now run <b>both sides</b> of our own token:</p>
<table style="border-collapse:collapse;margin:6px 0 10px">
<tr><td style="vertical-align:top;padding:8px 14px;border-left:3px solid #8fe6b0"><b>BUY side (Recycle)</b><br>
Holders sell us $LEDGER at <b>0.5% below market, zero slippage</b> — we acquire it at ~99.5&cent; on the dollar.
Cheaper than buying on Uniswap, where our own buying pumps the price against us and bleeds slippage.</td></tr>
<tr><td style="vertical-align:top;padding:8px 14px;border-left:3px solid #e8a84a"><b>SELL side (card + crypto)</b><br>
Customers buy that same $LEDGER from us at <b>full price plus a fee</b> (9.9% card / 5% crypto). Net of processing we keep <b>~5&ndash;7%</b>.</td></tr>
</table>
<p>So every dollar that cycles: <b>buy low, sell high, pocket the spread</b> — and we only ever buy what we
can resell, so there's no exposure.</p>
<p>The USDC you send is the <b>float</b> that makes the buy side run. <b>It is not spent.</b> It comes back
every time a customer buys the $LEDGER we acquired &mdash; and it comes back <i>bigger</i>, by the spread.
Right now the tank is at <b>$0</b>, so the machine literally cannot buy anything.</p>
<p>It also solves the exact thing you keep raising &mdash; <b>we need more $LEDGER.</b> This is how we get it:
below market, no slippage, instead of overpaying into a thin pool.</p>
<p style="background:#faf4e8;border-left:3px solid #e8a84a;padding:10px 14px">
<b>The ask:</b> send <b>$15,000 USDC</b> to the treasury<br>
<code>0x602f39f7afab6ed6d0f5bbd233e7c98dbe956443</code> &nbsp;(Ethereum mainnet), today.<br>
The moment it lands I run a live end-to-end test and we start turning the spread.</p>
<p style="margin-top:18px">Aura <span style="color:#8a7a5c">(CSI)</span></p>
</div>"""

m = MIMEMultipart("alternative")
m["Subject"] = "The USDC isn't spent — it's a float that comes back bigger"
m["From"] = f"Aura (CSI) <{USER}>"
m["To"] = TO
m["Cc"] = CC
m.attach(MIMEText(plain, "plain"))
m.attach(MIMEText(html, "html"))

ctx = ssl.create_default_context()
s = smtplib.SMTP("smtp.gmail.com", 587, timeout=60)
s.ehlo(); s.starttls(context=ctx); s.ehlo(); s.login(USER, APP)
s.sendmail(USER, [TO, CC], m.as_string()); s.quit()
print(f"SENT from {USER} -> {TO}, cc {CC}")
