Compound

Lending & Borrowing

Compound connector triggers methods like deposit, borrow, withdraw, payback, and more. You can view details like source code, ABIs on Etherscan.

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

Deposit

Lend / Collateralize tokens.

spells.add({
  connector: "compound",
  method: "deposit",
  args: [token, amount, getId, setId]
});
ParameterTypeDescription
tokenaddressThe token address to deposit.
amountnumberThe amount of tokens to deposit. Use -1 to deposit 100%.
getIdnumberID fetches the amount of token to deposit.
setIdnumberID stores the amount of token deposited.

Withdraw

Withdraw tokens.

spells.add({
  connector: "compound",
  method: "withdraw",
  args: [token, amount, getId, setId]
});
ParameterTypeDescription
tokenaddressThe token address to withdraw.
amountnumberThe amount of tokens to withdraw. Use -1 to withdraw 100%.
getIdnumberID fetches the amount of token to withdraw.
setIdnumberID stores the amount of token withdrawn.

Borrow

Borrow tokens.

spells.add({
  connector: "compound",
  method: "borrow",
  args: [token, amount, getId, setId]
});
ParameterTypeDescription
tokenaddressThe token address to borrow.
amountnumberThe amount of tokens to borrow.
getIdnumberID fetches the amount of token to borrow.
setIdnumberID stores the amount of token borrowed.

Payback

Payback debt.

spells.add({
  connector: "compound",
  method: "payback",
  args: [token, amount, getId, setId]
});
ParameterTypeDescription
tokenaddressThe token address to payback.
amountnumberThe amount of tokens to payback. Use -1 to payback 100%.
getIdnumberID fetches the amount of token to payback.
setIdnumberID stores the amount of token paid back.

Liquidate

Liquidate a position.

spells.add({
  connector: "compound",
  method: "liquidate",
  args: [borrower, tokenToPay, tokenInReturn, amount, getId, setId]
});
ParameterTypeDescription
borroweraddressBorrower's Address.
tokenToPayaddressToken Address to pay for liquidation.
tokenInReturnaddressToken Address to return on liquidation.
amountnumberThe amount of tokens to payback. Use -1 to payback 100%.
getIdnumberID fetches the amount of token to payback.
setIdnumberID stores the amount of token paid back.

Extra Functions

Deposit ctoken

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

spells.add({
  connector: "compound",
  method: "depositCToken",
  args: [token, amount, getId, setId]
});
ParameterTypeDescription
tokenaddressThe token address to deposit.
amountnumberThe amount of tokens to deposit. Use -1 to deposit 100%.
getIdnumberID fetches the amount of token to deposit.
setIdnumberID stores the amount of ctoken minted.

Withdraw ctoken

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

spells.add({
  connector: "compound",
  method: "withdrawCToken",
  args: [token, amount, getId, setId]
});
ParameterTypeDescription
tokenaddressThe token address to withdraw.
amountnumberThe amount of ctokens to withdraw. Use -1 to withdraw 100%.
getIdnumberID fetches the amount of ctoken to withdraw.
setIdnumberID stores the amount of token withdrawn.

If you still can't find something you're looking for or have any questions, ask them at our developers community on Telegram, 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.

Best way to stay connected with our progress.