> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/ja/ysuksu/defi-protocols.md).

# DeFiプロトコル

Rome上のEVM DeFiの統合パターン — Solanaオラクルを使ったレンディング、SolidityからJupiterとKaminoを組み合わせる方法、共有流動性プール。

Rome により、EVM の DeFi プロトコルは Solana のネイティブ DeFi エコシステムとアトミックに組み合わせられます。このページでは一般的な統合パターンを扱います。いくつかはすでに Rome 上で稼働しています — Aave v3、Compound v3（Aerarium）、Uniswap V2/V3/V4、そして Rome DEX — を参照 [Rome上のアプリ](/ja/romenoapuri/apps.md).

以下のコードは例示用です。サードパーティ製 Solana プログラムのインターフェース名は例であり、同梱されている SDK インターフェースではありません。

## なぜ Rome 上で DeFi なのか？

* **Solana の流動性にアクセス** — Jupiter、Kamino、Drift、Meteora、Raydium、Orca
* **アトミックなコンポーザビリティ** — 1 回のトランザクションで複数ステップの DeFi 操作
* **Solidity ツール群** — 見慣れた開発・監査エコシステム
* **共有状態** — EVM と Solana のユーザーが同じプールを共有

## パターン 1: Solana オラクルを使ったレンディングプロトコル

以下の import は [`rome-solidity`](https://github.com/rome-protocol/rome-solidity)からのものです。これは npm ではなく GitHub からインストールされています: `npm install github:rome-protocol/rome-solidity`、または `forge install rome-protocol/rome-solidity` remapping を使って `@rome-protocol/rome-solidity/=lib/rome-solidity/` （詳細は [Solidityコントラクトのデプロイ](/ja/gaido/deploy-solidity.md#using-the-rome-solidity-sdk)）フィードアドレスは [registry](/ja/zhi-pin/oracle-gateway.md#consume-a-feed-in-three-steps) から渡し、ハードコードしないでください。

```solidity
import {IAggregatorV3Interface} from "@rome-protocol/rome-solidity/contracts/oracle/IAggregatorV3Interface.sol";

contract RomeLending {
    IAggregatorV3Interface public priceFeed;

    constructor(address _priceFeed) {
        priceFeed = IAggregatorV3Interface(_priceFeed);
    }

    function getCollateralValue(uint256 amount) public view returns (uint256) {
        (, int256 price,,,) = priceFeed.latestRoundData();
        // Oracle Gateway 経由の Pyth/Switchboard 価格
        // Ethereum上のChainlinkと同じインターフェース
        return (amount * uint256(price)) / 1e8;
    }
}
```

## パターン 2: CPI 経由の DEX アグリゲーター

```solidity
contract RomeSwap {
    function swap(
        bytes32 fromMint,
        bytes32 toMint,
        uint256 amount,
        uint256 minOut
    ) external {
        // Jupiter/Raydium/Meteora への CPI
        // Solana のすべての DEX 流動性に Solidity からアクセス可能
        CpiProgram.invoke(JUPITER_PROGRAM, accounts, swapData);
    }
}
```

## パターン 3: 利回りボールト

```solidity
contract YieldVault {
    function deposit(uint256 amount) external {
        // USDC の預け入れを受け付ける
        // CPI → Jupiter: 最適なトークンへスワップ
        // CPI → Kamino: 担保として供給
        // CPI → Drift: デルタニュートラルなヘッジを開く
        // すべてアトミック — 1 回の tx で、成功するか全て失敗するか
    }
}
```

## パターン 4: クロスプロトコル・アービトラージ

使用するのは `RemusTx` （アトミックなクロスロールアップトランザクション）:

1. rollup 1 の DEX A で購入
2. rollup 2 の DEX B で売却
3. 両方をアトミックに — 執行リスクはゼロ

## 参照実装

白紙から始める代わりに、動作する Rome アプリをフォークしてください:

* [**rome-dex**](https://github.com/rome-protocol/rome-dex) — デュアルレーン AMM。新しいアイデアを持ち込み、1 つのプールで Solana と EVM の両ユーザー向けに展開できます。
* [**aerarium**](https://github.com/rome-protocol/aerarium) — デュアルレーンの Compound v3 レンディング UI。
* [**cardo**](https://github.com/rome-protocol/cardo) — CPI アプリ配布ポータル（swap / lend / perps / compose）。
* [**rome-aave-v3-demo**](https://github.com/rome-protocol/rome-aave-v3-demo) — Aave v3 レンディング UI。
* [**compound-on-rome-comet**](https://github.com/rome-protocol/compound-on-rome-comet) — Comet マネーマーケットのコントラクト。
* [**rome-oracle-gateway**](https://github.com/rome-protocol/rome-oracle-gateway) — 新規のクロス VM アプリ: Solana の価格アカウント（Pyth、Switchboard）を読み取り、EVM に投稿し、標準の Chainlink 経由で Solidity に提供します `AggregatorV3Interface`.

## 関連

* [Oracle Gateway](/ja/zhi-pin/oracle-gateway.md) — Chainlink 互換の価格フィード
* [Rome SDK](/ja/zhi-pin/rome-sdk.md) — DeFi プロトコル向けの型付きインターフェース


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rome.builders/ja/ysuksu/defi-protocols.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
