MintERC20

Compound V2 Action Plugin - MintERC20

Description

The mint function transfers an asset into the protocol, which begins accumulating interest based on the current Supply Rate for the asset. The user receives a quantity of cTokens equal to the underlying tokens supplied, divided by the current Exchange Rate

Method

mint(uint256)

Input Parameters

NamePlugin TypeSolidity TypeDescription

to

FctAddress

address

cToken address Note: do not use cETH with this plugin

Method Parameters

NamePlugin TypeSolidity TypeDescription

mintAmount

FctValue

uint256

Amount to mint

Returned Values

NamePlugin TypeSolidity TypeDescription

result

FctValue

uint256

If result is 0 - success

Example

Example with initParams

const mintERC20 = new CompoundV2.actions.MintERC20({
   chainId: 1,
   initParams: {
     to: "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC
     methodParams: {
       borrowAmount: "100000"
     }
   }
})

Example without initParams

const mintERC20 = new CompoundV2.actions.MintERC20({ chainId: 1 })

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

Learn more

Learn more about Compound V2 deposit/mint ERC20 method here

Last updated