> For the complete documentation index, see [llms.txt](https://docs.mound.finance/qubit-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mound.finance/qubit-developers/qore/repay-borrow-behalf.md).

# Repay Borrow Behalf

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

### Qore

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

### Solidity

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

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

### Ethers.js

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