# Security

## Overview

Security is **at the core of Mondrian Swap’s infrastructure**, ensuring **trustless, transparent, and robust operations** for all users. The platform leverages **audited and immutable smart contracts** to safeguard **funds, trading activities, and governance mechanisms**.

Mondrian Swap is built using **Balancer V2 contracts**, which include **advanced access control mechanisms** and **role-based execution permissions** to ensure **maximum security and decentralization**.

***

## Smart Contract Security

### Immutable and Non-Upgradable Contracts

All **Mondrian Swap smart contracts are immutable**, meaning:\
✔ **No one** can alter the contract code once deployed.\
✔ Eliminates risks associated with **malicious upgrades or backdoors**.\
✔ Ensures **long-term reliability and transparency**.

## Balancer V2 Security Model

Mondrian Swap inherits the **security architecture of Balancer V2**, which includes **strict access control mechanisms** enforced by the **Authorizer Contract**. This **ensures that only verified roles can execute protected functions**, minimizing potential attack vectors.

***

## Community Governance & Fee Adjustments

Mondrian Swap is committed to **decentralized governance**, meaning that in the future:

* **Protocol fees and their distribution** will be **decided by governance proposals**.
* **veMondrian stakers** will have voting rights to **adjust fee structures** based on community consensus.
* The system ensures **transparent fund allocation**, driven by **user engagement and network growth**

### **1. Authorizer Contract**

The **Authorizer contract** governs **function-level permissions**, ensuring **only approved entities** can perform specific actions.

✔ **Centralized control is eliminated**, with **roles distributed securely**.\
✔ Function calls are **restricted based on granted permissions**, reducing **attack surfaces**.

### **2. Default Admin Role**

📌 The **Default Admin Role** does **not** grant permission to execute protected functions. Instead, it:\
✔ Allows **assigning and revoking roles** to other entities.\
✔ Provides a **controlled governance mechanism** for contract security.

### **3. Execution Roles**

Entities with the **Default Admin Role** can **grant and revoke execution roles** at the function level.

✔ **Singleton Contracts:** Roles are bound to **specific contract addresses** (e.g., the Vault).\
✔ **Factory-Generated Contracts:** Roles apply to **all contracts created by a specific factory**.

For example:

* If a **Stable Pool Factory contract** grants a role to an entity, the role applies to **all Stable Pools deployed from that factory**.
* If a **new Vault contract** is deployed, **permissions from the old Vault do not carry over**, ensuring security compartmentalization.


---

# 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://mondrianswap.gitbook.io/mondrianswap/products/security.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.
