> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/pl/tworzenie/podstawy/weryfikacja-smart-kontraktu/splaszczenie-smart-kontraktu.md).

# Spłaszczenie smart kontraktu

Spłaszczanie smart kontraktu to proces łączenia głównego kontraktu ze wszystkimi jego zależnościami (interfejsami, bibliotekami, dziedziczonymi kontraktami) w jeden, samodzielny plik `.sol`. To znacznie ułatwia weryfikację wdrożonego kontraktu.

{% hint style="info" %}
Nie musisz spłaszczać kontraktu, aby go wdrożyć.

Spłaszczenie to przede wszystkim krok po wdrożeniu, używany do weryfikacji kodu źródłowego w explorerze.
{% endhint %}

Ponieważ Chiliz Chain to blockchain kompatybilny z EVM, dostępnych jest kilka narzędzi do spłaszczania kontraktów.

{% hint style="info" %}
Jeśli wdrażasz z oryginalnych plików, a następnie spłaszczasz je, aby zweryfikować cały kontrakt, musisz upewnić się, że ustawienia kompilacji się nie zmieniły.

W przeciwnym razie możesz otrzymać błąd typu "Bytecode mismatch" i weryfikacja się nie powiedzie.
{% endhint %}

## Spłaszczanie za pomocą Remix IDE

W Eksploratorze Plików kliknij prawym przyciskiem myszy swój główny kontrakt i wybierz "Flatten" z menu.

<figure><img src="/files/1Twn4cZ4wUegx4SmycXw" alt="" width="375"><figcaption></figcaption></figure>

Remix wygeneruje kontrakt `CONTRACT_flattened.sol` w Twoim folderze.

## Spłaszczanie za pomocą Hardhat

Dostosuj następujące polecenie do swojego projektu:

```bash
npx hardhat flatten contracts/MyContract.sol > Flattened.sol
```

{% hint style="warning" %}
Ponieważ spłaszczony kontrakt może mieć tysiące linii, jest koszmarny do rzeczywistego tworzenia i utrzymania.

Generuj go tylko wtedy, gdy jest potrzebny — np. przy weryfikacji wdrożonego kontraktu.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.chiliz.com/pl/tworzenie/podstawy/weryfikacja-smart-kontraktu/splaszczenie-smart-kontraktu.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
