# PNG and DEX Values on Avalanche

## Development

[Wrangler](https://developers.cloudflare.com/workers/cli-wrangler) is used for a local development server. This is effectively a proxy-service that (nearly) replicates the Cloudflare Worker runtime.

Anyone can develop this repository locally. Fill in `account_id` in the `wrangler.toml` file. This value may (and should) be your own personal `account_id`.

## Location

The API is available at `https://api.pangolin.exchange`

## Methods

All methods accept a GET request.

## TVL

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/tvl`

**Try API**: [Get the total value locked in USD](https://api.pangolin.exchange/png/tvl)

**Endpoint**: `/png/tvl`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/tvl`
{% endtab %}

{% tab title="Sample Response" %}

```json
25371043.31
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Total Volume

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/total-volume`

**Try API**: [Get the total lifetime volume of swaps in USD](https://api.pangolin.exchange/png/total-volume)

**Endpoint**: `/png/total-volume`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/total-volume`
{% endtab %}

{% tab title="Sample Response" %}

```json
16386987632.01
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Total Supply (wei)

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/total-supply`

**Try API**: [Query the total lifetime supply of PNG denominated in wei](https://api.pangolin.exchange/png/total-supply)\
(A result of 1 PNG would return the value `1000000000000000000` \[18 decimals])

**Endpoint**: `/png/total-supply`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/total-supply`
{% endtab %}

{% tab title="Response" %}

```json
230000000000000000000000000
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Total Supply

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/total-supply-whole`

**Test API**: [Get the total lifetime supply of PNG denominated in PNG](https://api.pangolin.exchange/png/total-supply-whole)\
(A result of 1 PNG would return the value `1`)

**Endpoint**: `/png/total-supply-whole`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/total-supply-whole`
{% endtab %}

{% tab title="Response" %}

```json
230000000
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Circulating Supply (wei)

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/circulating-supply`

**Try API**: [Query the circulating supply of PNG denominated in wei](https://api.pangolin.exchange/png/circulating-supply)\
(A result of 1 PNG would return the value `1000000000000000000` \[18 decimals])

**Endpoint**: `/png/circulating-supply`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/circulating-supply`
{% endtab %}

{% tab title="Sample Response" %}

```json
138148573463211998848931700
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Circulating Supply

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/circulating-supply-whole`

**Try API**: [Query the circulating supply of PNG denominated in PNG](https://api.pangolin.exchange/png/circulating-supply-whole)\
(A result of 1 PNG would return the value `1`)

**Endpoint**: `/png/circulating-supply-whole`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/circulating-supply-whole`
{% endtab %}

{% tab title="Sample Response" %}

```json
138148573
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Treasury Supply (wei)

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/community-treasury`

**Try API**: [Query the balance of PNG denominated in wei](https://api.pangolin.exchange/png/community-treasury)\
(A result of 1 PNG would return the value `1000000000000000000` \[18 decimals])

**Endpoint**: `/png/community-treasury`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/community-treasury`
{% endtab %}

{% tab title="Sample Response" %}

```json
1999371251788001151068300
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Treasury Supply

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/png/community-treasury-whole`

**Try API**: [Query the balance of PNG denominated in PNG](https://api.pangolin.exchange/png/community-treasury-whole)\
(A result of 1 PNG would return the value `1`)

**Endpoint**: `/png/community-treasury-whole`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/png/community-treasury-whole`
{% endtab %}

{% tab title="Sample Response" %}

```json
1999371
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Average Swap Size

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/pangolin/transaction-average`

**Try API**: [Get the average size of each swap in USD](https://api.pangolin.exchange/pangolin/transaction-average)

**Endpoint**: `/pangolin/transaction-average`

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/pangolin/transaction-average`
{% endtab %}

{% tab title="Sample Response" %}

```json
1566.68
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Average Percentage Reward Rate

<mark style="color:blue;">`GET`</mark> `https://api.pangolin.exchange/pangolin/apr2/:pID`

**Try API**: [Get the PNG Reward Rate of the inputted StakingRewards contract address](https://api.pangolin.exchange/pangolin/apr2/1).\
(Refer to [Snowtrace](https://snowtrace.io/address/0x1f806f7C8dED893fd3caE279191ad7Aa3798E928#readContract#F10) to find pIDs \[pool ids])

**Endpoint**: `/pangolin/apr2/:pID`

#### Path Parameters

| Name                                  | Type      | Description                                                                                                                                                 |
| ------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| pID<mark style="color:red;">\*</mark> | string\[] | Pool ID string from 1 - [poolLenght](https://snowtrace.io/address/0x1f806f7C8dED893fd3caE279191ad7Aa3798E928#readContract#F12) (eg. 1, ...10,... 100, etc.) |

{% tabs %}
{% tab title="200: OK " %}

```json
{"swapFeeApr":X,"stakingApr":X,"combinedApr":X}
```

{% tabs %}
{% tab title="Request" %}
`https://api.pangolin.exchange/pangolin/apr2/1`
{% endtab %}

{% tab title="Sample Resopnse" %}

```
{"swapFeeApr":4,"stakingApr":0,"combinedApr":4}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="204: No Content " %}

```json
{"swapFeeApr":0,"stakingApr":0,"combinedApr":0}
```

{% endtab %}
{% endtabs %}
