WithdrawFrom

Compound V3 Action Plugin - WithdrawFrom

Description

The withdraw method is used to withdraw collateral that is not currently supporting an open borrow. Withdraw is also used to borrow the base asset from the protocol if the account has supplied sufficient collateral. It can also be called from an allowed manager address.

With withdrawFrom method user can set src and to address

Method

withdrawFrom(address, address, address, uint256)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Comet address

Method Parameters

NamePlugin TypeDescription

src

FctAddress

The address of the account to withdraw or borrow on behalf of.

to

FctAddress

The address to send the withdrawn or borrowed asset.

asset

FctAddress

The address of the asset that is being withdrawn or borrowed in the transaction.

amount

FctValue

The amount of the asset to withdraw or borrow.

Returned Values

No returned values

Example

Example with initParams

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

Example without initParams

const withdrawFrom = new CompoundV3.actions.WithdrawFrom({ chainId: 1 })

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

Learn more

Learn more about Compound V3 withdraw method here

Last updated