📜
SRWA Documentation
SRWA.ioDemoGitHub
  • Getting Started
    • Overview
      • Components
        • Lending Protocol
        • Lending Pool
        • SRWA Badge
      • Other
        • Oracle
        • Admin
    • How It Works
      • Risk Management
      • Deposit
      • Borrow
      • Withdraw
      • Repay
      • Liquidate
  • Core Calculations
    • Utilization
    • APR
    • SB and SD Tokens
    • Interests
    • Available Liquidity
    • Collateral
    • Protocol Reserve
  • SRWA Interface
    • About
    • Requirements
    • How to Use
      • Lending
        • Lending Account
        • Savings and Loans
        • Deposit
        • Withdraw
        • Borrow
        • Repay
      • Market
      • Tools
        • Transactions
        • Wallet
Powered by GitBook
On this page
  1. Getting Started
  2. How It Works

Borrow

  • In order for user to borrow some assets form the Protocol, User can make a request to the Borrow method with the SRWA User Badge and the amount of assets that the User wants borrowed.

  • Protocol will first verify if the borrows for that particular pool are locked. If the borrowing is allowed, next thing the Protocol will verify is if there is enough liquidity in the Pool for the loan. If borrowing is not locked and the Pool has liquidity, Protocol will then verify if the user has enough collateral for the amount that they want to borrow as well as if the Users loan will exceed maximal borrow percent for that particular Pool.

  • If all validations are passed, Protocol will calculate the price of the SB Token, Users accrued interest if there's any, total borrow balance of SB Token and the asset and Users balance in SB Token. After that, Protocol will update Protocol borrow balance and Users borrow balance in SRWA User Badge and transfer borrowed assets to the Users wallet.

Borrowing operation is a little bit more complicated because there are multiple conditions that need to be met in order for it to be successful. User can send the request for the asset and amount that he wants borrowed along with the SRWA User Badge. The Protocol first needs to verify that it has enough available liquidity in order for the loan to go through. Available liquidity for the given pool is calculated by the following formula:

total_deposit - reserve_balance - total_deposit * pool_reserve - total_borrow;

If here is a sufficient liquidity for the requested loan, next verification is if the User has enough collateral. User has to have some assets deposited in order to take a loan, so the user collateral is sum of all deposits multiplied with LTV Ratio minus sum of all loans.

One more thing that is being taken into account when borrowing and that is max borrow percent. Max borrow percent is the pool setting that the admins can change in order to protect the pool from being dried out by one user. So, max borrow percent is the percentage of the pools deposit that one user can borrow: max_borrow_percent = pool_deposit * pool_max_borrow_percent

PreviousDepositNextWithdraw