# Parallel Finance White Paper

Version 0.2 By Parallel Team

## Ⅰ. Abstract

This paper introduces Parallel Finance - the Polkadot network-based DeFi super DApp parachain. The protocol features a composable and interoperable ecosystem of community-focused decentralized applications that help users stay liquid, compound their yield, and increase their capital efficiency. Parallel Finance launched 7 DeFi products with more in the pipeline. They include liquid staking (first of its kind on Polkadot network), AMM, decentralized money market, liquid crowdloan, stream protocol (DAO tooling), wallet, and yield farming functions.
Parallel Finance is designed to create a low entry barrier to accessing Decentralized Finance. To achieve its goal of bringing DeFi to 1 billion people, the team is currently building on other blockchain networks including the Ethereum blockchain. This paper details the core features of Parallel Finance, its protocol designs, and system architecture.

## Ⅱ. Introduction

The Polkadot ecosystem since its Inception has a market cap of more than \$40 billion at the time of writing and it facilitates a large share of DeFi transactions. Few protocols allow users to utilize their DOT/ KSM assets and remain liquid, while earning attractive yields. Parallel Finance introduces a novel approach to decentralized finance via a composable suit of DeFi applications plus the introduction of new financial primitives. The financial primitive are derivative assets that are issued to users when they utilize their DOT/KSM in our native DApp suite, providing opportunities to earn multiple layers of yield.
The derivative tokens are of different types. They include sTokens and cTokens (depending on product) and are issued to users when they stake their assets in our liquid staking product and via our liquid crowdloan platform. The derivative tokens can be used by users to accrue more yield on other products in the DApp suite at a decent APY such as lending (interest), borrowing, and yield farming in the Money Market to help increase their capital efficiency.

## Ⅲ. Lending Protocol

### 1. Overview

#### 1.1 Supplying Tokens

The Parallel lending protocol uses a pool-based strategy that aggregates each user's supplied assets.
This lending protocol will have a DOT, sDOT, and USDT pool where users can deposit their assets and earn interest. This market is liquid, and so long as the total supplied amount is not being borrowed, it offers lenders liquidity, and the ability to turn their supplied asset into cash and realize their earned interest.
Balances in this money market accrue interest based on the supply interest rate unique to that asset. The supply interest rate is calculated based on the current interest being paid, divided based on pool ownership amongst the current users supplying assets to that market. Users can view their balances (including accrued interest) in real-time.
Token holders who are long DOT can use a Parallel's money market as a source of additional revenue by lending. Additionally, a user who owns sDOT could also lend that asset out in the money market, thus earning staking returns and interest at the same time.

#### 1.2 Borrowing Tokens

Parallel enables users to borrow from the protocol with over-collateralized loans. Each borrow market has a floating interest rate, determined by the utilization of that market's assets.
In order to borrow an asset, users must deposit or approve an asset or assets as collateral that is/are more than the target outstanding borrowed amount, thereby setting the borrow. The borrowing limit is dependent on the Loan to Value ratio of that specific market. In order to increase the borrowing limit, users can either repay a borrowed asset or deposit more collateral.
As prices fluctuate, if the value of a user's supplied assets divided by the value of their outstanding borrowed amount declines below the collateral ratio, the user's collateral becomes available to purchase at the current market price minus a liquidation discount. This incentivizes an ecosystem of arbitrageurs to step in to reduce the borrower's exposure quickly and eliminate the protocol's risk of downwards price action, and a Loan To Value ratio below 100. Details of the liquidation mechanism are described in section 4.3.

### 2. Interest Rate Model

#### 2.1 Internal Exchange Rate

When a supplier deposits an asset to the money market, the internal supply position of the supplier will be added with a certain amount based on the initial exchange rate. The supplier earns interest through the appreciation of the internal exchange rate.
$internalExchangeRate=\frac{totalCash+totalBorrows−totalReserve}{totalSupply}$
Because the total borrowed amount is saddled with interest, the internal exchange rate continually increases. This means that ultimately, the supplier can withdraw more of this asset with the new exchange rate than they could when they deposited.

#### 2.2 Interest Rate Model Principle

Parallel Finance utilizes an interest rate model to balance an equilibrium between supplying and borrowing markets. The interest accrued from borrowers will be distributed evenly to all suppliers. Without considering the reserve, the relationship between the supply and borrow side can be described as the following:
$SupplyRate \cdot TotalSupply = BorrowRate \cdot TotalBorrow$
The following are the definitions for different variables in the money market:
• Cash = Total Unborrowed Assets
• Borrows = Total Borrowed Assets
• BaseRate = Starting interest rates
• Slope = Slope that defines the interest rate increases
The utilization ratio U for each money market unifies supply and demand into a single variable:
$UtilizationRatio=\frac{totalBorrows}{totalCash + totalBorrows − totalReserves}$

#### 2.3 Borrow Interest Rate

When demand is low, interest rates should be low, and vice versa when demand is high. The
$BorrowInterestRate$
is defined as the following:
$\begin{array}{cc} \{ & \begin{array}{cc} BaseRate+U \cdot (JumpRate - BaseRate) / U_{target} & U\leq target \\ JumpRate + (U - U_{target}) \cdot (FullRate - JumpRate) / ( 1 - U_{target}) & U> target \\ \end{array} \end{array}$

#### 2.4 Borrow Interest Rate Parameters

Asset
U_target
BaseRate
JumpRate
FullRate
PARA
80%
2%
10%
32%
DOT
80%
2%
25%
45%
sDOT
80%
2%
10%
32%
LP-DOT/sDOT
80%
2%
10%
32%
LP-DOT/PARA
80%
2%
10%
32%
LP-DOT/cDOT-6/13
80%
2%
10%
32%
LP-DOT/cDOT-7/14
80%
2%
10%
32%
LP-PARA/cDOT-6/13
80%
2%
10%
32%
cDOT-6/13
80%
2%
10%
32%
HKO
80%
2%
10%
32%
KSM
80%
2%
30%
50%
sKSM
80%
2%
10%
32%
LP-KSM/HKO
80%
2%
10%
32%
LP-KSM/sKSM
80%
2%
10%
32%
LP-KSM/cKSM-20/27
80%
2%
10%
32%

#### 2.5 Supply Interest Rate

For the sustainability and resilience of the protocol, suppliers' total interest earned must be less than the total interest product by borrowers. The supply interest rate is a function of the borrowing interest rate and includes a spread, S(such as 0.10), which represents the economic profit of the protocol:
$SupplyInterestRate=BorrowingInterestRate \cdot UtilizationRatio\cdot (1-S)$
This protocol fee can be used to support further development of the platform, as insurance in case of a crypto economic attack, or provide emergency liquidity to the system.

#### 2.6 Interest Rate Index

Each interest rate's history, for each money market, is captured by an Interest Rate Index, which is calculated each time an interest rate changes, resulting from a new block connected. A user's balance, including accrued interest, is simply the ratio of the current index divided by the index when the user's balance was last checkpointed.
The borrow balance for each account in the market is stored as an account borrow snapshot which is a Rust struct like this:
pub struct BorrowSnapshot {
pub principal: Balance,
pub interest_index: u128,
}
This struct describes the balance at the time interest was last applied to the account.
Each time a block is connected, both the supply and borrow Interest Rate Index for the asset are updated to compound the interest since the prior index, using the interest for the period, denominated by r*t, is calculated using a per-block interest rate.
$Index_{a,n} = Index_{a,(n-1)} \cdot (1 + r \cdot t)$
2.7 Borrow Mechanism
A user who wishes to borrow and who has sufficient balances stored in Parallel may call
pub fn borrow(
origin: OriginFor<T>,
asset_id: AssetIdOf<T>,
borrow_amount: BalanceOf<T>,
) -> DispatchResultWithPostInfo
which is on the loans pallet. This function call checks the user's account value and the given sufficient collateral. It will update the user's borrow balance, transfer the tokens to the user's account address, and update the money market's floating interest rates.
Each account has a BorrowSnapshot structure to store a snapshot of the last settlement information of interest.
pub struct BorrowSnapshot {
pub principal: Balance,
pub interest_index: u128,
}
The borrows accrued interest is calculated as follows:
$accruedInterest = \frac{snapshot.principal \cdot borrowIndex}{snapshot.interestIndex}$
A borrower has the right to repay an outstanding loan at any time by calling
pub fn repay_borrow(
origin: OriginFor<T>,
asset_id: AssetIdOf<T>,
repay_amount: BalanceOf<T>,
) -> DispatchResultWithPostInfo
which repays the borrow's principal and accrued interest.

### 3. Experimental Models

#### 3.1 Curve Interest Rate Model

For most lending protocols, interest rates are adjusted by a piecewise function to bind the utilization ratio within a reasonable range. However, the negative feedback of this system is relatively weak and inflexible. The curve function on Parallel will solve the problem of inflexibility.
In order to achieve this goal, the interest rate change speed needs to gradually increase as the utilization rate increases. For the best way to fit it, it is necessary to combine the power functions and exponential functions and adjust the parameters.
$BorrowInterestRate=\underbrace{\sum_{}^{}c_{n1i1}\cdot e^{[c_{n1i2}\cdot (UtilizationRatio-c_{n1i3})]}}_{Random}+$
$\underbrace{\sum_{}^{}b_{n2i1}\cdot (UtilizationRatio-b_{n2i2})^{b_{n2i3}}}_{Random}+c$
Take USDT as an example: the image below shows the difference of borrow interest rate changes between Parallel, Aave, and Compound. While Parallel, Aave, and Compound all have similar interest rates when the utilization ratio is below 80%, the curve function of PARA realizes higher interest rate changes when the utilization ratio approaches 1 compared with the other two markets. While we are optimistic that this mechanism will perform well, it will not be deployed before there are enough statistics on Parallel.
Curve Function of USDT market

#### 3.2 Interest Rate Adjustment Mechanism

Interest rates of the same assets in different markets are sometimes extremely different. When the utilization ratio hits a higher percentage, the adjustment mechanism will be triggered, and the Off-chain worker will capture interest rates of different assets from other decentralized markets. Weights will be given to each market based on their effectiveness, to obtain the average market interest rate level. It is worth noting that the adjustment factor will only be triggered when the utilization rate reaches the threshold, in order to make the utilization rate back to an appropriate level. The Adjustment Factor and Borrow Interest Rate will be calculated by:
$AdjustmentFactor=\frac{BorrowInterestRatePARA-\sum_{}^{}c_{i}\cdot BorrowInterestRate_{i}}{ \sum_{}^{}c_{i}\cdot BorrowInterestRate_{i}}$
$BorrowInterestRateAdjusted=BorrowInterestRate\cdot (1+AdjustmentFactor)$

### 4. Liquidation

Liquidation is essential for a Money Market Protocol. At the present stage, liquidation will be triggered by an off-chain liquidator [7]. When prices fluctuate a lot, the health factor of the accounts on Parallel will likely go down in order to diminish systemic risk. In addition, an oracle needs to be able to feed the prices as quickly as possible while unhealthy accounts need to be liquidated [8]. However, due to the throughput and gas fee on Ethereum, liquidation calls may be delayed, which increases systemic risk.
Parallel introduces a liquidation solution built with a Substrate Off-chain Worker. It has three key components: Auto-liquidation Algorithm, On-Chain Liquidation Pool, and Flash Liquidation.

#### 4.1 Auto Liquidation Algorithm

The Off-chain Worker will fetch all borrowers, debt, collateral, liquidation ratio from the state of Parallel blockchain, also the prices from oracle, then the protocol calculates the health factor of each borrower's account if there is a liquidation opportunity, then it will automatically send a liquidation transaction to on-chain.

#### 4.2 On-Chain Liquidation Pool

The on-chain liquidation pool is the only portal to execute a liquidation. Although a reserve fund is provided in the pool, liquidators can still trigger liquidation with their own fund without any capital in the reserve fund.
Any user and bot can send liquidation transactions, the liquidation pool will invoke a function in lend and borrow pool to promote liquidation.
In the event of liquidation, there will be a penalty for the borrower and a bonus for the liquidator. The liquidator's bonus comes from two parts: borrowers' collateral discount and borrowers' penalty.

#### 4.3 Flash Liquidation

Parallel introduces a new way of liquidation that allows the user to send a liquidation transaction without any capital. A function interface was provided to allow users to liquidate without any assets, aiming to provide a DeFi Lego component with Flash loan, DEX.

### 5. Oracle and Price feed

In order to secure the lending protocol, Parallel is required to have accurate and real-time market prices for different assets. An oracle has been introduced as a mechanism that brings off-chain data on-chain, in a credible and decentralized fashion. For now, most mature decentralized oracle solutions are designed for Ethereum. Some protocols like Chainlink are devoted to building a strong economic network for gathering price off-chain and feed price by submitting a specific transaction [11]. In Polkadot, there is already some early work to provide the decentralized oracle solutions by the Substrate community, but such solutions are far from production-ready. Parallel designs a semi-decentralized way to tackle the current situation.

#### 5.1 Off-chain Price Fetching

The Parallel team implements a simple but efficient client to fetch the prices from the mainstream exchanges. For each asset, the fetched prices are reduced into one with a median strategy. During each block, the authorized members can submit the price on-chain. To make it as secure as possible, the authorized members are elected by the governance of Parallel.

#### 5.2 On-chain Aggregation Strategy

When the prices are submitted on-chain, several strategies such as a median algorithm and an average algorithm are provided to gather them.
Median algorithm:
$MedianPrice = SortedPrices[_{counts/2}]$

### 6. Farming

To incentivize users to deposit and borrow, a reward mechanism has been introduced.
For each market, when users supply assets or borrow assets, there are separate reward programs. when calculating reward, the following items will be considered:
• asset id and corresponding collateral value
• reward release rate measured in blocks, including supply reward and borrow reward
• the reward state for each market, including supply reward and borrow reward
• last time that accrued reward for each market

## IV. Staking Protocol

### 1. Overview

Polkadot's relay chain uses a derived PoS (Proof of Stake) consensus to secure its network. Most parachains will also have a simplified PoS mechanism to incentivize their collators to produce valid blocks. The users' token like DOT serves as the staked assets which will be locked during nominating the validators and the collators. Also, a delay (aka, unbonding period) is often enforced by protocols when users want to cease participating, and unlock their assets. The staked assets can be slashed if the validators do harm to the network. Such restrictions impose economic costs on the holders of staked assets and require the holders have sufficient knowledge to choose validators. Parallel proposes two solutions to circumvent the limitations: delegated staking, and a lending pool with a bounded rate.

### 2. Validator Choosing Strategy

There are a few dimensions when choosing validators in Parallel's protocol. Here they are in order of priority, from high to low:
• the reputation of the node operator
• the validator should trigger payout regularly
• single operator with more validators has a higher probability to be slashed if downtime happened
• the commission rate and nomination volume of the validator
• the downtime and luckiness which wraps era points on Polkadot network and slash records in the past
• the amount should not be controlled by one account, nor one active nomination
• less than 200 DOT will be dropped (it is acceptable on Kusama since there are enough validators on the Kusama network)
Through on-chain governance and XCM, nominator operation is executed correctly.

### 3. Nomination Workflow

• Assign derivative index, bond to Relaychain via XCM,
• Nominate validators are chosen by the Parallel protocol based on the above strategy.
• Distributing funds to each derivative account, based on Funds Distribution Algo
• Bond extra KSM with Stash account if new fund comes in.
• Unbond a certain amount of KSM if a request for unstaking occurs, wait until unbonding period ends.
• Withdraw unbounded and transfer to the Parallel's system account which holds the unstaked assets.
Extrinsics:
• bond: stash account
• bond_extra: stash account
• unbond: controller account, max unbond queues: 32
• rebond: controller account
• withdraw_unbonded: controller account
• nominate: controller account
• payout_stakers: check validators do submit this call before the deadline.
The above workflows can be executed by XCMP (Cross Chain Message Passing), all extrinsics can be submitted from the parachain account. On-chain logic can send accurate messages based on the on-chain analysis.

### 4. Delegated Staking

The holders deposit their staked assets into Parallel's system account in exchange for a voucher (aka, sDOT) which represents the ownership of the staked assets and shares the revenue of staking activities on the relay chain. Parallel's liquid staking protocol then nominates validators with a funded system account. sDOT can also be used as collateral assets in the lending market. The price of sDOT is the same as DOT before there are high-quality open markets.
Exchange rate between sDOT and DOT:
Calculation:
$exchangeRate = \frac{TotalActiveBonded + TotalStake - TotalUnstake}{sToken Issuance}$
• TotalActiveBonded, include all derivative accounts' active bonded amount on relaychain.
• TotalStake, including the total stake amount by all users during the current era.
• TotalUnstake, including the total unstake amount by all users during the current era.
• sTokenIssuance, total issuance amount of sDOT

### 5. Instant Unstake

Instant Unstake is combined by MatchingPool/AMM/Money Market.
To mitigate the unbonding period, Parallel protocol proposes a matching pool that records users' stake and unstake amount each era. According to a matching mechanism, part-fund in this pool can be redeemed by users with sDOT instantly.
Besides MatchingPool, Staking protocol will cooperate with AMM and Money Market, allowing users unstake instantly.
With AMM, if a user unstake instantly, sDOT will be swapped by DOT.
With Money Market, users need to be charged a certain percentage of the handling fee, then DOT can be redeemed directly. Essentially, Staking Protocol lends DOT from Money Market without any collateral and makes sure to repay it once received from relaychain.

### 6. Interest Lending Pool with Bounded Rate

Parallel's system account can borrow DOT from the pool without collateral, and it won't be liquidated. To maintain the liquidity, the system's accounts can't borrow anymore if the utilization ratio is higher than a specific threshold, say 80%. It also starts unbonding staked tokens and repays the outstandings to maintain healthy liquidity in the pool. To mitigate the attack vector on the limited ROI of staking, the interested rate of such a pool is bounded to not exceed the evaluated ROI of staking, which is around 7.5% on Kusama.

### 7. Slash Insurance

A slash can still happen if a validator misbehaves, or there is an outage of many validators. Holders can purchase insurance for their holdings that last for a defined period. Partial fees of Parallel's staking protocol will be deposited into the insurance fund and accumulated. If a slash happens, the insurance beneficiary can get compensation from the fund. The cap of the compensation is defined by governance.

### 8. Fees

For stake and instant unstake, there will be a certain percentage of the fee to be charged.

#### Stake fee

When users stake on parachain, in fact the reward will be calculated after one era, so a portion of the stake amount that equals one era's reward will be deducted in advance, this part will be reserved on parachain. another part called xcm fees will be charged when the user stake.

#### Instant Unstake Fee

Normally users' unstake operation needs to wait for at least 28 eras until receiving their assets. currently, users can pay additional fees if they want to redeem their assets back instantly.

#### Fee calculation table

Operations
XcmFee(Fixed)
EraRewardReserve(Proportional)
InstantUnstake(Proportional)
Stake
0.05DOT, 0.005KSM
0.05%DOT, 0.01%KSM
0%
Unstake
0
0%
0%
Instant Unstake
0
0%
3%

## V. AMM Protocol

### 1. Overview

As the infrastructure protocol of DeFi, Parallel aims to provide security and reliability Auto Market Maker(AMM) protocol for our users.
There are two swaps: Dynamic is for asset pairs like DOT/USDT, KSM/HKO; Stable is for asset pairs between two stable tokens, like USD/USDT, or between a token and its derivative token, like sDOT/DOT, sKSM/KSM.
Each asset pair is corresponding to a pool, if there is no direct swap path between two assets, a Route can be used. In short, Route means that by connecting the transaction pairs of the pool end-to-end, any asset can find a path to connect each other.

### 2. Dynamic Swap

The constant product formula is used in Dynamic Swap:
$x \cdot y = k$
Where x is the base asset amount and y the quote asset amount of the [X, Y] pair with k being a constant.

### 3. Stable Swap

Asset pairs that have the same price, for example, USD-USDT or DOT-xDOT, will fluctuate less on different transactions using this specific AMM.
$y = (k * (A*k + k - A*x)) / (4 * (A*k + x)) \\ A = 0.5 + ER \\ 0\% <= ER <= 100%$

### 4. Pool

The AMM maintains a list of pools. Each pool contains two assets that can be traded against each other.
Pools can be listed via the Pools storage item of the AMM pallet. It consists of a triple map of both pool assets and some states about the pool.

### 5. Route

Each pool includes two assets that can trade each other. with Route, any assets that exist in a pool, if there is a path to make the two assets connect through multi-pools, then they can also trade each other. This is what a route to do.

### 6. TWAP

Time Weighted Average Price(TWAP) will be updated once the swap happened, the formula is:
$TWAP =\frac{ Price1CumulativeLast - Price0CumulativeLast}{ Timestamp1 - Timestamp0}$

## VI. Governance

### 1. Overview

Parallel protocol is designed to be a fully decentralized financial platform that can serve millions of users and most of them may not be well off. On Parallel, there are 4 kinds of stakeholders,
• the development team and open contributors
• investors with Parallel's native token
• a wealth of platform users
• network maintainers
The governance process should incentivize each party to participate in the network activity and evolve the protocol to meet the broad users' requirements.

### 2. User Reputation

In the vision of Parallel, the Web3.0 translates to how much power the general users can exercise. Parallel designs a calculation method to make the reputation of each user as fairly as possible.
$TradingScore = c \cdot (1 - 1/x)$
• TradingScore: the base score of each user who trades on the platform
• c: a constant, shows the highest score a user can reach by trading
A user can follow another users, the followed user gets an extra score,
$FollowedScore = p \cdot TradingScore$
• p: a percentage
• FollowedScore: can be accumulated and should not exceed 2 times of its own TradingScore.
• A user can follow no more than 16 other users, and can't follow himself. Following other users should also include making a security deposit.
The total score will fade along with time if no trade happens.
$TotalScore =\frac{ TradingScore + FollowedScore}{ now - lastTradeTime}$

### 3 Democracy

The core logic of Parallel protocol is wrapped as a blockchain runtime. Thanks to Substrate, the runtime can be easily upgraded without a network fork or a choke. To make the upgrade meet the expectation of all the above stakeholders, every runtime upgrade will be voted on by the network participants with native tokens and with reputation.
$TotalVotingPower = p / t \cdot Sum(TokensVoted \cdot LockedPeriod) +$
$(1 - p / t) \cdot Sum(c \cdot Reputation)$
• TotalVotingPower: the voted score of a specific democracy proposal.
• TokensVoted: the tokens a single user voted with for the proposal.
• LockedPeriod: the period the user wants to lock, if the proposal exercised.
• p: percentage of the tokens' power, faded along with time no matter what.
• c: conversion rate between the token and reputation.
If a proposal gets more ayes than vetos after the voting period ends, it will be scheduled with an on-chain deployment.

### 4. Council

The council performs daily affairs like:
• configuring the adjustable parameters of Parallel protocol
• interest rate model per market
• addition or removal of a market
• addition or removal of backed validators
• the reserve fees of the platform
• making emergency calls
• canceling slash scenarios
• approving the Treasury proposals
• making tips to contributions, etc
The council member is elected by the token holders, and users with a reputation.

### 5. Treasury

Parallel charges a small fee for each deal. These fees go into the Treasury directly. The fee aims to fund the ecosystem, and to create healthy growth. Teams make spending proposals, and council members approve or disapprove of them. Council members can also tip the known contributions with a small number of native tokens.

## VII. Summary

Parallel introduces a decentralized lending protocol with a floating interest rate determined by the underlying assets' supply and demand. The staking protocol also provides liquidity to bonding assets in the Polkadot ecosystem. Parallel balances the competition between staking and DeFi rewards to solve the usability issue for the representation token (xDOT). Finally, we hope to achieve more incredible benefits for users through double interest.