> For the complete documentation index, see [llms.txt](https://docs.propellerheads.xyz/tycho/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.propellerheads.xyz/tycho/for-dexs/protocol-integration/execution/code-architecture.md).

# Code Architecture

Tycho Execution offers an encoding tool (a Rust crate for generating swap calldata) and execution components (Solidity contracts). This is how everything works together.

The following diagram summarizes the code architecture:

<figure><img src="https://1487321251-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjrIe0oInIEt65tHqWn2w%2Fuploads%2FKhs751bsBnH7oKVMFpmF%2Fimage.png?alt=media&amp;token=ac5c9fdc-633a-452a-afbd-e25cd86f0c26" alt=""><figcaption></figcaption></figure>

### Encoding

The `TychoRouterEncoder` validates solutions and produces a list of transactions to execute against the `TychoRouterV3`.

The `TychoRouterEncoder` chooses a strategy encoder automatically based on the solution (see more about strategies [here](/tycho/about/concepts.md#strategy)).

Internally, all encoders choose the appropriate `SwapEncoder`(s) to encode the individual swaps, which depend on the protocols used in the solution.

### Execution

The `TychoRouterV3` calls one or more `Executor`s (corresponding with the output of the `SwapEncoder`s) to interact with the correct protocol and perform each swap of the solution. The `TychoRouterV3` verifies that the user receives a minimum amount of the output token.
