> For the complete documentation index, see [llms.txt](https://jpydf.gitbook.io/jpy-defi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jpydf.gitbook.io/jpy-defi/technical-information/architecture.md).

# Architecture Overview

JPY DeFi derives its borrowing core (the Core) from Liquity v2 (liquity/bold commit `3fcaf60`) and adds collateral and price layers around it. Core differences are managed in the specifications, and where there is no difference the Core keeps Liquity v2's accounting behavior. This does not mean the code is fully identical.

## Layered structure

```
Liquity v2 Core (differences managed)
  borrowing / liquidation / redemption / Stability Pool
  for collateral and price, depends on two external interfaces
    - collateral token (ERC-20) = dToken
    - price feed                = PriceFeedProxy
        │ collateral         │ price
        ▼                    ▼
dToken layer              Oracle layer
  collateral custody        yen price calculation
  minting and in-kind       stopping on anomalies
  redemption                price-source replacement
  allocation to venues
        │
        ▼
Strategy layer  deploys collateral externally and sends yield and principal back to the Vault
Zapper          helper that combines several operations into one transaction (each layer works without it)
```

## Core differences

The main differences from Liquity v2 are:

* Token and ABI naming, and token functions prepared for future bridging
* JPY DeFi-specific constants and branch parameters, and a function to finalize a reserved branch's parameters once
* A Stability Pool constraint that forbids depositing and withdrawing in the same block
* SafeERC20 for token transfers, accounting events, and display metadata for Troves
* On a price failure, a pause that can be resumed instead of a permanent shutdown, and allowing risk-reducing operations during that pause
* A dedicated price path for urgent redemption

For collateral and price, the Core depends on two external interfaces: the collateral token (dToken) and the price feed (PriceFeedProxy). It also uses WETH for gas compensation. External deployment of collateral, backing-ratio pricing, price-source replacement, and operation bundling are implemented outside these interfaces.

## Main flows

* **Borrowing**: Deposit the underlying asset into the Vault to receive dTokens, then open a Trove with the dTokens as collateral and borrow JPYdf.
* **In-kind redemption**: Burn dTokens and receive the underlying asset from the liquidity buffer. Any shortfall becomes a withdrawal request.
* **Collateral deployment**: The Vault allocates the underlying asset to a Strategy, and the Strategy sends yield and principal back to the Vault.
* **Price**: Core → PriceFeedProxy → each price feed (collateral / USD and JPY / USD) → the collateral's yen price.

## Frontend data paths

Transaction submission and checks of current on-chain state use the configured Ethereum RPC. Loan history and lists come from an indexer (subgraph). An indexer outage does not mean the contracts have stopped; the app rereads the owner, status, and latest collateral and debt from RPC before continuing key operations.

While the indexer is down, history and lists can be incomplete, so the app shows a warning and does not treat missing entries as "no position." If needed, you can open a position directly with its [Loan ID](/jpy-defi/borrowing-and-trove-management/borrowing.md#loan-id). Before submitting, rely on the transaction preview and your wallet's confirmation screen rather than displayed history.

## Supported chains

JPY DeFi runs only on Ethereum mainnet. The JPYdf token has a built-in registry for granting issuance authority to bridges (the bridge registry), but no bridge is currently registered. The conditions for enabling cross-chain issuance are in [Governance & Timelock](/jpy-defi/governance/governance-and-timelock.md).
