RepayBorrowERC20

Compound V2 Action Plugin - RepayBorrowERC20

Description

The repay function transfers an asset into the protocol, reducing the user’s borrow balance.

Method

repayBorrow(uint256)

Input Parameters

NamePlugin TypeSolidity TypeDescription

to

FctAddress

address

cToken address, except cETH

Method Parameters

NamePlugin TypeSolidity TypeDescription

repayAmount

FctValue

uint256

Amount to repay

Returned Values

NamePlugin TypeSolidity TypeDescription

result

FctValue

uint256

If result is 0 - success

Example

Example with initParams

const repayBorrowERC20 = new CompoundV2.actions.RepayBorrowERC20({
   chainId: 1,
   initParams: {
     to: "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC
     methodParams: {
       repayAmount: "100000"
     }
   }
})

Example without initParams

const repayBorrowERC20 = new CompoundV2.actions.RepayBorrowERC20({ chainId: 1 })

repayBorrowERC20.input.set({
     to: "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC
     methodParams: {
       repayAmount: "100000"
     }
})

Learn more

Learn more about Compound V2 repayBorrow method here

Last updated