> For the complete documentation index, see [llms.txt](https://docs.kyberswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kyberswap.com/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/developer-guides.md).

# Developer Guides

Code Samples To Get You Started

The guides in the following section are targeted at application developers as well as smart contract integrators that are interested in building on top of the KyberSwap Elastic ecosystem.

## Project bootstrapping

Given the composability of DeFi protocols, we recommend using Hardhat's [mainnet forking feature](https://hardhat.org/guides/mainnet-forking.html) to best stimulate mainnet conditions. This will enable integrations to be conveniently tested against existing protocols without having to bootstrap each and every protocol individually.

## Overview

KyberSwap Elastic consists of multiple smart contracts, each having been deliberately confined to a specific function. If you would like to view the full list of contracts as well as their respective functions and variables, the contracts have been split according to the below:

* [**Core Contracts:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-core-contracts.md) Handles all pool functionalities, including the creation of the pool
* [**Core Libraries:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-core-libraries.md) Contains deployment contracts as well as multiple math contracts for safe handling of numbers.
* [**Periphery Core Contracts:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-periphery-core-contracts.md) Contracts which handle swap routing as well as management of liquidity positions.
* [**Peripheral Library Contracts:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-peripheral-library-contracts.md) Contains the anti-sniping contract as well as various contracts to aid data queries.
* [**Peripheral Base Contracts:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-peripheral-base-contracts.md) Helper contracts that process, validate, and store peripheral liquidity flows.

The contracts that are of particular interest are listed below:

* [**Factory:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-core-contracts.md#factory) Handles deployment of Kyberswap Elastic pools and where administrative configurations are held, such as the whitelisting of NFT position managers, and government fee settings.
* [**Router:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-periphery-core-contracts.md#router) Handles the routing of swaps across an Elastic pool.
* QouterV2: Allows getting the expected amount out or amount in for a given swap without executing the swap.
* [**AntiSnipAttackPositionManager:**](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-periphery-core-contracts.md#antisnipattackpositionmanager) Adds the anti-sniping attack feature to the liquidity additions or removals.
* TicksFeeReader: Handles the management of ticks as well as the corresponding positions and fees.
* TokenPositionDescriptor: Enables querying of position information.
* TokenPositionDescriptionProxy: An ERC1967 contract that implements an upgradeable proxy for the TokenPositionDescriptor contract.

Please refer to [Elastic Contract Addresses](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/contracts/elastic-contract-addresses.md) for the full list of contracts which have been deployed across the supported chains.

## Next steps

As there are possibly multiple pools per token pair, the first step is to [fetch pool addresses](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/developer-guides/get-elastic-pool-addresses.md) and determine which pool is most suitable for querying swap rates, trade execution and liquidity provision.

Traders and arbitrageurs who need to take liquidity should view the section on [swap execution](/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/developer-guides/execute-an-elastic-swap.md).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kyberswap.com/~/changes/1kQEhDNzHMDf7SwOE6Yu/liquidity-solutions/kyberswap-elastic/developer-guides.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
