> 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上のアプリ](https://docs.rome.builders/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` 次のリマッピングで `@rome-protocol/rome-solidity/=lib/rome-solidity/` （詳細は [Solidity コントラクトをデプロイする](https://docs.rome.builders/ja/gaido/deploy-solidity.md#using-the-rome-solidity-sdk)）。フィードアドレスは [registry](https://docs.rome.builders/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` （異なる Rome チェーン上の複数の EVM トランザクションを、1 つの Solana トランザクションでアトミックに実行）：

1. 1 つの Rome チェーン上の DEX A で買う
2. 別の Rome チェーン上の 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 アプリ配布ポータル（スワップ / レンド / パーペチュアル / コンポーズ）。
* [**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 `AggregatorV3Interface`.

## 関連

* [Oracle Gateway](https://docs.rome.builders/ja/zhi-pin/oracle-gateway.md) — Chainlink 互換の価格フィード
* [Rome SDK](https://docs.rome.builders/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.
