# EVM

## Introduction

This document outlines the main functionalities of the Brotocol Bridge as deployed on EVM-compatible blockchains. The core aspects of the bridging operation are implemented in the `BridgeEndpoint` contract, which acts as the main entry and exit point for cross-chain operations, ensuring that assets are securely locked, minted/burned, transferred, and released. The `BridgeEndpointWithSwap` contract extends this functionality by incorporating swaps, allowing bridging and swapping to occur in within a single transaction.

The Brotocol ecosystem offers two main features in its EVM implementation:

* The **bridging of ERC-20 assets**: these contracts interact with Brotocol's off-chain protocol actors to allow the transfer of assets back and forth between EVM-compatible blockchains and Stacks.
* The **swapping of tokens in the bridging process** via external liquidity aggregators.

### EVM Chain Bridge

![This is a simplified representation on the EVM Chain Bridge's main goal.](/files/fwfNR3NqW1uSBXo7cHed)

\*To see more information on the registry contract, see the [auxiliary contracts section](#auxiliary-contracts).

#### Bridge Endpoint

* Contract names: `BridgeEndpoint`, `BridgeEndpointWithSwap`.
* [Complete technical documentation](/developers/brotocol-contracts/chains/evm/bridgeendpoint.md)

This endpoint's main responsibility is serving as the entry and exit point for assets moving along Brotocol's cross-chain bridge. Sometimes, it also involves swapping to other tokens as part of the peg-in process.

### Auxiliary Contracts

These contracts do not include the implementation of any core functionality but they serve as a support for other contracts to facilitate calculations and common storage management.

* **Bridge Registry**: this contract keeps a record of approved tokens, validators, relayers and fees. It also keeps a record of the generated orders and their statuses. Its latest version can be found at `BridgeRegistry.sol`.


---

# 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.brotocol.xyz/developers/brotocol-contracts/chains/evm.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.
