SupplyFrom

Compound V3 Action Plugin - SupplyFrom

Description

The supply function transfers an asset to the protocol and adds it to the account’s balance. This function can be used to supply collateral, supply the base asset, or repay an open borrow of the base asset.

With supplyFrom method user can set from and destination address

Method

supplyFrom(address, address, address, uint256)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Comet address

Method Parameters

NamePlugin TypeDescription

from

FctAddress

The address to supply from.

destination

FctAddress

The address that is credited with the supplied asset within the protocol.

asset

FctAddress

The address of the asset’s smart contract.

amount

FctValue

The amount of the asset to supply to Compound III expressed as an integer.

Returned Values

No returned values

Example

Example with initParams

const supplyFrom = new CompoundV3.actions.SupplyFrom({
   chainId: 1,
   initParams: {
     to: "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // cUSDCv3
     methodParams: {
       from: "0x...",
       destination: "0x...",
       asset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
       amount: "10000000"
     }
   }
})

Example without initParams

const supplyFrom = new CompoundV3.actions.SupplyFrom({ chainId: 1 })

supplyFrom.input.set({
   to: "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // cUSDCv3
   methodParams: {
     from: "0x...",
     destination: "0x...",
     asset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
     amount: "10000000"
   }
})

Learn more

Learn more about Compound V3 supply method here

Last updated