WithdrawTo

Compound V3 Action Plugin - WithdrawTo

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 withdrawTo method user can set to address

Method

withdrawTo(address, address, uint256)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Comet address

Method Parameters

NamePlugin TypeDescription

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 withdrawTo = new CompoundV3.actions.WithdrawTo({
   chainId: 1,
   initParams: {
     to: "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // cUSDCv3
     methodParams: {
       to: "0x...",
       asset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
       amount: "10000000"
     }
   }
})

Example without initParams

const withdrawTo = new CompoundV3.actions.WithdrawTo({ chainId: 1 })

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

Learn more

Learn more about Compound V3 withdraw method here

Last updated