# Smart Contract Components

### Core Contracts

#### Safe Smart Account

Standard Safe (Gnosis Safe) v1.3.0+ contracts serve as the execution context. Users maintain full custody through:

* Single-owner threshold (1-of-1 signature)
* EIP712TypedDataSafeModule enabled for bundle execution
* Deterministic deployment via SafeDeployment contract

#### SequenceExecutor

Orchestrates atomic execution of action sequences via delegatecall:

* Validates all action IDs against AdminVault registry
* Executes actions in Safe context (address(this) = Safe)
* All-or-nothing transaction semantics
* Gas-optimized for multi-action bundles

```solidity
struct Sequence {
  string name;
  bytes4[] actionIds;  // Registered action identifiers
  bytes[] callData;    // ABI-encoded parameters
}
```

#### Action Contracts

Protocol-specific adapters inheriting from ActionBase:

* **Stateless:** No persistent storage, operate via delegatecall
* **Modular:** Single responsibility per action
* **Upgradeable:** Replace actions via AdminVault proposals
* **Logged:** All events through centralized Logger

#### Action Types

* **DEPOSIT\_ACTION:** Supply assets to protocols
* **WITHDRAW\_ACTION:** Remove assets from protocols
* **SWAP\_ACTION:** Token exchanges via DEX aggregators
* **COVER\_ACTION:** Purchase protocol insurance
* **TRANSFER\_ACTION:** Token movements (PullToken/SendToken)

***

#### AdminVault

Governance and registry with time-delayed proposals:

* Action registry: `actionId => contractAddress`
* Pool registry: `protocolId => poolId => poolAddress`
* Fee configuration and tracking
* Role-based access control with mandatory delays

***

#### Logger

Centralized event emission contract:

* `ActionEvent(caller, logId, data)` - Action executions
* `AdminVaultEvent(logId, data)` - Governance changes
* Structured event IDs for off-chain processing

***

#### BravaGuard

Safe transaction guard enforcing:

* Only approved actions can be called
* Funds stay within Brava ecosystem
* No unauthorized external calls

***

#### EIP712TypedDataSafeModule

Cross-chain execution via signed bundles:

* Single signature authorizes multi-chain sequences
* Per-Safe nonce management prevents replay
* Bundle expiry enforcement
* Gas refund system (optional)

***

#### SafeDeployment

Deterministic Safe creation using:

* EIP-1167 minimal proxies
* CREATE2 for predictable addresses
* SafeSetupRegistry for configuration templates
* Automated module enablement


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.brava.finance/technical/technical-architecture/key-components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
