# Pair

Each Pair contract  **manages a liquidity pool made up of reserves of two ERC-20 tokens**.&#x20;

Anyone can become a liquidity provider (LP) for a pool/pair by depositing corresponding equivalent value of each underlying token in return for pool tokens.

Note: If Pair has never been created (in other words) if no one has ever provided liquidity to that pair, then first user that provides liquidity will define Pair ratio (price).

**XdYe Pair** Smart Contract can be found at:&#x20;

{% embed url="<https://github.com/rogerCapone/XdYe_Smart_Contracts/blob/main/XdYePair.sol>" %}
XdYe Pair Contract Source Code
{% endembed %}

### Contract main functions

* *`getReserves()`*

This method returns the reserves of token0 and token1 used to price trades and distribute liquidity.

* *`mint()`*

This method creates the corresponding LPs, triggered when users deposit liquidity.

* *`burn()`*

This method deletes the corresponding LPs, triggered when users withdraw liquidity.

* *`swap()`*

This method allows to perform a trade in the pair contract, ensuring that there is enough liquidity for performing the exchange, also updates reserves and balances.

* *`skim()`*

This method forces balances to match reserves. The variation between balances and reserves are sent to the parameter sent as an argument to this method.

{% hint style="warning" %}
**Attention:** If you are trying to replicate the code, be sure to consider the imports or visit the corresponding [Github Repository](https://github.com/rogerCapone/XdYe_Smart_Contracts/tree/main) in order to have the whole source code.
{% endhint %}
