# Liquidity Mining Pool

There are three liquidity pool contracts for APY.Finance. Each contract handles a specific currency and issues its own APT token to represent a user’s stake in the pool. There is a contract for DAI, USDC, and USDT. These contracts are orchestrated by the APY manager to act as a single pool.

The liquidity pool contracts use a proxy pattern for upgradeability. Transactions are sent to the proxy contract address, but the functions they call are from the implementation contract.

Each pool contract is also an ERC-20 token with 18 decimals and the symbol “APT”. The contract is called `APYPoolToken`.

All of the following examples will use web3.js and the DAI liquidity pool contract.

## Adding Liquidity

The transaction sender must first approve the pool proxy contract to transfer their deposit tokens:

```javascript
await daiToken.methods.approve(daiPoolToken.address, daiBalance);
```

Then the sender must call the `addLiquidity` function on the pool contract with the amount of tokens they wish to deposit:

```javascript
await daiPoolToken.methods.addLiquidity(daiBalance);
```

## Removing Liquidity

The transaction sender must first approve the pool proxy contract to transfer their APT tokens:

```javascript
await daiAptToken.methods.approve(
    daiPoolToken.address,
    daiAptBalance
);
```

{% hint style="info" %}
APT represents a share of the pool. The total supply of APT represents the total amount of stablecoin deposited in the pool contract.
{% endhint %}

Then the sender must call the `redeem` function on the pool contract with the amount of APT the wish to redeem:

```javascript
await daiPoolToken.redeem(daiAptBalance);
```

{% hint style="info" %}
Redeeming the entire balance of APT will withdraw the sender’s entire deposit.
{% endhint %}

## Contract Addresses

### Mainnet

| Contract       | Address                                    |
| -------------- | ------------------------------------------ |
| DAI Liquidity  | 0x75CE0E501e2E6776FcAAa514f394a88a772A8970 |
| USDC Liquidity | 0xe18b0365D5D09F394f84eE56ed29DD2d8D6Fba5f |
| USDT Liquidity | 0xeA9c5a2717D5Ab75afaAC340151e73a7e37d99A7 |

### Kovan

The contracts deployed to Kovan use the DAI, USDC, and USDT tokens available from the Aave [faucet](https://testnet.aave.com/faucet).

| Contract       | Address                                    |
| -------------- | ------------------------------------------ |
| DAI Liquidity  | 0xf587EC50e2E6518F7f016d5A78561109Ab96FEa1 |
| USDC Liquidity | 0xA138299A1BB17e90F2edCc2d567358C4BEeCa092 |
| USDT Liquidity | 0x80073EeF3C57Ba05dC25E5cD5b78C5f9fb18e4D8 |

### APYPoolToken ABI

<https://gist.github.com/opz/9d07671b0bc978aba5251e3183bc890c>
