Zap Borrow
5. Preview the Estimated Post-Zap-Borrow 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',
srcAmount: '1000',
destToken: logics.compoundv3.polygonTokens.MATIC,
slippage: 100,
};
const zapBorrowQuotation = await compoundkit.getZapBorrowQuotation(chainId, marketId, params);
// {
// "quotation": {
// "destAmount": "17659.570770299088050127",
// "currentPosition": {
// "utilization": "0.7166",
// "healthRate": "1.49",
// "liquidationThreshold": "0.7829",
// "supplyUSD": "0",
// "borrowUSD": "82544.66",
// "collateralUSD": "157169.13",
// "netAPR": "-0.0471"
// },
// "targetPosition": {
// "utilization": "0.8034",
// "healthRate": "1.33",
// "liquidationThreshold": "0.7829",
// "supplyUSD": "0",
// "borrowUSD": "92545.56",
// "collateralUSD": "157169.13",
// "netAPR": "-0.061"
// }
// },
// "fees": [
// {
// "rid": "compound-v3:borrow",
// "feeAmount": {
// "token": {
// "chainId": 137,
// "address": "0x0000000000000000000000000000000000001010",
// "decimals": 18,
// "symbol": "MATIC",
// "name": "Matic Token"
// },
// "amount": "35.314145434915390767"
// }
// }
// ],
// "approvals": [
// {
// "to": "0xF25212E676D1F7F89Cd72fFEe66158f541246445",
// "data": "0x110496e5000000000000000000000000e7c086090b361c955950956105df200b20f66d700000000000000000000000000000000000000000000000000000000000000001"
// }
// ],
// "logics": [
// {
// "rid": "compound-v3:borrow",
// "fields": {
// "marketId": "USDC",
// "output": {
// "token": {
// "chainId": 137,
// "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
// "decimals": 6,
// "symbol": "USDC",
// "name": "USD Coin (PoS)"
// },
// "amount": "10000"
// }
// }
// },
// {
// "rid": "paraswap-v5:swap-token",
// "fields": {
// "input": {
// "token": {
// "chainId": 137,
// "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
// "decimals": 6,
// "symbol": "USDC",
// "name": "USD Coin (PoS)"
// },
// "amount": "10000"
// },
// "output": {
// "token": {
// "chainId": 137,
// "address": "0x0000000000000000000000000000000000001010",
// "decimals": 18,
// "symbol": "MATIC",
// "name": "Matic Token"
// },
// "amount": "17659.570770299088050127"
// },
// "slippage": 100
// }
// }
// ]
// }6. Obtain Transaction Data for Execution
Last updated