# Deployment Instructions - MainnetTether & TransactionMirror

**Date**: 2025-12-11
**Status**: Ready for Deployment

---

## ⚠️ Important: Stack Too Deep Issue

The `TransactionMirror.sol` contract's `mirrorBatchTransactions` function has 9 calldata array parameters, which may cause a "Stack too deep" compilation error.

**Solution**: Use the `--via-ir` flag when compiling and deploying:

```bash
forge build --via-ir
forge script script/DeployTransactionMirror.s.sol --via-ir ...
```

---

## 📋 Pre-Deployment Checklist

- [x] Contracts reviewed for errors
- [x] Security patterns verified
- [x] Input validation complete
- [x] Replay protection implemented
- [ ] Set `TETHER_ADMIN` in `.env` (multisig recommended)
- [ ] Set `MIRROR_ADMIN` in `.env` (multisig recommended)
- [ ] Verify sufficient ETH balance for gas
- [ ] Verify `ETH_MAINNET_RPC_URL` is set
- [ ] Verify `ETHERSCAN_API_KEY` is set

---

## 🚀 Deployment Commands

### MainnetTether

```bash
forge script script/DeployMainnetTether.s.sol \
  --rpc-url $ETH_MAINNET_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  -vvvv
```

### TransactionMirror

```bash
# IMPORTANT: Use --via-ir flag to avoid stack too deep error
forge script script/DeployTransactionMirror.s.sol \
  --rpc-url $ETH_MAINNET_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  --via-ir \
  -vvvv
```

---

## ✅ Post-Deployment

1. Update `.env` with deployed addresses:
   ```bash
   MAINNET_TETHER_ADDRESS=<deployed_address>
   TRANSACTION_MIRROR_ADDRESS=<deployed_address>
   ```

2. Verify contracts on Etherscan

3. Set up off-chain services:
   - State proof anchoring service (for MainnetTether)
   - Transaction mirroring service (for TransactionMirror)

---

**Last Updated**: 2025-12-11

