Loops HouseAegisMargin

NEAR HACKATHON
Team
1 member- FROwner
Fredrick Kabu
Overview
The Problem: Borrowers on lending protocols like Rhea/Burrow face steep liquidation penalties (up to 720+ bps) during market drawdowns. Storing automated deleveraging or stop-loss triggers in plaintext on-chain exposes borrowers to predatory MEV front-running and stop-hunting, while automated keepers traditionally require trusting third parties with custodial private keys.
What We Built: AegisMargin is a confidential, non-custodial cross-chain margin protection protocol. Borrowers configure private health factor triggers and slippage caps encrypted in-browser via ChaCha20-Poly1305, committing only a SHA-256 digest to the on-chain vault. When market volatility threatens a position, an OutLayer hardware TEE enclave (wasm32-wasip2) privately evaluates the policy, calculates exact debt repayment sizing, and requests a competitive cross-chain quote. An enclave Arbitrage Guard ensures execution only occurs if solver costs are strictly cheaper than the liquidation penalty avoided.
How NEAR Fits In: AegisMargin unifies core NEAR primitives into an automated defense loop:
- NEAR Intents & 1Click API: Enables cross-chain reserve sourcing, allowing borrowers to tap idle stablecoins on Base, Arbitrum, or Solana to cure NEAR Burrow debt at minimal solver spreads (sub-20 bps).
- OutLayer TEE Verifiable Compute: Executes private solvency math and quote verification inside an enclave without leaking sensitive liquidation boundaries.
- Scoped Function-Call Access Keys: Keepers trigger solvency evaluations via restricted keys with zero custody or full-access authority.
- On-Chain Security Guards: The NEAR smart contract verifies enclave Ed25519 signatures, binds single-use settlement tickets to the enclave WASM hash, and enforces an immutable destination allowlist blocking unauthorized fund movement.