# EUR0

### High-Level Overview

The EUR0 contract is designed to manage the EUR0 ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blacklist checks to restrict these operations to authorized addresses. The total EUR0 supply is collateralized with at minimum 1:1 in Euro-denominated collateral tokens, ensuring the stability and security of the protocol.

### Contract Summary

EUR0 is an ERC-20 compliant token that integrates additional security and access control features to enhance its governance and usability. It inherits functionalities from `ERC20PausableUpgradeable` and `ERC20PermitUpgradeable` to support permit-based approvals and pausability.

#### Minting EUR0

Users can swap their Euro collateral tokens via the DaoCollateral contract to mint an equivalent amount of EUR0. The minting process is subject to several checks:

* The amount must not exceed the current collateral backing
* The total supply after minting must not exceed the total collateral backing
* The caller must have the `EUR0_MINT` role

#### Redeeming EUR0

Users can swap any EUR0 back to the underlying Euro collateral tokens at any time via the DaoCollateral contract, burning the EUR0 in the process. The redemption process includes a configurable fee to prevent oracle manipulation attacks.

#### Regulatory Compliance

The contract includes a blacklist feature to ensure regulatory compliance. Sanctioned addresses are prevented from interacting with the contract, and the list is kept up to date.

#### Collateralization Enforcement

Minting of EUR0 is only possible if the total collateral backing equals or exceeds the EUR0 `totalSupply()`. The contract verifies this by:

* Checking the balance of all Euro collateral tokens in the treasury
* Converting collateral amounts to EUR using oracle prices
* Ensuring the total collateral value in EUR exceeds the new total supply

### Functionality Breakdown

#### Key Functionalities

* **Minting**: Tokens can be minted to an address, subject to role checks and collateralization requirements.
* **Burning**: Tokens can be burned from an address, subject to role checks.
* **Transfers**: Only non-blacklisted addresses can send or receive tokens.
* **Blacklist Management**: The contract implements a blacklist system for regulatory compliance.

### Functions Description

#### Public/External Functions

* **`pause()`**: Pauses all token transfer operations; callable only by the `PAUSING_CONTRACTS_ROLE`.
* **`unpause()`**: Resumes all token transfer operations; callable only by the `UNPAUSING_CONTRACTS_ROLE`.
* **`mint(address to, uint256 amount)`**: Mints tokens to a non-blacklisted address if the caller has the `EUR0_MINT` role and collateralization requirements are met.
* **`burn(uint256 amount)`** and **`burnFrom(address account, uint256 amount)`**: Burns tokens from an address, requiring the `EUR0_BURN` role.
* **`blacklist(address account)`** and **`unBlacklist(address account)`**: Allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the `BLACKLIST_ROLE`.
* **`isBlacklisted(address account)`**: Checks if an address is blacklisted.

### Role-Based Access Control

The contract implements several roles for different operations:

* **`EUR0_MINT`**: Required for minting new tokens
* **`EUR0_BURN`**: Required for burning tokens
* **`BLACKLIST_ROLE`**: Required for managing the blacklist
* **`PAUSING_CONTRACTS_ROLE`**: Required for pausing the contract
* **`UNPAUSING_CONTRACTS_ROLE`**: Required for unpausing the contract

### Safeguards Implementation

* **Pausability**: Allows pausing of all token transfers in emergencies
* **Blacklist**: Prevents sanctioned addresses from interacting with the token
* **Collateralization Check**: Ensures EUR0 remains fully backed by Euro collateral
* **Role-Based Access**: Restricts sensitive operations to authorized roles

### Security Features

#### Blacklist Mechanism

The contract implements a comprehensive blacklist system that prevents blacklisted addresses from:

* Sending tokens (from address is blacklisted)
* Receiving tokens (to address is blacklisted)
* Any transfer operations involving blacklisted addresses

#### Collateralization Verification

The minting process includes real-time collateralization verification:

* Fetches all supported Euro collateral tokens from the token mapping
* Calculates the total value of collateral in EUR using oracle prices
* Ensures the new total supply does not exceed the collateral backing
* Prevents over-minting that would compromise the 1:1 collateralization ratio

#### Access Control

All critical functions are protected by role-based access control:

* Only authorized roles can mint, burn, pause, or manage blacklists
* Prevents unauthorized manipulation of token supply
* Ensures regulatory compliance through controlled blacklist management


---

# 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://tech.usual.money/smart-contracts/token-contracts/eur0.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.
