{
  "$schema": "https://degreesofsatoshi.com/encyclopedia/schemas/article-v1.json",
  "schemaVersion": "1.0.0",
  "id": "repay-with-collateral",
  "canonical": "https://degreesofsatoshi.com/encyclopedia/repay-with-collateral/",
  "collection": "defi",
  "title": "Repaying with collateral: the swap inside the repayment",
  "description": "Understand how a lending adapter sells supplied collateral to reduce debt, and why both sides of the position must be measured.",
  "aliases": [
    "repay Aave with collateral explained",
    "sell supplied collateral to repay a loan"
  ],
  "dates": {
    "published": "2026-10-02",
    "modified": "2026-10-02",
    "verified": "2026-10-02T19:18:00.092Z",
    "dataAsOf": "2026-10-02"
  },
  "authorship": {
    "publisher": "Degrees of Satoshi editorial project",
    "process": "AI-assisted research and drafting with a separate automated source-verification pass; no external expert or named human review is implied."
  },
  "quickAnswer": {
    "text": "Repay-with-collateral uses part of a supplied asset to obtain the debt asset and repay borrowing. Aave’s documented adapters can coordinate withdrawal, swap and repayment atomically, sometimes using a flash loan. The result reduces both debt and collateral, so the final health factor and costs must be evaluated together.",
    "claimId": "repay-with-collateral-quick-answer",
    "sourceIds": [
      "x425-defi-aave-swaps",
      "x425-defi-aave-health"
    ]
  },
  "keyFacts": [
    {
      "label": "Two balances",
      "value": "The operation consumes collateral while paying debt.",
      "sourceIds": [
        "x425-defi-aave-swaps"
      ],
      "id": "two-balances",
      "claimId": "repay-with-collateral-fact-two-balances"
    },
    {
      "label": "Atomic path",
      "value": "The cited adapter can coordinate the steps in one transaction.",
      "sourceIds": [
        "x425-defi-aave-swaps"
      ],
      "id": "atomic-path",
      "claimId": "repay-with-collateral-fact-atomic-path"
    },
    {
      "label": "Alternative path",
      "value": "Aave also documents a method without a flash loan when position checks permit.",
      "sourceIds": [
        "x425-defi-aave-swaps"
      ],
      "id": "alternative-path",
      "claimId": "repay-with-collateral-fact-alternative-path"
    }
  ],
  "prerequisites": [
    "repay-defi-loan",
    "flash-loans"
  ],
  "sections": [
    {
      "id": "example",
      "heading": "Recompute both numerator and denominator",
      "sourceIds": [
        "x425-defi-aave-health",
        "x425-defi-aave-swaps"
      ],
      "paragraphs": [
        "Take hypothetical collateral worth 1,000 with an 80% liquidation threshold and debt worth 600. Health factor is 800 / 600 ≈ 1.33. Selling 200 of collateral to repay 200 of debt, with no costs or price changes, leaves 800 collateral and 400 debt: 640 / 400 = 1.60.",
        "Actual swap output, fees and the assets’ thresholds change the result. Do not subtract debt while pretending all collateral remains."
      ]
    },
    {
      "id": "sequence",
      "heading": "A flash loan can bridge the temporary state",
      "sourceIds": [
        "x425-defi-aave-swaps"
      ],
      "paragraphs": [
        "The documented adapter can first use borrowed liquidity to repay debt, then obtain collateral, swap it and repay the flash loan. The atomic requirement means the required steps must succeed together. This is different from manually withdrawing collateral first, which can fail a health check."
      ]
    },
    {
      "id": "quote",
      "heading": "Read what is spent and what debt remains",
      "sourceIds": [
        "x425-defi-aave-swaps"
      ],
      "paragraphs": [
        "Review maximum collateral input, intended debt repayment, asset addresses, allowances and the post-operation position. Atomic execution protects against an incomplete sequence within that transaction; it does not guarantee a favorable swap or protect the remaining position from later price changes."
      ]
    }
  ],
  "faq": [
    {
      "question": "Is this the same as paying from tokens already in my wallet?",
      "answer": "No. It sells part of the supplied position. A wallet-funded repayment can reduce debt without consuming that collateral.",
      "sourceIds": [
        "x425-defi-aave-swaps",
        "x425-defi-aave-pool"
      ]
    }
  ],
  "claims": [
    {
      "id": "repay-with-collateral-quick-answer",
      "articleSlug": "repay-with-collateral",
      "statement": "Repay-with-collateral uses part of a supplied asset to obtain the debt asset and repay borrowing. Aave’s documented adapters can coordinate withdrawal, swap and repayment atomically, sometimes using a flash loan. The result reduces both debt and collateral, so the final health factor and costs must be evaluated together.",
      "sourceIds": [
        "source-f84decea4c02489e",
        "source-74f79d59daaab5f0"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-f84decea4c02489e",
          "locator": "Repay with collateral; Collateral Swap; Debt Swap"
        },
        {
          "sourceId": "source-74f79d59daaab5f0",
          "locator": "Health Factor; Managing Health Factor"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked Aave repay adapter flash and nonflash paths and atomicity;health800/600≈1.33 then640/400=1.6 in zero-cost example."
        ]
      }
    },
    {
      "id": "repay-with-collateral-fact-two-balances",
      "articleSlug": "repay-with-collateral",
      "statement": "Two balances: The operation consumes collateral while paying debt.",
      "sourceIds": [
        "source-f84decea4c02489e"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-f84decea4c02489e",
          "locator": "Repay with collateral; Collateral Swap; Debt Swap"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked Aave repay adapter flash and nonflash paths and atomicity;health800/600≈1.33 then640/400=1.6 in zero-cost example."
        ]
      }
    },
    {
      "id": "repay-with-collateral-fact-atomic-path",
      "articleSlug": "repay-with-collateral",
      "statement": "Atomic path: The cited adapter can coordinate the steps in one transaction.",
      "sourceIds": [
        "source-f84decea4c02489e"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-f84decea4c02489e",
          "locator": "Repay with collateral; Collateral Swap; Debt Swap"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked Aave repay adapter flash and nonflash paths and atomicity;health800/600≈1.33 then640/400=1.6 in zero-cost example."
        ]
      }
    },
    {
      "id": "repay-with-collateral-fact-alternative-path",
      "articleSlug": "repay-with-collateral",
      "statement": "Alternative path: Aave also documents a method without a flash loan when position checks permit.",
      "sourceIds": [
        "source-f84decea4c02489e"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-f84decea4c02489e",
          "locator": "Repay with collateral; Collateral Swap; Debt Swap"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked Aave repay adapter flash and nonflash paths and atomicity;health800/600≈1.33 then640/400=1.6 in zero-cost example."
        ]
      }
    }
  ],
  "sources": [
    {
      "id": "x425-defi-aave-swaps",
      "label": "Aave v3 Swap Features",
      "publisher": "Aave",
      "url": "https://aave.com/docs/aave-v3/smart-contracts/swap-features",
      "locator": "Repay with collateral; Collateral Swap; Debt Swap",
      "note": "Documented adapter/flash-loan/DEX composition; availability varies by market.",
      "version": "Documentation retrieved for the 2026-10-02 editorial scope; content hash recorded",
      "checkedAt": "2026-10-02T18:53:21.663Z",
      "contentSha256": "b99c7a66fb373b3f455a161aa0503452eeb99555856ba3dcafedde5bf66a33c7",
      "recordId": "source-f84decea4c02489e"
    },
    {
      "id": "x425-defi-aave-health",
      "label": "Health Factor and Liquidations",
      "publisher": "Aave",
      "url": "https://aave.com/help/borrowing/liquidations",
      "locator": "Health Factor; Managing Health Factor",
      "note": "Weighted liquidation thresholds; no universal safe ratio.",
      "version": "Documentation retrieved for the 2026-10-02 editorial scope; content hash recorded",
      "checkedAt": "2026-10-02T18:53:21.960Z",
      "contentSha256": "30c991765c763cc1bc7665de9fdf6603c969677068261beca7dfb11eb85018f4",
      "recordId": "source-74f79d59daaab5f0"
    },
    {
      "id": "x425-defi-aave-pool",
      "label": "Aave v3 Pool",
      "publisher": "Aave",
      "url": "https://aave.com/docs/aave-v3/smart-contracts/pool",
      "locator": "repay; setUserUseReserveAsCollateral; withdraw; setUserEMode",
      "note": "Specific v3 write-method constraints and amount sentinel.",
      "version": "Documentation retrieved for the 2026-10-02 editorial scope; content hash recorded",
      "checkedAt": "2026-10-02T18:53:21.762Z",
      "contentSha256": "fb2828e86231a1280760fef675f3ee83825f32543b79c8c8529050e8da3281a3",
      "recordId": "source-b35859a766315ce4"
    }
  ],
  "related": {
    "articles": [
      "collateral-swaps",
      "defi-debt-refinancing",
      "slippage-and-price-impact",
      "repay-defi-loan"
    ],
    "dossiers": [],
    "wallets": []
  },
  "revisionHistory": [
    {
      "date": "2026-10-02",
      "kind": "published",
      "summary": "First publication after primary-source research and separate automated verification."
    }
  ],
  "citation": "Degrees of Satoshi editorial project. “Repaying with collateral: the swap inside the repayment.” Published 2026-10-02; updated 2026-10-02. https://degreesofsatoshi.com/encyclopedia/repay-with-collateral/"
}
