Zap Supply
5. Preview the Estimated Post-Zap-Supply Position & Approval Permissions
import * as compoundkit from '@protocolink/compound-kit';
import * as common from '@protocolink/common';
import * as logics from '@protocolink/logics';
const chainId = common.ChainId.polygon;
const marketId = compoundkit.MarketId.USDC;
const params = {
account: '0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa',
srcToken: logics.compoundv3.polygonTokens.MATIC,
srcAmount: '10',
destToken: logics.compoundv3.polygonTokens.WETH,
slippage: 100,
};
const zapSupplyQuotation = await compoundkit.getZapSupplyQuotation(chainId, marketId, params);
// {
// "quotation": {
// "destAmount": "0.003414475482347128",
// "currentPosition": {
// "utilization": "0.6649",
// "healthRate": "1.61",
// "liquidationThreshold": "0.7828",
// "supplyUSD": "0",
// "borrowUSD": "77538.38",
// "collateralUSD": "159157.49",
// "netAPR": "-0.0407"
// },
// "targetPosition": {
// "utilization": "0.6648",
// "healthRate": "1.61",
// "liquidationThreshold": "0.7828",
// "supplyUSD": "0",
// "borrowUSD": "77538.38",
// "collateralUSD": "159163.31",
// "netAPR": "-0.0407"
// }
// },
// "fees": [
// {
// "rid": "native-token",
// "feeAmount": {
// "token": {
// "chainId": 137,
// "address": "0x0000000000000000000000000000000000001010",
// "decimals": 18,
// "symbol": "MATIC",
// "name": "Matic Token"
// },
// "amount": "0.02"
// }
// }
// ],
// "approvals": [],
// "logics": [
// {
// "rid": "paraswap-v5:swap-token",
// "fields": {
// "input": {
// "token": {
// "chainId": 137,
// "address": "0x0000000000000000000000000000000000001010",
// "decimals": 18,
// "symbol": "MATIC",
// "name": "Matic Token"
// },
// "amount": "10"
// },
// "output": {
// "token": {
// "chainId": 137,
// "address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
// "decimals": 18,
// "symbol": "WETH",
// "name": "Wrapped Ether"
// },
// "amount": "0.003414475482347128"
// },
// "slippage": 100
// }
// },
// {
// "rid": "compound-v3:supply-collateral",
// "fields": {
// "marketId": "USDC",
// "input": {
// "token": {
// "chainId": 137,
// "address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
// "decimals": 18,
// "symbol": "WETH",
// "name": "Wrapped Ether"
// },
// "amount": "0.003414475482347128"
// },
// "balanceBps": 10000
// }
// }
// ]
// }6. Obtain Transaction Data for Execution
Last updated