📜
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

Repay

  • In order to repay the loan, User has to have some assets borrowed.

  • User can make a request to the Repay method with the SRWA User Badge and the bucket of assets that the User wants repaid.

  • Protocol will calculate how much of the loan is repaid, if the amount that the User sent is less then it's owed, borrow balance will be decreased for that amount, if it's more than it's owed, loan will be paid in full and the rest will be transferred back to the Users wallet.

  • Protocol will then 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 deposit balance in SRWA User Badge and transfer repaid assets to the Pool and the change if any, to the Users wallet.

Repayment is the simplest operation in terms that it can be done at any time, by sending any amount of assets. It only takes into account the current borrow balance of the user and the amount that is sent. When the protocol the gets repayment request, it checks how much the user owes, and if the repay amount is bigger then the debt, it erases it and returns the change to the users wallet, if it's smaller, it subtracts the said amount from the debt.

PreviousWithdrawNextLiquidate