Compound.

Lending & Borrowing

Compound-v1 connector triggers methods like depositRaw, deposit, withdrawRaw, withdraw, borrowRaw, borrow, paybackRaw, payback, depositCTokenRaw, depositCToken, withdrawCTokenRaw, withdrawCToken, liquidateRaw, liquidate. You can view details like source code, ABIs on Etherscan.

  • Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee to indicate ETH.
  • 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 Compound for lending / collaterization.

spells.add({
  connector: "COMPOUND-A",
  method: "depositRaw",
  args: [token, cToken, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to deposit. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cToken address The address of the corresponding cToken.
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 Compound for lending / collaterization.

spells.add({
  connector: "COMPOUND-A",
  method: "deposit",
  args: [tokenId, amt, getId, setId]
});
Parameter Type Description
tokenId string The token id of the token to deposit.(For eg: ETH-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 Compound

spells.add({
  connector: "COMPOUND-A",
  method: "withdrawRaw",
  args: [token, cToken, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cToken address The address of the corresponding cToken.
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 Compound

spells.add({
  connector: "COMPOUND-A",
  method: "withdraw",
  args: [tokenId, amt, getId, setId]
});
Parameter Type Description
tokenId string The token id of the token to withdraw.(For eg: ETH-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 Compound

spells.add({
  connector: "COMPOUND-A",
  method: "borrowRaw",
  args: [token, cToken, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to borrow. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cToken address The address of the corresponding cToken.
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 Compound

spells.add({
  connector: "COMPOUND-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: "COMPOUND-A",
  method: "paybackRaw",
  args: [token, cToken, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to payback. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cToken address The address of the corresponding cToken.
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: "COMPOUND-A",
  method: "payback",
  args: [tokenId, amt, getId, setId]
});
Parameter Type Description
tokenId string The token id of the token to payback.(For eg: COMP-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.

DepositCTokenRaw

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

spells.add({
  connector: "COMPOUND-A",
  method: "depositCTokenRaw",
  args: [token, cToken, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to deposit. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cToken address The address of the corresponding cToken.
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 cTokens received.

DepositCToken

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

spells.add({
  connector: "COMPOUND-A",
  method: "depositCToken",
  args: [tokenId, amt, getId, setId]
});
Parameter Type Description
tokenId string The token id of the token to depositCToken.(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 cTokens received.

WithdrawCTokenRaw

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

spells.add({
  connector: "COMPOUND-A",
  method: "withdrawCTokenRaw",
  args: [token, cToken, cTokenAmt, getId, setId]
});
Parameter Type Description
token address The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cToken address The address of the corresponding cToken.
cTokenAmt uint The amount of cTokens to withdraw
getId uint ID to retrieve cTokenAmt
setId uint ID stores the amount of tokens withdrawn.

WithdrawCToken

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

spells.add({
  connector: "COMPOUND-A",
  method: "withdrawCToken",
  args: [tokenId, cTokenAmt, getId, setId]
});
Parameter Type Description
tokenId string The token id of the token to withdraw CToken.(For eg: ETH-A)
cTokenAmt uint The amount of cTokens to withdraw
getId uint ID to retrieve cTokenAmt
setId uint ID stores the amount of tokens withdrawn.

LiquidateRaw

Liquidate a position.

spells.add({
  connector: "COMPOUND-A",
  method: "liquidateRaw",
  args: [borrower, tokenToPay, cTokenPay, tokenInReturn, cTokenColl, amt, getId, setId]
});
Parameter Type Description
borrower address Borrower's Address.
tokenToPay address The address of the token to pay for liquidation.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
cTokenPay address Corresponding cToken address.
tokenInReturn address The address of the token to return for liquidation.
cTokenColl address Corresponding cToken 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: "COMPOUND-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: ETH-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.