# Getting Started

## Getting Started

### Introduction to Paribus Protocol

You're currently viewing the Paribus documentation.

The Paribus Protocol is based on the Compound Protocol, the codebase is [open-source](https://github.com/Paribus/paribus-protocol-contracts), and currently maintained by the Paribus team.

The interface hosted at <https://app.paribus.io> is at the moment closed source and maintained by the Paribus team.

### Guides

### Networks

The Paribus Protocol is currently deployed on the following networks:

{% tabs %}
{% tab title="Ethereum" %}

### Ethereum Mainnet

<table><thead><tr><th width="166">Contract Name</th><th>Contract Address</th></tr></thead><tbody><tr><td>PBX</td><td><a href="https://etherscan.io/token/0xd528cf2e081f72908e086f8800977df826b5a483">0xD528cf2E081f72908e086F8800977df826B5a483</a></td></tr></tbody></table>
{% endtab %}

{% tab title="Arbitrum" %}

### Arbitrum Mainnet&#x20;

<table><thead><tr><th width="166">Contract Name</th><th>Contract Address</th></tr></thead><tbody><tr><td>PBX</td><td><a href="https://arbiscan.io/address/0xbad58ed9b5f26a002ea250d7a60dc6729a4a2403">0xbAD58ed9b5f26A002ea250D7A60dC6729a4a2403</a></td></tr><tr><td>pARB</td><td><a href="https://arbiscan.io/address/0xfc2737a742a741d13fe6326011a78cd881de3eb9">0xFc2737a742A741d13fE6326011a78cd881dE3Eb9</a></td></tr><tr><td>pETH</td><td><a href="https://arbiscan.io/address/0xAffd437801434643B734D0B2853654876F66f7D7">0xAffd437801434643B734D0B2853654876F66f7D7</a></td></tr><tr><td>pUSDT</td><td><a href="https://arbiscan.io/address/0xFB1dcFc67cC496Eb0cC592050AF7Fdf3bF3b5C13">0xFB1dcFc67cC496Eb0cC592050AF7Fdf3bF3b5C13</a></td></tr><tr><td>pWBTC</td><td><a href="https://arbiscan.io/address/0x1c762e00f1d9317a4214d22b2576995c427f61c9">0x1c762E00f1D9317a4214d22b2576995C427F61c9</a></td></tr></tbody></table>

### Arbitrum Sepolia

<table><thead><tr><th width="166">Contract Name</th><th>Contract Address</th></tr></thead><tbody><tr><td>PBX</td><td><a href="https://sepolia.arbiscan.io/address/0x71d6b4acb0af56e7b2378e9f2fd1b7a419490edf">0x71d6B4ACB0AF56e7B2378E9F2fd1b7A419490eDF</a></td></tr></tbody></table>
{% endtab %}

{% tab title="Cardano" %}

### Cardano Mainnet

<table><thead><tr><th width="166">Contract Name</th><th>Policy Id</th></tr></thead><tbody><tr><td>PBX</td><td><a href="https://cardanoscan.io/token/cc8d1b026353022abbfcc2e1e71159f9e308d9c6e905ac1db24c7fb650617269627573">cc8d1b026353022abbfcc2e1e71159f9e308d9c6e905ac1db24c7fb6</a></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

### Protocol Math

The Paribus Protocol contracts use a system of exponential math, [ExponentialNoError.sol](https://github.com/Paribus/paribus-protocol-contracts/blob/mainnet-mvp/contracts/Utils/ExponentialNoError.sol), in order to represent fractional quantities with sufficient precision.

Most numbers are represented as a *mantissa*, an unsigned integer scaled by `1 * 10 ^ 18`, in order to perform basic math at a high level of precision.

#### pToken and Underlying Decimals

Prices and exchange rates are scaled by the decimals unique to each asset; pTokens are ERC-20 tokens with 8 decimals, while their underlying tokens vary, and have a public member named *decimals*.

| pToken | pToken Decimals | Underlying | Underlying Decimals |
| ------ | --------------- | ---------- | ------------------- |
| pARB   | 8               | ARB        | 18                  |
| pETH   | 8               | ETH        | 18                  |
| pUSDC  | 8               | USDC       | 6                   |
| pUSDT  | 8               | USDT       | 6                   |
| pWBTC  | 8               | WBTC       | 8                   |

#### Interpreting Exchange Rates

The pToken Exchange Rate is scaled by the difference in decimals between the pToken and the underlying asset.

```
onepTokenInUnderlying = exchangeRateCurrent / (1 * 10 ^ (18 + underlyingDecimals - pTokenDecimals))
```

Here is an example of finding the value of 1 cBAT in BAT with Web3.js JavaScript.

```js
const pTokenDecimals = 8; // all pTokens have 8 decimal places
const underlying = new web3.eth.Contract(erc20Abi, batAddress);
const pToken = new web3.eth.Contract(pTokenAbi, cBatAddress);
const underlyingDecimals = await underlying.methods.decimals().call();
const exchangeRateCurrent = await pToken.methods.exchangeRateCurrent().call();
const mantissa = 18 + parseInt(underlyingDecimals) - pTokenDecimals;
const onepTokenInUnderlying = exchangeRateCurrent / Math.pow(10, mantissa);
console.log('1 cBAT can be redeemed for', onepTokenInUnderlying, 'BAT');
```

There is no underlying contract for ETH, so to do this with pETH, set `underlyingDecimals` to 18.

To find the number of underlying tokens that can be redeemed for pTokens, multiply the number of pTokens by the above value `onepTokenInUnderlying`.

```
underlyingTokens = pTokenAmount * onepTokenInUnderlying
```

#### Calculating Accrued Interest

Interest rates for each market update on any block in which the ratio of borrowed assets to supplied assets in the market has changed. The amount of interest rate changes are dependent on the interest rate model smart contract implemented for the market, and the amount of change in the ratio of borrowed assets to supplied assets in the market.

Interest accrues to all suppliers and borrowers in a market when any Ethereum address interacts with the market’s pToken contract, calling one of these functions: mint, redeem, borrow, or repay. Successful execution of one of these functions triggers the `accrueInterest` method, which causes interest to be added to the underlying balance of every supplier and borrower in the market. Interest accrues for the current block, as well as each prior block in which the `accrueInterest` method was not triggered (no user interacted with the pToken contract). Interest compounds only during blocks in which the pToken contract has one of the aforementioned methods invoked.

Here is an example of supply interest accrual:

Alice supplies 1 ETH to the Paribus Protocol. At the time of supply, the `supplyRatePerBlock` is 37893605 Wei, or 0.000000000037893605 ETH per block. No one interacts with the PEther contract for 3 Ethereum blocks. On the subsequent 4th block, Bob borrows some ETH. Alice’s underlying balance is now 1.000000000151574420 ETH (which is 37893605 Wei times 4 blocks, plus the original 1 ETH). Alice’s underlying ETH balance in subsequent blocks will have interest accrued based on the new value of 1.000000000151574420 ETH instead of the initial 1 ETH. Note that the `supplyRatePerBlock` value may change at any time.

#### Calculating the APY Using Rate Per Block

The Annual Percentage Yield (APY) for supplying or borrowing in each market can be calculated using the value of `supplyRatePerBlock` (for supply APY) or `borrowRatePerBlock` (for borrow APY) in this formula:

```
Rate = pToken.supplyRatePerBlock(); // Integer
Rate = 37893566
ETH Mantissa = 1 * 10 ^ 18 (ETH has 18 decimal places)
Blocks Per Day = 7200 (12 seconds per block)
Days Per Year = 365

APY = ((((Rate / ETH Mantissa * Blocks Per Day + 1) ^ Days Per Year)) - 1) * 100
```

Here is an example of calculating the supply and borrow APY with Web3.js JavaScript:

```js
const ethMantissa = 1e18;
const blocksPerDay = 7200; // 12 seconds per block
const daysPerYear = 365;

const pToken = new web3.eth.Contract(pEthAbi, pEthAddress);
const supplyRatePerBlock = await pToken.methods.supplyRatePerBlock().call();
const borrowRatePerBlock = await pToken.methods.borrowRatePerBlock().call();
const supplyApy =
  (Math.pow(
    (supplyRatePerBlock / ethMantissa) * blocksPerDay + 1,
    daysPerYear
  ) -
    1) *
  100;
const borrowApy =
  (Math.pow(
    (borrowRatePerBlock / ethMantissa) * blocksPerDay + 1,
    daysPerYear
  ) -
    1) *
  100;
console.log(`Supply APY for ETH ${supplyApy} %`);
console.log(`Borrow APY for ETH ${borrowApy} %`);
```


---

# Agent Instructions: 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:

```
GET https://docs.paribus.io/for-developers/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
