CollateralBalanceOf

Compound V3 Getter Plugin - CollateralBalanceOf

Description

This function returns the current balance of a collateral asset for a specified account in the protocol.

Method

collateralBalanceOf(address, address)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Comet address

Method Parameters

NamePlugin TypeDescription

account

FctAddress

The address of the account in which to retrieve a collateral balance.

asset

FctAddress

The address of the collateral asset smart contract.

Returned Values

NamePlugin TypeDescription

balance

FctValue

The balance of the collateral asset in the protocol for the specified account as an unsigned integer scaled up by 10 to the “decimals” integer in the asset’s contract.

Example

Example with initParams

const collateralBalanceOf = new CompoundV3.getter.CollateralBalanceOf({
   chainId: 1,
   initParams: {
     to: "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // cUSDCv3
     methodParams: {
       account: "0x...",
       asset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
     }
   }
})

Example without initParams

const collateralBalanceOf = new CompoundV3.getter.CollateralBalanceOf({ chainId: 1 })

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

Learn more

Learn more about Compound V3 Collateral Balance method here

Last updated