Repay Borrow
The repay function transfers an asset into the protocol, reducing the user's borrow balance.
function repayBorrow(address qToken, uint amount) external payable;
- msg.sender: The account which borrowed the asset, and 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.
- amount: The amount of the underlying borrowed asset to be repaid. A value of -1 (i.e) can be used to repay the full amount only if not BNB.
// BNB
Qore qore = Qore(<qoreAddress>);
qore.repayBorrow{ value: <underlyingAmount> }(<qBNBAddress>, <underlyingAmount>);
// Others
Qore qore = Qore(<qoreAddress>);
qore.repayBorrow(<qTokenAddress>, <underlyingAmount>);
// BNB
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
await qore.repayBorrow(<qBNBAddress>, <underlyingAmount>, { value: <underlyingAmount> });
// Others
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
await qore.repayBorrow(<qTokenAddress>, <underlyingAmount>);
Last modified 2yr ago