Comment on page

Repay Borrow Behalf

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


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.
    225612^{256} -1
    ) can be used to repay the full amount only if not BNB.


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


// 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>);