Developers
  • Introduction
  • QTokens
    • Transfer
    • Total Supply
    • Underlying Balance
    • Exchange Rate
    • Get Cash
    • Total Borrow
    • Borrow Balance
    • Borrow Rate
    • Supply Rate
    • Total Reserve
    • Reserve Factor
    • Key Events
  • Qore
    • Market List
    • Enter Markets
    • Exit Markets
    • Get Markets In
    • Supply
    • Redeem with QToken
    • Redeem with Underlying
    • Borrow
    • Repay Borrow
    • Repay Borrow Behalf
    • Liquidate Borrow
    • Get Account Liquidity
    • Market Information
    • Close Factor
    • Liquidation Incentive
    • Qubit Distribution Speeds
    • Pending Qubit (or Accrued Qubit)
    • Claim Qubit
    • Key Events
  • Qubit Locker
    • qScore
    • Total qScore
    • Deposit
    • Locked Balance
    • Locked Period
    • Extend Lock Period
    • Unlocked Balance
    • Withdraw
Powered by GitBook
On this page
  • Qore
  • Solidity
  • Ethers.js

Was this helpful?

  1. Qore

Repay Borrow Behalf

PreviousRepay BorrowNextLiquidate Borrow

Last updated 3 years ago

Was this helpful?

The repay function transfers an asset into the protocol, reducing the target user's borrow balance.

Qore

function repayBorrowBehalf(address qToken, address borrower, uint amount) external payable;
  • msg.sender: The account which shall repay the borrow.

  • msg.value: (BNB only) The amount of BNB to be repaid, in wei.

  • qToken: The address of the qToken market to repay.

  • borrower: The account which borrowed the asset to be repaid.

  • amount: The amount of the underlying borrowed asset to be repaid. A value of -1 (i.e. 2256−12^{256} -1 2256−1) can be used to repay the full amount only if not BNB.

Solidity

// BNB
Qore qore = Qore(<qoreAddress>);
qore.repayBorrowBehalf{ value: <underlyingAmount> }(<qBNBAddress>, <borrower>, <underlyingAmount>);

// Others
Qore qore = Qore(<qoreAddress>);
qore.repayBorrowBehalf(<qTokenAddress>, <borrower>, <underlyingAmount>);

Ethers.js

// BNB
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
await qore.repayBorrowBehalf(<qBNBAddress>, <borrower>, <underlyingAmount>, { value: <underlyingAmount> });

// Others
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
await qore.repayBorrowBehalf(<qTokenAddress>, <borrower>, <underlyingAmount>);