# PeerHive - Assets-backed crypto lending protocol for SMEs

PeerHive is a non-custodial blockchain lending platform that connects SMEs in need of funding with lenders worldwide. Our platform offers a secure and transparent solution, backed by real-world assets

## **What do We do?**

We help SMEs to meet their **short-term direct financing needs**, by tapping into **Cryptocurrency** wealth powered by **Smart-Contract** that is **immutable and self-executing.**

## <mark style="color:red;">We do not make Lending Decisions for all our Lenders, we only approve loan applications after they meet our risk and compliance requirements.</mark>

## Our Mission

> Empower SMEs with a <mark style="color:yellow;">**Fast and Reliable**</mark> financing option that is <mark style="color:yellow;">**Less Volatile**</mark>, <mark style="color:yellow;">**High in Return**</mark>, and <mark style="color:yellow;">**Decentralized in nature**</mark>. Offer a <mark style="color:yellow;">**sustainable investment opportunity**</mark> for all crypto-holders. Tap into cryptocurrency wealth to help SMEs meet their short-term direct financing needs through self-executing smart contracts.

## Our Vision

> <mark style="color:yellow;">**Become the go-to platform for all RealFI fundraising services**</mark>

## Our Promises

> <mark style="color:yellow;">**Reliable Platform**</mark>
>
> <mark style="color:yellow;">**Security First**</mark>
>
> <mark style="color:yellow;">**Regulatory Compliant**</mark>

## Application and Problems

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/7kmGFMf3KQwyGBmTQWTv" %}
[Banks and how they earn money](/application-and-problems/banks-and-how-they-earn-money)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/jAQ8MqkX6s6eE4ycnHjl" %}
[Cryptocurrency and Exchanges](/application-and-problems/cryptocurrency-and-exchanges)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/vKruwRRKuTOOfzTvYNok" %}
[Issues with cryptos](/application-and-problems/issues-with-cryptos)
{% endcontent-ref %}

## Solving the Problems

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/eCy9pucKQD3WeyMU4zPO" %}
[Solving the Fundamentals](/solving-the-problems/solving-the-fundamentals)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/j6rwJlO6notnwh1bc5wX" %}
[Solving the Decentralised](/solving-the-problems/solving-the-decentralised)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/tXYaEKuwzJdri0GcX7uR" %}
[Fund and Information Flow](/solving-the-problems/fund-and-information-flow)
{% endcontent-ref %}

## Protocol

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/WCJcNF6ekD9seX7OmnRD" %}
[Type of Financing](/protocol/type-of-financing)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/TKH6npIqqTt5RlzXhFaG" %}
[Monthly Repayment Terminology](/protocol/monthly-repayment-terminology)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/5ddSpIqiPABQVTaCPIhd" %}
[Flow Chart](/protocol/flow-chart)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/0Q4jMYuiRlo5obcEOZr0" %}
[Roadmap](/protocol/roadmap)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/MEhIVkUaBgCqZfcBnNwo" %}
[Risk Management and Compliance](/protocol/risk-management-and-compliance)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/g8i8ycT4Xl1871gFtG87" %}
[Debt Recovery Process](/protocol/debt-recovery-process)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/nWDHWfzH8GbAiwVfpjFH" %}
[Secondary Exchange](/protocol/secondary-exchange)
{% endcontent-ref %}

## Tech Stack and Smart Contract

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/HnKYUjfJ4FV8cKSK0WKX" %}
[Chain](/tech-stack-and-smart-contract/chain)
{% endcontent-ref %}

{% content-ref url="/spaces/KZ1x53rs0AgHNc04QzwJ/pages/oU4iLNJfBJPgLEjwPtOn" %}
[Introduction](/tech-stack-and-smart-contract/introduction)
{% endcontent-ref %}


# Banks and how they earn money

## ***Flows of Fund (Centralised Application)***

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2Fu4bb3O7xmI75rUWqOeyo%2FUntitled.png?alt=media&amp;token=e82a3198-196a-49a9-b6c1-19cb4bd2beae" alt=""><figcaption></figcaption></figure>

### Why do we need savings?

Saving gives a sense of safety during uncertainty, during a centralized application this was amplified by the existence of PIDM or Federal Deposit Insurance Corporation in the event of the bank or FIAT centralized authority going bankrupt.

**BANK** capitalizes this by acting as the centralized authority in accumulating savings from savers such as:-

1. **Household Savings**
2. **Business Excess Cash**
3. **Government Expenditure Surplus**

in return for a marginal savings rate of around 0.5% - 2% interest rate.

The accumulated savings from the bank will conduct fractionalized lending, by holding only a portion of the money deposited with them as a reserve. The bank use customer deposits to make new loan and award interest (Savings rate) on the deposits made by their customer.

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FmuEdojEHL4VQI7RPlUMH%2FUntitled%201.png?alt=media&amp;token=9375ac9d-e624-4d82-b6c5-97b717fe2dc3" alt=""><figcaption></figcaption></figure>

The subtotal in the diagram represents the total Deposit in the bank, in this case, representing USD 100,000.

Because these deposits needed to be paid back in the future and are often interest bearing they are regarded as **Liabilities**.

Banks then utilized a portion of these deposits (≥90%) as interest-bearing loans (typically 3-6%), so in this case, this would turn to transform the monies deposited into **Assets, USD 90,000.** While the remainder will act as a capital requirement for the bank to meet the depositor's future withdrawal.

$$
Deposits = Loan Amount - Capital Reserve
$$

### How do banks earn money? (Retail Banks)

The difference between the interest rate between Loan IR and Savings IR would be the net Interest Income for the bank. (IR = Interest Rate)

$$
NetIR=LoanIR-SavingIR \ \varSigma NetIR=\varSigma (Loan \times LoanIR)- \varSigma(Saving \times SavingIR)
$$

Given that the saving is not controllable, while the SavingIR is typically lower than the feds fund rate they are generally stable. While the total loan amount is dependable on the total saving deposited.

### In layman's terms:

1. Interest on loans (***LoanIR)*** : When a bank makes a loan to a customer, it charges interest on the loan.
2. Interest on deposits ***(SavingsIR)***: Banks also pay interest on deposits that customers make into their accounts.
3. Earning the difference between interest on loans and deposits

### Why are loans crucial?

Loans are often crucial for corporate because this would improve the following:

1. Business Expansion
2. Growing Project
3. Improving cash flow for personal and corporate
4. Improving term for a larger amount in the future.

### 🙈Problem Arise

**Moral Hazard**

Banks are required to maintain certain ratios of capital to assets, as prescribed by regulatory agencies such as the Federal Reserve. We call Statutory Reserve Requirement (SRR). These ratios are designed to ensure that banks have sufficient capital to absorb losses and meet their financial obligations. If a bank were to lend more than what is required by these regulatory ratios, it could potentially put the bank in a risky financial position, as it may not have enough capital to cover potential losses on the loans.

However, it is important to note that while banks are required to maintain certain capital ratios, they are also in business to make profits. As such, they may choose to lend more than what is strictly required by regulatory capital ratios in order to generate additional revenue from interest on the loans.

**Adverse Selection**

Adverse selection occurs when there’s a lack of symmetric information prior to a deal between a buyer and seller.

This lesser information often leads to higher risk for the lender / Bank.


# Cryptocurrency and Exchanges

## Centralized Exchange (CEX)

**CEX** Acted as a great payment and trading platform for holders to trade and speculate on cryptocurrency.

### CEX provides Crypto Loans

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2F5Ug7fdhonZcXSBfSpa1k%2FUntitled%202.png?alt=media&amp;token=3a138962-c48a-4359-8074-e3455abdc415" alt=""><figcaption><p>CEX crypto loan work in accordance with the banking loan mechanism without fractionalized lending. here</p></figcaption></figure>

Such crypto loans provide the opportunity for more speculation within the crypto economy, the steps are as follows:-

1. Obtain assets on crypto exchanges.
2. Move assets to an exchange that provides a loan (Binance)
3. Obtain a quotation for a crypto loan
4. Crypto loans are often overcollateralized typically ≤90% of the total value of the assets.
5. The crypto loans asset were then moved onto the platform’s exchange, which allows the holder to continue speculating on the crypto economy.

## So how does HODLer earn?

### Crypto Speculation

This involves trading and flipping for a certain cryptocurrency in the market, where HODLer would earn the difference between buying and selling of the assets.

### Crypto Staking

Staking - Locking assets for a period of time to help support a blockchain

For each of the blocks being added via PoS activity HODLer able to earn more cryptocurrency

### Gaming

Playing a play-to-earn game while earning crypto at the same time

### Crypto Loan

Earning crypto by borrowing own crypto asset as a loan asset

However, such loans are not controlled by the lender

These are operated by the CEX directly.

### The current issue surrounding the Cryptocurrency industry

1. **Poor checks and balances within CEX are one of the major reasons causing the collapse of CEXs such as FTX.**
2. **Strong overleverage speculation of the cryptocurrency market.**
3. **The high volume of liquid assets in the cryptocurrency industry is not being placed into good economic output.**
4. I**nsufficient use cases that push for general acceptance of cryptocurrency.**


# Issues with cryptos

## 1. CEX, Centralized Liquidity Lender

## Liquidity Problem

### CEX’s Liquidity

The lack of information among CEX causes Fear, Uncertainty, and Doubt (FUD) regarding the business's ongoing liquidity and business model creating a bank run on withdrawal funds.

CEX that does not meet the withdrawal demand will be deemed illiquid, a well-contained bank run would subside after a single exchange failure. The FTX collapse, was due to the initial selling of FTT by Binance caused more people to follow suit combined with HODLer also withdrawing funds from the initial FUD.

* **While the majority of the CEX hold asset one-to-one with its deposits, small CEXs still mix operational funds and deposits together. Causing misappropriation of the deposit leading to lower liquidity issues during withdrawal.**

In the context of CEX, HODLer assets are regarded as <mark style="color:red;">**liabilities**</mark> as they cause money to store the crypto asset and would be withdrawn sometime in the future.

In order for CEX to earn money from HODLer’s deposits, they would conduct a <mark style="color:red;">**Liabilities**</mark> <mark style="color:red;">**Transformation**</mark> into <mark style="color:green;">**revenue-generating assets**</mark> such as using the deposit fund to invest in <mark style="color:red;">**HIGH-RISK HIGH REWARD**</mark> investments.

### Overleveraging

Leverage works well during good times when the market is moving in the direction of the trading position, leveraging this would allow traders to obtain above-market returns.

Thus, when market movement is not in the trading position. Leverage may cause returns to be more than the average. This would also cause the value of the collateralized asset to decrease, ultimately causing the <mark style="color:red;">**loan asset may not be recoverable**</mark>**.**

> **During the liquidity transformation phase and leverage taken by the CEX adds pressure on the centralized platform in order to meet the client's withdrawal demand during a potential “CEX-run”**

**This poor check-and-balance within CEX’s risk management increases its vulnerability during the market downturn.**

Because CEX is not operating similarly to the bank's business model, **Moral Hazard** and **Adverse Selection** occur.

## 2. Cryptocurrency HODLer

### Overleveraging (Holder)

Cryptocurrency holders often **collateralize owned crypto assets to obtain low-interest asset-backed loans (ABL)**, that are often placed back onto the platform’s exchange as part of their speculation strategy.

Against the backdrop of collateralized assets + loan, this would add to the correlation to all of the total assets. <mark style="color:red;">**DOWNWARD SPIRAL**</mark>**.**

> The d**ownward spiral, causes the LTV of the collateral to drop as HODLer wouldn’t be able to meet the loan obligation. Then the loan asset will now effectively NIL. (Often the loan doesn’t need to be paid back as long as the collateral is able to meet the repayment need)**

<mark style="color:red;">**No real passive income and economic output is derived from Crypto-leveraging other than chasing unrealistic returns through market speculation.**</mark>

## 3. Economic output

### Overcollateralization

DeFI and CEX platforms provide assets-backed loans with super low-interest rates, some platforms provide ABL that are as low as 20% to the LTV (Loan-to-Value) ratio. Out of the $100 value of the asset, one can only loan as much as $20.

* **With just 4 iterations of lending, it would achieve as much as 2.04x of the fundamental owned assets. This would exaggerate the total leverage position of the holder in the future.**

$$
LTV = \dfrac{LoanAmt}{Asset}
$$

$$
Asset = LoanAmt/LTV \LTV = 0.2\ LoanAmt = 204\ Asset = 1020
$$

Because the *LoanAmt* doesn’t change, when the Asset value drops the LTV Ratio will increase after hitting a certain threshold the crypto holder will be issued with Margin Call.<br>

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FNXjrXnnt2bDlBaH3YLaT%2FUntitled%203.png?alt=media&amp;token=3deb3874-2d10-466c-ac90-8c723fbe34ad" alt=""><figcaption><p><em><strong>Binance publicly advocates the use of crypto loans as a form of continuous speculation.</strong></em></p></figcaption></figure>

Such an over-collateralization rate, **only advocates for continuous speculation in the crypto market.** As it is not sufficient enough to bring real economic output in the FIAT economy (generally pushing for lower acceptance of the general public)

💡 The Internal cycle of money in the cryptocurrency market should be broken pushing the usage of this liquidity to bring good economic output, while paying crypto-user interest payment while investing in such projects.

### Position Wealth

The vast wealth that the cryptos industry has amassed is mainly due to crypto’s market speculation, while the underlying issue of speculation of the crypto’s market is due to lacking **Economic Output Infrastructure.**

The early days of the Crypto industry are fueled by FOMO, and while the industry is maturing itself, the use case of crypto-currency should change as well. The speculative nature of the industry market has made Investors in the crypto market lose <mark style="color:red;">**more than $ 2 trillion**</mark>**.**

> ***The goal of wealth creation should not be to get rich quickly, but rather to build long-term, passive income streams that can provide financial security and freedom for the rest of your life***

While the general staking position gives a passive income generation for its holder, the staking rewards are highly dependable on the supply of tokens being staked. <mark style="color:red;">**The lower the total staking amount the higher the staking reward**</mark> is, while these tokens are <mark style="color:red;">**prone to volatile crypto price movement**</mark> as compared to stablecoins that are pegged one-to-one to Fiat currency.

In general market conditions, investors would look for an alternative platform to invest their money when their position is not up to the market expectation. <mark style="background-color:orange;">**Driving Staking Reward to drop.**</mark>

In some cases, the impermanent loss can contribute to a loss of potential income, as it can result in a reduction in the value of an investment or trading position. For example, if an investor holds a long position in a cryptocurrency and the value of that cryptocurrency decreases relative to another cryptocurrency that the investor is short of, the investor may experience a loss due to the impermanent loss.


# Solving the Decentralised

##

## Solving the Decentralised

### Economic Output

The current crypto market regime caters towards the speculative trading of cryptocurrency which is *<mark style="color:red;">**fundamentally due to the lack of high-quality economic output**</mark>*. Despite the lack of economic output, Cryptos has developed advanced payment and transaction use cases. These use cases are facilitated through the staking of a mechanism that returns a percentage of the amount when a block has been successfully added to the chain, thus Blockchain.

Although the staking of cryptocurrency is able to give a high range of staking returns for stablecoin typically in the range of [**0%-19% APR**](https://www.stakingrewards.com/stablecoins/?sort=tableReward_DESC), they are not stable enough to generate consistent returns (varied according to the total staking amount) as compared to **PeerHive’s D**ecentralized **L**ending ***C***&#x6F;ntracts **(DLC)** of around **8-15%** consistent across DLC’s term.

#### **PeerHive** answer

<details>

<summary>Bridging Businesses towards Cryptocurrency (Stablecoin)</summary>

By onboarding SMEs that met the Pre-Selection Compliance’s criteria, these businesses would act as the backbone of ***PeerHive*** as they are looking for finances to fund their growth or to finance their projects.

As a reward for the lender to provide loans for the borrower to fund their business and respective project financing, the borrower is required to pay interest <mark style="color:blue;">**(8.5%-11%)**</mark> on the principal amount.

At the end of the loan term, borrowers are required to return the principal amount and the last interest payment to the lender, and then the Smart Contract expires together with releasing the collateral (held on a custodian escrow account) back to the borrower.

</details>

### Overleveraging

If a party overleverages and is unable to manage the associated risks, it can lead to catastrophic consequences, including a portfolio-wide default and a failure to meet withdrawal requests from healthy clients at a centralized exchange (CEX).

Overcollateralization can further amplify these downside risks, as it involves borrowing assets to fund a trading position. This can increase the potential for losses if the value of the collateral falls, as the borrower may not have sufficient assets to cover the loan. It is important for lenders to carefully assess the risks and rewards of any investment and to ensure that they have a sound risk management strategy in place.

#### **PeerHive** answer

<details>

<summary>Sustainable Economic Output</summary>

Giving the crypto-community access to a sustainable economic output would <mark style="color:red;">**shift the overleveraging risk away from the drastic movement of the crypto market.**</mark> In an effort to add an additional layer of resiliency towards the crypto-economy.

Instead of holding volatile cryptocurrencies, it may be more beneficial to hold stablecoins that are pegged to a specific fiat currency. However, rather than holding these stablecoins, they could be placed into a Decentralized Lending Contract (DLC) that is backed by a financially strong and reputable business seeking funding for growth and projects. This can provide an additional layer of security and stability to the investment.

Diversification of risk away from the crypto market is crucial for the next step of general acceptance, as this would strengthen the resiliency of the entire crypto economy.

</details>

### Liquidity Access

According to [**Coinmarketcap.com**](https://coinmarketcap.com/), the total market cap stands at $803 billion and the 24-hour transaction volume is $26.8 billion as of (20th Dec 2022). While the overall global Fixed Income market stands at USD 119 Trillion, which is almost 148x of the total crypto market capitalization.

The cryptocurrency market has grown significantly in recent years, with a large amount of liquidity available for investment. This pool of capital can potentially be used to fund projects and businesses, providing a source of stable passive income for lenders.

#### **PeerHive** answer

<details>

<summary>Peer-2-Peer DLC</summary>

Decentralized lending contracts (DLCs) can provide an <mark style="color:red;">**alternative financing option**</mark> for businesses by allowing them to borrow funds using digital or fiat assets as collateral. DLCs are built on smart contracts, which are self-executing contracts with the terms of the agreement written directly into lines of code. This can make the lending process more efficient, transparent, and secure.

DLCs also offer lenders the opportunity to earn returns on their investments by lending funds to businesses. By leveraging DLCs, businesses can potentially tap into a larger pool of capital and lender can potentially diversify their portfolio into the fixed-income market.

By lending funds through a decentralized lending contract (DLC), investors may be able to diversify their portfolio and potentially earn a stable return on their investment. DLCs allow investors to lend their digital assets to borrowers in exchange for interest payments. This can provide an alternative to market speculation and may offer a lower-risk product compared to actively trading cryptocurrencies.

</details>


# Solving the Fundamentals

## Moral Hazard - Centralized and Fiat industry

Every time depositors deposit funds into a CEX or a Fiat Centralized party, they are bound by the term of loss damage waiver, which creates an assumption that the CEX or centralized party is not liable for the loss or damage arising from the usage of the platform.

They are effectively aware that they are not responsible for the loss, which creates a problem, **Moral Hazard** where managers would pursue maximum return with risk not favouring the platform or the deposit.

#### ***PeerHive*****&#x20;answer**

{% tabs %}
{% tab title="Decision Making" %}
Due to ***PeerHive*** not being the direct *Middle Man*, <mark style="color:red;">**we do not process any investment decision-making on behalf of the lenders**</mark> where we only provide due diligence on the borrower. The decision of making an investment falls directly on the client/depositors, all information that the borrower provides will be relay directly to the potential lender after doing a set of basic Know-Your-Customer, Know-Your-Business, Anti-Money Laundering checks and borrower’s financial health check.
{% endtab %}

{% tab title="Revenue Generation" %}

* 0.5% - 1.5% interest charge
* 1% - 3% of successful fundraising amount
  {% endtab %}

{% tab title="Smart Contract" %}
One of the major differences between ***PeerHive*** and other platforms is that we <mark style="color:red;">**do not handle the transfer of assets between “Investors” and “Borrowers”**</mark>. So the investor’s assets are not regarded as Liabilities in ***PeerHive’s*** book, as a result, no liquidity transformation phase requires. Asset transfers are done directly by debiting the investor’s wallet directly to the borrower’s wallet, this can be **done via the usage of a Smart Contract**.
{% endtab %}
{% endtabs %}

Due to the decision-making proposition falling under the lender, we can significantly reduce moral hazards that place financial harm directly towards our investors on the platform. Well part of our revenue is also tied towards the performance of the Decentralized Lending Contract, to ensure no excessive risks are taken that can jeopardize ***PeerHive’s*** portfolio

## Adverse Selection - Decentralized and Post-Investment Management

Because borrowers tend to take risks more than lenders, they intend to utilize information asymmetry to obtain better loan terms than intended. Causing lenders to have a higher level of risk than selecting better-quality projects.

CEXs and DeFI platforms also do not require to go through scrutinized credit and compliance checks causing higher levels of Adverse Selection as much of the loan issued directly caters for trading speculation.

#### ***PeerHive*** answer

Although this can’t be eliminated due to the fundamentals of human nature, PeerHive has taken sufficient steps to reduce such risk.

{% tabs %}
{% tab title="Pre-Selection Compliance" %}

> In an effort to <mark style="color:red;">reduce the Adverse Selection</mark> faced by CEX and also FIAT centralized player, all potential Decentralized Lending Contract has to be backed by certain projects or companies this is to ensure the economic output of the Decentralized Lending Contract has been placed to good use.

Such check is as follows but not limited to:

1. Company Setup ≥ 1.5 Years
2. 2-Years of audited reports for Pte Ltd or Partnership equivalent
3. Annual Revenue that exceeds SGD 100,000
4. Liquidity Ratio ≥ <mark style="color:blue;">**30% (at all times)**</mark>

   $$
   LiquidityRatio = LiquidAsset/CurrentLiabilities
   $$
5. Asset Coverage Ratio ≥ <mark style="color:blue;">**50% (at all times)**</mark>

   $$
   ACR = \frac{(AssetBV-IA)-(CL-STDebt)}{TotalDebt}
   $$

   AssetBV = Total Asset Book Value

   IA = Intangible Asset

   CL = Current Liabilities

   STDebt = Short-Term Debt
6. <mark style="color:red;">Collateral Asset will go through an independent review by a panel of third-party valuers</mark>
7. Regulated KYC, KYB and AML/CTF review
   {% endtab %}

{% tab title="Post Investment Management" %}

> As ***PeerHive*** is a part of the lender consortium for all future lending contracts, ***PeerHive*** will work in line together with other lenders to ensure all the terms set out by the Protocol are being adhered to reduce the risk of default.

Though defaults are inevitable during the course of the investment cycle, ***PeerHive*** would maintain the following:

1. Case Default rate ≤ 10%
2. Amount Default Rate ≤ 15%

This is also combined with proactive communication among all stakeholders, in an effort to keep crystal clear transparency regarding the financial health, group-wide growth and short-term liquidity of the borrower.
{% endtab %}
{% endtabs %}


# Fund and Information Flow

## Fund and Information Flow

## Collateral Securitization

To help manage the risk associated with P2P lending, the collateralized asset would be tokenized and would be minted before the smart contract is disbursed to all lenders where the value of the NFT is fixed as a reflection of the loan value at the point of offering.

The NFT would then create an immutable, transparent track record of the loan’s payment details that can be publicly verified together with the collateral value. At the end of the loan period, the NFT would be transferred back to **PeerHive’s** wallet to be burned as it reaches the end of the NFT’s useful life.

## Funds and Information Flow Diagram

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FWcGzLW2ix0D0wKjmDPuB%2Fimage.png?alt=media&amp;token=fcccaccc-0b78-4c95-8441-10e31b706f7f" alt=""><figcaption></figcaption></figure>

### Phase I

Application:

1. PeerHive receives the application for financing from the borrowe&#x72;**.** *PeerHive* would assist the borrower to obtain a successful listing of DLC on the *PeerHive* platform.
2. The application received will conduct initial checks that are in line with the Pre-Selection compliance check.
3. Given the application met all the criteria set out by the Pre-Selection compliance check, all information will be compiled and pushed to the next phase.

Information Transfer

1. The *PeerHive* team will create a lending note with all the information gathered during the application and information discovery phase.
2. All the information compiled will be presented to the Lender (Left-Hand Side) together with the Lending Teaser, Audited Report and the Company outlook directly.

Governance

1. At the same time, the lender is given the opportunity to scrutinize **PeerHive** information gathering SOP as well as a compilation.
2. As the lending terms and amount are being agreed upon by all parties, a master agreement and additional terms will be sent to the Borrower to be approved.

### Phase II

Smart Contract

1. As the master agreement and additional terms are accepted by the board or by the financial department of the borrower.
2. Terms set out, will be added to the Smart Contract.

Transferring Principal Amount

1. The Smart Contract with the terms set out will be triggered with the principal amount being transferred to the borrower.
2. As the principal amount is not held by ***PeerHive***, the cryptocurrency is being directly credited from the lender's wallet.

Interest Payment

1. During the course of the loan period, the interest payment will be set out in accordance with the term of the loan.
2. At the same time, clear and precise communication between the Borrower and the Lender must be held to ensure proper checks and balances are met while the financial health of the borrower is ensured.

### Smart Contract Flows (potential)

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FgNLq5ErYdFVAEhtXCqQF%2FUntitled%205.png?alt=media&amp;token=17591ecd-71f8-4763-816c-1dabfabde6d9" alt=""><figcaption></figcaption></figure>

#### **PeerHive** utilize Master-Child contract relationship

By using a master-child smart contract arrangement, peer-to-peer (P2P) lending can be made viable without the need for ***PeerHive*** to handle the transfer of cryptocurrency between lenders and borrowers. This would allow ***PeerHive*** to offer a lower fee for conducting crowdfunding for all P2P financial arrangements. Additionally, the use of smart contracts to control the transfer of funds would enable a faster processing time from accumulation to distribution, with the cryptocurrency being transferred directly to the borrower's wallet.


# Type of Financing

We offer a range of lending options for businesses of all types, including invoice financing, working capital management, general business loans, and project financing, thanks to the flexibility of smart contracts.

To minimize the risk of default and ensure the stability of our lending platform, we offer lending options using stablecoins (USDT, USDC, DUSD and etc). These coins are less prone to price fluctuations than other types of cryptocurrency due to their stability, which helps to ensure the regular repayment of loans and protect against the potential impacts of market volatility

## 1. ***General Business Loans / Corporate Bonds (TBA)***

General Business Loan is a type of financing that allows businesses to borrow funds with **physical assets as collateral**. This type of loan is similar to traditional business loans in that it provides the business with the capital it needs to fund operations, invest in new equipment, and technology or cover other business expenses.

General Business Loan on ***PeerHive*** has a faster processing time and the ability to access a global pool of lenders.

1. Loan Term: 6 Months - 5 Years
2. Maximum Loan: ≤ SGD 1,000,000
3. Collateral: Cat - 1 Asset
4. Interest Rate: 8% - 15% APR
5. Interest Payment: Monthly
6. Fees: 1% on successful funds raised + ≥ 0.5% interest

## 2. ***Invoice Financing***

Invoice Financing is short-term micro-loans that are backed by a sales invoice, this type of financing option has a super short processing time generally less than 1 day to be approved and 1 more day for the funds to be distributed to the borrower's wallets.

1. Loan Term: Less than 6 Months
2. Maximum Loan: Invoice Sales, ≥ SGD 2,000
3. Collateral: Cat - 1 and 2 Assets
4. Interest Rate: ≤ 12% APR
5. Interest Payment: Monthly
6. Fees: 1% on successful funds raised + ≥ 1% interest

## 3. ***Working Capital Term Loan***

Working capital financing is a type of financing that is used to fund the day-to-day operations of a business. Working capital is the money that a business needs to cover its short-term expenses, such as payroll, rent, utilities, and other operational costs. It is important for businesses to maintain sufficient working capital in order to keep their operations running smoothly and meet their financial obligations on time.

1. Loan Term: Less than 1 Year
2. Maximum Loan: ≤ SGD 100,000
3. Collateral: Cat - 1, 2 and 3 Assets
4. Interest Rate: ≤15% APR
5. Interest Payment: Monthly
6. Fees: ≥ 1% Interest

## 4. ***Project Financing (TBA)***

Project financing can be used to fund a wide range of ventures, including infrastructure projects, energy projects, and real estate developments. It can be a useful tool for businesses and organizations that need to raise large amounts of capital for a specific project, but may not have the assets or credit history to secure traditional financing.

1. Loan Term: 9 Years
2. Maximum Loan: ≤ SGD 1,000,000
3. Collateral: 50% of project asset (Cat - 1)
4. Interest Rate: 10%-11% APR
5. Interest Payment: Monthly
6. Fees: 1% on successful funds raised + ≥ 0.5% interest

## 5. ***Factoring (TBA)***

Trade factoring allows exporters to sell its account receivable to the PeerHive platform in exchange for lump sum cash flow to meet their internal cash expenditure. This type of financing is an end-to-end financing product, allowing the issuer to meet their cross-border financing demand.

1. Loan Term: 18 Months
2. Maximum Loan: Account Receivables, ≥ SGD 30,000
3. Collateral: Sales Contract
4. Interest Rate: 10%-11% APR
5. Interest Payment: Monthly
6. Fees: 1% on successful funds raised + ≥ 0.5% interest


# Flow Chart

## Borrower Flows

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FihF7hADy2tys51was85n%2FPeer_Protocol_Process_-_Borrower.png?alt=media&amp;token=a1575e0a-03c0-4fa5-bb0a-80cc11bf831e" alt=""><figcaption></figcaption></figure>

## Lender Flows

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2F6EfK38ZS1mfTFSHfQBy8%2FPeer_Protocol_Process_-_Lender.png?alt=media&amp;token=608476d5-51b0-48df-a449-f7d15f338b06" alt=""><figcaption></figcaption></figure>


# Monthly Repayment Terminology

## **Peer Protocol’s Method**

***Peer Protocol*** utilize the loan amortization method to calculate all interest and principal payment. The loan is amortized daily, but the payment should be done every 20th day of the month.

***Annual percentage rate*** (APR) refers to the yearly interest generated by a sum charged to borrowers or paid to investors. APR is expressed as a percentage that represents the actual annual cost of funds over the term of a loan or income earned on an investment. This includes any fees or additional costs associated with the transaction but does not consider compounding.

As we calculate the APR for each day in a year (while taking into account of leap year), the **APR** are being divided by 365 days

$$
APR\_{daily} = APR/365
$$

**Where:**

***APRdaily = Daily Annual Percentage Rate***

***APR = Annual Percentage Rate***

## Daily ***Amortize Repayment Amount***

### Daily Repayment Calculation

This formula is to get the daily payment, where the total of the daily payment for the month will be paid on the 20th day of the month.

$$
Payment\_{daily} = Balance\_{opening}\*\dfrac{r(1+r)^n}{(1+r)^n-1}
$$

$$
Payment\_{daily} = Balance\_{open}\*\dfrac{APR\_{daily}(1+APR\_{daily})^n}{(1+APR\_{daily})^n-1}
$$

**Where:**

***Payment Daily = Daily Payment***

***Balance Beginning = Daily Opening Balance of the Loan***

***r = Daily Annual Percentage Rate***

***n = Total number of payments Left (period)***

### Monthly Sum Repayment

To obtain the monthly sum of repayment, the formula is:

$$
Payment\_{monthly} = \sum\_{1\le i\le n}Payment\_i
$$

**Where:**

**i = Days between day 1 of the period to the 20th day of the following month**

***Payment i = Daily payment for each day***

> **The sum of the Payment would be the total sum of money that the borrower has to pay on the 20th day of the month.**

***

## Example

***Let’s say Aldo is looking for a loan, with the following term:***

1. ***Loan Amount: USDT 1,000,000***
2. APR Offered: 8%
3. Loan Period: 2 Years
4. The Loan is offered on: 1st Jan 20x1
5. Repayment Schedule (part)
   1. On 20th Mar 20x1: USDT 25,319.58 (Fee Paid: USDT 216.54)
   2. On 20th Apr 20x1: USDT 39,465.32 (Fee Paid: USDT 324.64)
   3. On 20th May 20x1: USDT 38,448.38 (Fee Paid: USDT 301.37)

*Schedule Payment*

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2Foz108fDKS5tbUX1lfhxV%2FUntitled%206.png?alt=media&amp;token=1d3f80f0-b9c7-4270-8b20-8c187a726f8b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FTah0Ss5p2Tu0oKdgHLeF%2FUntitled%207.png?alt=media&amp;token=4c157ce2-9bbb-4df1-828a-e0d5d76ae0e6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FXZdSewHitGtjSgHK4DvJ%2FUntitled%208.png?alt=media&amp;token=b0a6ec44-4e22-45be-acae-7227f3e89f90" alt=""><figcaption></figcaption></figure>


# Roadmap

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2Fydqqv4p3zrsOHsYOMaMk%2Fimage.png?alt=media&amp;token=d63f4bb1-bac2-4f7c-814e-e550516580e7" alt=""><figcaption></figcaption></figure>

## Genesis Era - Q1 2023

* [x] Launch of Initial Development of Code
* [x] Whitepaper Established
* [x] Angel Round Funding - Kickoff
* [x] Regulatory Licensing Process - Started

## Compliance Era - Q2 2023

* [ ] Angel Round Funding - Closed
* [ ] Implementation of Compliance Framework&#x20;
* [ ] MVP Rollout

## TestNet Era - Q3 2023

* [ ] Early Whitelist Admission
* [ ] Smart Contract Testnet Deployment

## Launch Era - Q4 2023

* [ ] Smart Contract Audit & Penetration Test
* [ ] Mainnet Deployment
* [ ] Primary Product Financing Roll Out
  * Invoice Financing
  * Revolving Credit Option

## Market Era - Q1 2024

* [ ] Second Product Financing Roll Out
  * Trade Financing


# Risk Management and Compliance

## Risk Management and Compliance

## Pro-active Risk Management Regime

### Credit Risk

1. Credit Risk remains one of the significant concerns for any P2P lending platform, as we do not have the same level of credit analysis and risk management capabilities as traditional banks or other financial institutions which can be difficult to assess the creditworthiness of potential borrowers.
2. As a P2P lending platform, we would ensure that all loans provided to the business are being collateralized by existing Assets of the business. While the platform accepts 3 categories of assets:

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Category - 1</strong></td><td><p>Physical Assets</p><p>Land Title</p></td></tr><tr><td><strong>Category - 2</strong></td><td><p>Cash</p><p>Current Assets</p><p>Investment Assets (Market)</p></td></tr><tr><td><strong>Category - 3 (Cat-3)</strong></td><td><p>Digital Asset</p><p>Investment Assets (Private)</p></td></tr></tbody></table>

#### ***Peer Protocol’s Approach***

1. The fundamental of being an asset is a resource that is able to bring future economic value to the borrower, as such it can be sold to meet the defaulted loan.
2. Cat-1 assets are often physical assets such as property, plant and equipment or buildings, they would not retain their cost at their lifetime.
3. Cat-2 assets are classified as liquid assets that can be sold for cash immediately or investment holdings that are marketable on the public exchange.
4. Cat-3 assets are illiquid assets without an active market or Digital assets with high volatility.
5. All assets are evaluated through ***Collateral Coverage Ratio (CCR)***. **Peer Protocol** suggests that during the course of the financing term, the CCR for :
   1. Cat-1 Assets = 100% - 140%
   2. Cat-2 Assets = 100% - 120%
   3. Cat-3 Assets = ≤ 150% **(Can only be used to collateral against Working Capital Loan)**
6. But the ownership and possession of the collateral asset would still be held under the borrowers’ terms to continue its useful life in generating revenue for the borrowers to meet their repayment schedule.
7. The **CCR formula is as follows:**

   $$
   CCR = \dfrac{DCV}{TLV}
   $$

   *CCR = Collateral Coverage Ratio*

   *DCV = Discounted Cash Value of the asset/assets*

   *TLV = Total Loan Value*

   For DCV’s asset, the **Peer Protocol’s** analyst team would estimate the fair market value of the asset used to secure a loan, but due to the limit, the collateral would be discounted **30-50%** this is to ensure the collateral asset could cover the defaulted loan.

### Technology Risk

1. As part of being a technology company, Technological risk remains one of the top priorities for **Peer Protocol,** it is in the best interest of **Peer Protocol** to ensure that all technological risks are being mitigated.
2. In order to protect the reputation of ***Peer Protocol,*** We have implemented robust technology risk management processes and control that are also in compliance with the central bank guideline.

   #### **Peer Protocol’s Main Area of Concern**

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Cybersecurity Risk</strong></mark></td><td>Peer Protocol’s platforms may be vulnerable to cyber attacks, such as hacking, data breaches, and malware, which could compromise the security of the platform and the confidentiality of user data.</td></tr><tr><td><mark style="color:blue;"><strong>Smart Contract Vulnerabilities</strong></mark></td><td>There is a risk that the smart contract code may contain vulnerabilities that could be exploited by malicious actors. It is important to thoroughly test and audit the smart contract code to ensure that it is secure.</td></tr><tr><td><mark style="color:blue;"><strong>System failure</strong></mark></td><td>PeerHive’s platforms rely on complex systems and infrastructure to operate, and any failures or disruptions in these systems could impact the availability and performance of the platform.</td></tr></tbody></table>

### AML Risk

1. Anti-money laundering (AML) risk refers to the risk that a financial institution or other entity will be used to facilitate money laundering or other illicit financial activities.
2. This is also proved to be another hurdle as Cryptocurrencies can be highly anonymous and can be used to facilitate transactions that are difficult to trace or track, which can make cryptos attractive to criminals seeking to launder money or engage in other illicit activities.

   #### **Peer Protocol’s Approach**

   1. **Peer Protocol’s** approach is in line with Central Bank’s regulation, where we implement a holistic AML compliance program, including due diligence on our “Lenders” and “Borrower” through strict **KYC and KYB diligence checks** respectively.
   2. Such KYC and KYB investigations shed light on the anonymity of both parties while increasing transparency on their respective cryptocurrency transaction, which include but are not limited to their source of income and borrower business nature.
   3. While KYC and KYB analysis are crucial to the fundamental of **Peer Protocol’s** platform, pre-wallet check intensive KYT analysis for any prior fraudulent activity.
   4. **PeerHive** also believe that investing in a holistic AML procedure able to increase the efficiency of the platform by making it more cost-effective in the long-run, while maintaining clear and robust risk management guideline to prevent fraud and other financial criminal activities from happening.
   5. It is also in ***PeerHive’s*** best interest to ensure that <mark style="color:red;">**clear communication**</mark> with central banks and local law enforcement agencies to flag and report any potential transaction that may be related to any sort of financial crime.
   6. The cryptocurrency industry has been around for some time, but the unique anonymity of digital assets has posed unique risks and challenges for newcomers. It is essential to maintain regular communication with central banks in order to anticipate and <mark style="color:red;">**resolve potential issues with the system before they become systemic problems in the long term.**</mark>


# Debt Recovery Process

### Transparent Debt Recovery

PeerHive is committed to a transparent business model for all its issuers and lenders.

This is why we publish our Debt Recovery Process, which may be updated from time to time after consultation with a regulator, compliance experts, and law professionals.

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2F5Dc3w69zwwn0G6h9FbqE%2FPeer%20Protocol-Debt%20Recovery.drawio.png?alt=media&amp;token=bae1e6fc-d97f-4a38-8e88-7dd46da3a322" alt=""><figcaption></figcaption></figure>

### PeerHive's commitments

#### Performance-tied revenue

PeerHive does not charge an origination fee upfront to the issuer. Instead, the origination fee is reinvested back into the loan pool to increase exposure for the protocol.

If the loan pool defaults and the collateral is not recovered from the issuer, PeerHive stands to lose money, which increases confidence for lenders and incentivizes the platform to recover lender's loss on their behalf.

#### DAO-led negotiations

The DAO of the lender for the specific loan pool will establish the terms and conditions of the negotiation. This will reduce the possibility of collusion between the platform and the issuer.

PeerHive will only execute the terms and conditions if the DAO has conducted a majority vote. PeerHive will provide the best action plan and recovery advice from a legal and compliance perspective.

#### Clear and Open Communication

All committed lenders will be added to a secure forum where they can communicate and vote on loan-related matters with the issuer.

The Debt Recovery Task Force (DRTF) will take charge of the defaulted loan pool and keep the forum updated on the status of the recovery efforts; this will fall in-line with the debt recovery process we outline above.


# Secondary Exchange

## TBA


# Chain

## Chain

## We are using Polygon!

Potentially Multichain Operation

1. Cardano&#x20;
2. BNB

### Why?

1. **Interoperability**
   1. As mentioned in the fund and information flow, we utilised a master-child contract relationship. When the master contract is being enforced a number of the child contracts are connected to the master contract, this is to ensure that all contracts are being protected and all loan repayment is being repaid according to the child contract amounts.
   2. Sometimes the number for a child contract could go up to 30-100 contracts relating to a single master contract, poor limitation of contract could affect the scalability and the interoperability of the platform to address the great demand for healthy interest rates in the crypto market.
   3. The average polygon transaction lasted around 2.1 seconds, going through the master-child contract relationship the earliest for both parties to receive cryptos would take up to 2 block transactions at most of 5 seconds.
2. **Flexibility**
   1. Given that the Polygon chain is a layer 2 chain for Ethereum, Polygon gives us the flexibility to accept multiple ETH-native stablecoins, this allows our borrowers with multiple ETH-native stablecoins to join the cause and provide P2P financing options.
3. **Cheap**
   1. Due to the fundamentals of the contract relationship, we require the chain to have a low gas fee. When compared the 1 Gwei = USD 0.000001.
   2. We would see a historical median of gas fee for polygon at the bound of 100 - 250 Gwei (but depending on the complexity of the smart contract) which equates to around USD 0.0001 - USD 0.00025.

<figure><img src="https://1125066014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKZ1x53rs0AgHNc04QzwJ%2Fuploads%2FsdQURDF69kXCcnQmDQay%2FScreenshot_2023-01-11_at_11.22.24_AM.png?alt=media&amp;token=1586e4c9-7be6-43be-b270-930923f90164" alt=""><figcaption></figcaption></figure>

### We also take notes of it’s cons.

1. **Ethereum layer 2 chain**
   1. Given the nature of the Polygon chain as a layer 2 chain for Ethereum, it is highly dependent on the Eth ecosystem.
   2. At the same time, this level of dependency also allows us to take on the Polygon chain as our MVP chain, as it allows us to scale faster while allowing a high number of stablecoins to bring on board.
2. **Competitions from other blockchains**
   1. In the short-term, Polygon will continue to see tremendous competition from other blockchains such as Solana, Cardano, and even Binance Blockchain.
   2. Though from the perspective of **Peer Hive**, healthy competition between blockchains will drive the innovation process and the scalability of each individual native chain. In the end the greatest beneficiary of this competition process would be the end-user and the community of the blockchain.

**Ultimately, Polygon would be the starting point for Peer Hive but not the endpoint as we don’t have any interest (at the moment) to create a separate chain to host the protocol.**

Our current mission as Peer Hive would be stabilizing the current crypto ecosystem, this means it is in our best interest to provide multi-chain support for all our lenders in order to pool as many stable coins to our protocol and provide real financing needs to our borrowers.


# Introduction

The <mark style="color:red;">**`PeerProtocol`**</mark> contract is a smart contract that allows borrowers to request loans from the contract and allows the contract owner to approve or reject these loan requests. It also allows borrowers to make payments towards their outstanding loan balances and allows the contract owner to update the default status of a borrower if they fail to make timely payments.

This contract was built using the Solidity programming language and is designed to be deployed on the Ethereum blockchain. It makes use of several common Ethereum patterns and features, such as function modifiers, require statements, and mappings, in order to implement its functionality.

Overall, the purpose of this contract is to provide a decentralized, transparent, and secure way for borrowers and lenders to interact and manage loans using stablecoins. It allows borrowers to access loans quickly and easily and allows lenders to manage their lending portfolio and assess the creditworthiness of potential borrowers.

I hope this introduction is helpful and gives you a better understanding of the <mark style="color:red;">**`PeerProtocol`**</mark> contract. Let me know if you have any further questions.

The contract has a number of variables that store information about the loans and borrowers, including the outstanding loan balances, default status, and various loan terms such as the lending rate, interest rate, and loan period. It also has several functions for interacting with the contract, such as:

## <mark style="color:red;">**`constructor`**</mark>

```solidity
constructor() public {
    owner = msg.sender;
}
```

This is the constructor function for the contract, which is called when the contract is deployed to the Ethereum network. It initializes the contract and sets the **`owner`** variable to the address of the contract deployer.

## <mark style="color:red;">**`approveLending`**</mark>

```solidity
function approveLending(address borrower, uint amount) public onlyOwner {
    require(amount > 0, "Must approve a positive amount of stable coins for lending");
    require(loanAmount >= amount, "Not enough stable coins available for lending");
    balances[borrower] += amount;
    loanAmount -= amount;
}
```

This function allows the contract owner to approve a request for a loan. It takes an **`address`** parameter representing the borrower, and a **`uint`** parameter representing the amount of stable coins to be lent. It updates the **`balances`** mapping to reflect the new loan, and reduces the **`loanAmount`** variable by the amount of the loan.

## <mark style="color:red;">**`repayEarly`**</mark>

```solidity
function repayEarly(address borrower) public {
    require(balances[borrower] > 0, "No outstanding balance to repay");
    uint balance = balances[borrower];
    uint interest = balance.mul(interestRate / 100);
    uint totalDue = balance.add(interest);
    totalDue = totalDue.mul((100 - earlyRepaymentDiscount) / 100);
    balances[borrower] = 0;
    loanAmount += totalDue;
}
```

This function first checks that the borrower has an outstanding **`balance`** to repay, and then calculates the<mark style="color:red;">`totalDue`</mark> by adding the <mark style="color:red;">**`interest`**</mark> to the <mark style="color:red;">**`balance`**</mark>. It then applies the <mark style="color:red;">**`earlyRepaymentDiscount`**</mark> , if applicable, by multiplying the <mark style="color:red;">**`totalDue`**</mark> by a percentage that is equal to 100 minus the <mark style="color:red;">**`earlyRepaymentDiscount`**</mark>. Finally, it sets the borrower's balance to 0 and adds the <mark style="color:red;">**`totalDue`**</mark> to the <mark style="color:red;">**`loanAmount`**</mark>.


# Contact Us

### Find Us

Website

{% embed url="<https://peerhive.app>" %}

### Social Media

[**Linkedin** ](https://www.linkedin.com/company/peerhivesg)

### Reach us at

[info@peerhive.app ](mailto:info@peerhive.app)

<tech@peerhive.app>


