Compound-III

Lending & Borrowing.

CompoundV3-v1.0 connector triggers methods like deposit, depositOnBehalf, depositFromUsingManager, withdraw, withdrawTo, withdrawOnBehalf, withdrawOnBehalfAndTransfer, borrow, borrowTo, borrowOnBehalf, borrowOnBehalfAndTransfer, payback, paybackOnBehalf, paybackFromUsingManager, buyCollateral, transferAsset, transferAssetOnBehalf, toggleAccountManager, toggleAccountManagerWithPermit. 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.

Deposit

Deposit a token to Compound for lending / collaterization.

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

DepositOnBehalf

Deposit a token to Compound for lending / collaterization on behalf of 'to'.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "depositOnBehalf",
  args: [market, token, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be supplied. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE).
to address The address on behalf of which the supply is made.
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.

DepositFromUsingManager

Deposit a token to Compound for lending / collaterization from a address and update the position of 'to'.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "depositFromUsingManager",
  args: [market, token, from, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be supplied. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
from address The address from where amount is to be supplied.
to address The address on account of which the supply is made or whose positions are updated.
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.

Withdraw

Withdraw base token or deposited token from Compound.

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

WithdrawTo

Withdraw base token or deposited token from Compound on behalf of an address and transfer to 'to'.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "withdrawTo",
  args: [market, token, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be withdrawn. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
to address The address to which the borrowed assets are to be transferred.
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.

WithdrawOnBehalf

Withdraw base token or deposited token from Compound from an address and transfer to DSA.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "withdrawOnBehalf",
  args: [market, token, from, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be withdrawn. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
from address The address from where asset is to be withdrawed.
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.

WithdrawOnBehalfAndTransfer

Withdraw base token or deposited token from Compound from an address and transfer to 'to'.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "withdrawOnBehalfAndTransfer",
  args: [market, token, from, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be withdrawn. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
from address The address from where asset is to be withdrawed.
to address The address to which the borrowed assets are to be transferred.
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.

Borrow

Borrow base token from Compound.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "borrow",
  args: [market, token, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be borrowed. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amt uint256 The amount of base token to borrow.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens borrowed.

BorrowTo

Borrow base token from Compound on behalf of an address.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "borrowTo",
  args: [market, token, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be borrowed. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
to address The address to which the borrowed asset is transferred.
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 borrowed.

BorrowOnBehalf

Borrow base token or deposited token from Compound.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "borrowOnBehalf",
  args: [market, token, from, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be borrowed. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
from address The address from where asset is to be withdrawed.
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 borrowed.

BorrowOnBehalfAndTransfer

Borrow base token or deposited token from Compound.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "borrowOnBehalfAndTransfer",
  args: [market, token, from, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be borrowed. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
from address The address from where asset is to be withdrawed.
to address The address to which the borrowed assets are to be transferred.
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 borrowed.

Payback

Repays the borrow of the base asset.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "payback",
  args: [market, token, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be repaid. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amt uint256 The amount to be repaid.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens repaid.

PaybackOnBehalf

Repays borrow of the base asset on behalf of 'to'.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "paybackOnBehalf",
  args: [market, token, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be repaid. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
to address The address on behalf of which the borrow is to be repaid.
amt uint256 The amount to be repaid.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens repaid.

PaybackFromUsingManager

Repays borrow of the base asset on behalf of 'to'. 'From' address must approve the comet market.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "paybackFromUsingManager",
  args: [market, token, from, to, amt, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The address of the token to be repaid. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
from address The address from which the borrow has to be repaid on behalf of 'to'.
to address The address on behalf of which the borrow is to be repaid.
amt uint256 The amount to be repaid.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens repaid.

BuyCollateral

Buy collateral asset to increase protocol base reserves until targetReserves is reached.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "buyCollateral",
  args: [market, sellToken, buyAsset, unitAmt, baseSellAmt, getId, setId]
});
Parameter Type Description
market address The address of the market from where to withdraw.
sellToken address base token. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
buyAsset address The collateral asset to purachase. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
unitAmt uint256 Minimum amount of collateral expected to be received.
baseSellAmt uint256 Amount of base asset to be sold for collateral.
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of base tokens sold.

TransferAsset

Transfer base/collateral asset to dest address from caller's account.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "transferAsset",
  args: [market, token, dest, amount, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The collateral asset to transfer to dest address.
dest address The account where to transfer the base assets.
amount uint256 The amount of the collateral token to transfer. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens transferred.

TransferAssetOnBehalf

Transfer collateral asset to dest address from src's account.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "transferAssetOnBehalf",
  args: [market, token, src, dest, amount, getId, setId]
});
Parameter Type Description
market address The address of the market.
token address The collateral asset to transfer to dest address.
src address The account from where to transfer the collaterals.
dest address The account where to transfer the collateral assets.
amount uint256 The amount of the collateral token to transfer. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens transferred.

ToggleAccountManager

Authorize/Remove managers to perform write operations for the position.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "toggleAccountManager",
  args: [market, manager, isAllowed]
});
Parameter Type Description
market address The address of the market where to supply.
manager address The address to be authorized.
isAllowed bool Whether to allow or disallow the manager.

ToggleAccountManagerWithPermit

Authorize/Remove managers to perform write operations for owner's position.

spells.add({
  connector: "COMPOUND-V3-A",
  method: "toggleAccountManagerWithPermit",
  args: [market, owner, manager, isAllowed, nonce, expiry, v, r, s]
});
Parameter Type Description
market address The address of the market where to supply.
owner address The authorizind owner account.
manager address The address to be authorized.
isAllowed bool Whether to allow or disallow the manager.
nonce uint256 Signer's nonce.
expiry uint256 The duration for which to permit the manager.
v uint8 Recovery byte of the signature.
r bytes32 Half of the ECDSA signature pair.
s bytes32 Half of the ECDSA signature pair.

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.