Zap Repay
5. Preview the Estimated Post-Zap-Repay 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: '10000',
slippage: 100,
};
const zapRepayQuotation = await compoundkit.getZapRepayQuotation(chainId, marketId, params);
// {
// "quotation": {
// "destAmount": "5610.402066",
// "currentPosition": {
// "utilization": "0.7166",
// "healthRate": "1.49",
// "liquidationThreshold": "0.7829",
// "supplyUSD": "0",
// "borrowUSD": "82542.9",
// "collateralUSD": "157176.66",
// "netAPR": "-0.0472"
// },
// "targetPosition": {
// "utilization": "0.6679",
// "healthRate": "1.6",
// "liquidationThreshold": "0.7829",
// "supplyUSD": "0",
// "borrowUSD": "76932.11",
// "collateralUSD": "157176.66",
// "netAPR": "-0.0409"
// }
// },
// "fees": [
// {
// "rid": "native-token",
// "feeAmount": {
// "token": {
// "chainId": 137,
// "address": "0x0000000000000000000000000000000000001010",
// "decimals": 18,
// "symbol": "MATIC",
// "name": "Matic Token"
// },
// "amount": "20"
// }
// }
// ],
// "approvals": [],
// "logics": [
// {
// "rid": "paraswap-v5:swap-token",
// "fields": {
// "input": {
// "token": {
// "chainId": 137,
// "address": "0x0000000000000000000000000000000000001010",
// "decimals": 18,
// "symbol": "MATIC",
// "name": "Matic Token"
// },
// "amount": "10000"
// },
// "output": {
// "token": {
// "chainId": 137,
// "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
// "decimals": 6,
// "symbol": "USDC",
// "name": "USD Coin (PoS)"
// },
// "amount": "5610.402066"
// },
// "slippage": 100
// }
// },
// {
// "rid": "compound-v3:repay",
// "fields": {
// "marketId": "USDC",
// "borrower": "0x0FBeABcaFCf817d47E10a7bCFC15ba194dbD4EEF",
// "input": {
// "token": {
// "chainId": 137,
// "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
// "decimals": 6,
// "symbol": "USDC",
// "name": "USD Coin (PoS)"
// },
// "amount": "5610.402066"
// },
// "balanceBps": 10000
// }
// }
// ]
// }6. Obtain Transaction Data for Execution
Last updated