> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usmewe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart Contracts Overview

> Technical documentation for usmewe's on-chain components

# Smart Contracts

usmewe's protocol is built on **5 core smart contracts** deployed on BASE (Ethereum L2).

<Note>
  All contracts are **open source** and have been audited. See our [Security](/security/audit-reports) section for audit reports.
</Note>

## Contract Architecture

```
┌─────────────────────────────────────────────────────────────┐
│                        USER                                 │
└─────────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                   SMART WALLET                              │
│              (ZeroDev Kernel + Safe)                        │
└─────────────────────────────────────────────────────────────┘
                          │
          ┌───────────────┼───────────────┐
          ▼               ▼               ▼
    ┌───────────┐   ┌───────────┐   ┌───────────┐
    │  Trust    │   │   P2P     │   │  Social   │
    │  Vault    │   │   Loan    │   │  Vault    │
    └───────────┘   └───────────┘   └───────────┘
          │               │
          ▼               ▼
    ┌───────────┐   ┌───────────┐
    │ Insurance │   │Governance │
    │   Pool    │   │           │
    └───────────┘   └───────────┘
```

## Core Contracts

<CardGroup cols={2}>
  <Card title="TrustVault.sol" icon="vault" href="/smart-contracts/trust-vault">
    Protocol liquidity pool for staking and lending
  </Card>

  <Card title="P2PLoan.sol" icon="handshake" href="/smart-contracts/p2p-loan">
    Peer-to-peer lending agreements
  </Card>

  <Card title="SocialVault.sol" icon="shield" href="/smart-contracts/social-vault">
    Personal asset protection with timelock
  </Card>

  <Card title="InsurancePool.sol" icon="umbrella" href="/smart-contracts/insurance-pool">
    Default protection reserve
  </Card>

  <Card title="Governance.sol" icon="landmark" href="/smart-contracts/governance">
    Protocol governance and voting
  </Card>
</CardGroup>

## Technology Stack

| Component           | Technology               |
| ------------------- | ------------------------ |
| Language            | Solidity 0.8.24          |
| Framework           | Foundry                  |
| Account Abstraction | ZeroDev Kernel v3        |
| Multi-sig           | Safe (Gnosis)            |
| Network             | BASE (Mainnet & Sepolia) |

## Development

### Prerequisites

```bash theme={null}
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

# Clone repository
git clone https://github.com/Topxl/UsMeWe.git
cd UsMeWe/contracts
```

### Build & Test

```bash theme={null}
# Build contracts
forge build

# Run tests
forge test

# Run tests with gas report
forge test --gas-report

# Generate coverage
forge coverage
```

### Local Deployment

```bash theme={null}
# Start local node
anvil

# Deploy to local
forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast
```

## Contract Verification

All contracts are verified on:

* [Basescan](https://basescan.org) (Mainnet)
* [Sepolia Basescan](https://sepolia.basescan.org) (Testnet)

## Security Considerations

<Warning>
  These contracts handle real funds. Always review the [audit reports](/security/audit-reports) before interacting.
</Warning>

| Security Measure    | Status    |
| ------------------- | --------- |
| External Audit      | Completed |
| Bug Bounty          | Active    |
| Formal Verification | Partial   |
| Penetration Testing | Completed |

<Card title="Bug Bounty" icon="bug" href="/security/bug-bounty">
  Report vulnerabilities and earn rewards
</Card>

## Quick Reference

<CardGroup cols={2}>
  <Card title="Addresses" icon="location-dot" href="/smart-contracts/addresses">
    Deployed contract addresses
  </Card>

  <Card title="ABIs" icon="code" href="https://github.com/Topxl/UsMeWe/tree/main/contracts/out">
    Contract ABIs on GitHub
  </Card>
</CardGroup>
