Benqi - Avalanche

Lending & Borrowing. Benqi-v1 connector on avalanche triggers methods like depositRaw, deposit, withdrawRaw, withdraw, borrowRaw, borrow, paybackRaw, payback, depositQiTokenRaw, depositQiToken, withdrawQiTokenRaw, withdrawQiToken, liquidateRaw, liquidate. You can view details like source code, ABIs on Snowtrace.

  • Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee to indicate AVAX.
  • use -1 or dsa.maxValue for the maximum amount in function.
  • If not sure about the arguments getId and setId, pass 0.

DepositRaw

Deposit a token to Benqi for lending / collaterization.

spells.add({  connector: "BENQI-A",  method: "depositRaw",  args: [token, qiToken, amt, getId, setId]});
Parameter Type Description
token address The address of the token to deposit. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiToken address The address of the corresponding qiToken.
amt uint256 The amount of the token to deposit. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens deposited.

Deposit

Deposit a token to Benqi for lending / collaterization.

spells.add({  connector: "BENQI-A",  method: "deposit",  args: [tokenId, amt, getId, setId]});
Parameter Type Description
tokenId string The token id of the token to deposit.(For eg: AVAX-A)
amt uint256 The amount of the token to deposit. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens deposited.

WithdrawRaw

Withdraw deposited token from Benqi

spells.add({  connector: "BENQI-A",  method: "withdrawRaw",  args: [token, qiToken, amt, getId, setId]});
Parameter Type Description
token address The address of the token to withdraw. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiToken address The address of the corresponding qiToken.
amt uint256 The amount of the token to withdraw. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens withdrawn.

Withdraw

Withdraw deposited token from Benqi

spells.add({  connector: "BENQI-A",  method: "withdraw",  args: [tokenId, amt, getId, setId]});
Parameter Type Description
tokenId string The token id of the token to withdraw.(For eg: AVAX-A)
amt uint256 The amount of the token to withdraw. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens withdrawn.

BorrowRaw

Borrow a token using Benqi

spells.add({  connector: "BENQI-A",  method: "borrowRaw",  args: [token, qiToken, amt, getId, setId]});
Parameter Type Description
token address The address of the token to borrow. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiToken address The address of the corresponding qiToken.
amt uint256 The amount of the token to borrow.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens borrowed.

Borrow

Borrow a token using Benqi

spells.add({  connector: "BENQI-A",  method: "borrow",  args: [tokenId, amt, getId, setId]});
Parameter Type Description
tokenId string The token id of the token to borrow.(For eg: DAI-A)
amt uint256 The amount of the token to borrow.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens borrowed.

PaybackRaw

Payback debt owed.

spells.add({  connector: "BENQI-A",  method: "paybackRaw",  args: [token, qiToken, amt, getId, setId]});
Parameter Type Description
token address The address of the token to payback. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiToken address The address of the corresponding qiToken.
amt uint256 The amount of the token to payback. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens paid back.

Payback

Payback debt owed.

spells.add({  connector: "BENQI-A",  method: "payback",  args: [tokenId, amt, getId, setId]});
Parameter Type Description
tokenId string The token id of the token to payback.(For eg: BENQI-A)
amt uint256 The amount of the token to payback. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens paid back.

DepositQiTokenRaw

Same as depositRaw. The only difference is this method stores qiToken amount in set ID.

spells.add({  connector: "BENQI-A",  method: "depositQiTokenRaw",  args: [token, qiToken, amt, getId, setId]});
Parameter Type Description
token address The address of the token to deposit. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiToken address The address of the corresponding qiToken.
amt uint256 The amount of the token to deposit. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of qiTokens received.

DepositQiToken

Same as deposit. The only difference is this method stores qiToken amount in set ID.

spells.add({  connector: "BENQI-A",  method: "depositQiToken",  args: [tokenId, amt, getId, setId]});
Parameter Type Description
tokenId string The token id of the token to depositQiToken.(For eg: DAI-A)
amt uint256 The amount of the token to deposit. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of qiTokens received.

WithdrawQiTokenRaw

Same as withdrawRaw. The only difference is this method fetch qiToken amount in get ID.

spells.add({  connector: "BENQI-A",  method: "withdrawQiTokenRaw",  args: [token, qiToken, qiTokenAmt, getId, setId]});
Parameter Type Description
token address The address of the token to withdraw. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiToken address The address of the corresponding qiToken.
qiTokenAmt uint The amount of qiTokens to withdraw
getId uint ID to retrieve qiTokenAmt
setId uint ID stores the amount of tokens withdrawn.

WithdrawQiToken

Same as withdraw. The only difference is this method fetch qiToken amount in get ID.

spells.add({  connector: "BENQI-A",  method: "withdrawQiToken",  args: [tokenId, qiTokenAmt, getId, setId]});
Parameter Type Description
tokenId string The token id of the token to withdraw QiToken.(For eg: AVAX-A)
qiTokenAmt uint The amount of qiTokens to withdraw
getId uint ID to retrieve qiTokenAmt
setId uint ID stores the amount of tokens withdrawn.

LiquidateRaw

Liquidate a position.

spells.add({  connector: "BENQI-A",  method: "liquidateRaw",  args: [borrower, tokenToPay, qiTokenPay, tokenInReturn, qiTokenColl, amt, getId, setId]});
Parameter Type Description
borrower address Borrower's Address.
tokenToPay address The address of the token to pay for liquidation.(For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
qiTokenPay address Corresponding qiToken address.
tokenInReturn address The address of the token to return for liquidation.
qiTokenColl address Corresponding qiToken address.
amt uint256 The token amount to pay for liquidation.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of paid for liquidation.

Liquidate

Liquidate a position using the mapping.

spells.add({  connector: "BENQI-A",  method: "liquidate",  args: [borrower, tokenIdToPay, tokenIdInReturn, amt, getId, setId]});
Parameter Type Description
borrower address Borrower's Address.
tokenIdToPay string token id of the token to pay for liquidation.(For eg: AVAX-A)
tokenIdInReturn string token id of the token to return for liquidation.(For eg: USDC-A)
amt uint256 token amount to pay for liquidation.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of paid for liquidation.

If you still can't find something you're looking for or have any questions, ask them at our developers community on Discord or simply send an Email.


Our team is excited about assisting you to build an application using Instadapp Developer Platform. Your questions and feedback help us make a better development environment for future developers.