> 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/ar/halat-alastkhdam/defi-protocols.md).

# بروتوكولات DeFi

تتيح Rome لبروتوكولات DeFi على EVM أن تتكوّن مع منظومة DeFi الأصلية في سولانا بشكل ذري. تغطي هذه الصفحة أنماط التكامل الشائعة. وقد أصبح عدد منها مباشرًا بالفعل على Rome — Aave v3 وCompound v3 (Aerarium) وUniswap V2/V3/V4 وRome DEX — راجع [التطبيقات على Rome](/ar/alttbyqat-ala-rome/apps.md).

الكود أدناه توضيحي؛ أسماء الواجهات لبرامج سولانا التابعة لجهات خارجية هي أمثلة، وليست واجهات SDK مُرفقة.

## لماذا DeFi على Rome؟

* **الوصول إلى سيولة سولانا** — Jupiter وKamino وDrift وMeteora وRaydium وOrca
* **القابلية التركيبية الذرّية** — عمليات DeFi متعددة الخطوات في معاملة واحدة
* **أدوات Solidity** — بيئة تطوير ومراجعة مألوفة
* **الحالة المشتركة** — مستخدمو EVM وسولانا يتشاركون نفس المجمعات

## النمط 1: بروتوكول إقراض مع أوراكل سولانا

```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();
        // سعر Pyth/Switchboard عبر Oracle Gateway
        // نفس الواجهة كما في Chainlink على Ethereum
        return (amount * uint256(price)) / 1e8;
    }
}
```

## النمط 2: مجمّع DEX عبر CPI

```solidity
contract RomeSwap {
    function swap(
        bytes32 fromMint,
        bytes32 toMint,
        uint256 amount,
        uint256 minOut
    ) external {
        // CPI إلى Jupiter/Raydium/Meteora
        // كل سيولة DEX على سولانا متاحة من Solidity
        CpiProgram.invoke(JUPITER_PROGRAM, accounts, swapData);
    }
}
```

## النمط 3: خزنة العائد

```solidity
contract YieldVault {
    function deposit(uint256 amount) external {
        // قبول إيداع USDC
        // CPI → Jupiter: المبادلة إلى الرموز المثلى
        // CPI → Kamino: التوريد كضمان
        // CPI → Drift: فتح تحوّط محايد للدلتا
        // كلها ذرّية — معاملة واحدة، الكل أو لا شيء
    }
}
```

## النمط 4: المراجحة عبر البروتوكولات

باستخدام `RemusTx` (معاملات ذرّية عبر عدة rollups):

1. الشراء على DEX A في rollup 1
2. البيع على DEX B في rollup 2
3. كلاهما بشكل ذري — لا يوجد أي خطر تنفيذ

## التطبيقات المرجعية

انسخ تطبيق Rome يعمل بدلًا من البدء من صفحة فارغة:

* [**rome-dex**](https://github.com/rome-protocol/rome-dex) — AMM ثنائي المسار؛ أَحضر فكرة جديدة وانشرها لمستخدمي سولانا وEVM عبر مجمّع واحد.
* [**aerarium**](https://github.com/rome-protocol/aerarium) — واجهة إقراض Compound v3 ثنائية المسار.
* [**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.
* [**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) — تطبيق جديد متعدد VMs: يقرأ حسابات أسعار سولانا (Pyth وSwitchboard)، وينشرها على EVM، ويقدّمها إلى Solidity عبر Chainlink القياسي `AggregatorV3Interface`.

## ذات صلة

* [Oracle Gateway](/ar/almntjat/oracle-gateway.md) — موجّهات أسعار متوافقة مع Chainlink
* [Rome SDK](/ar/almntjat/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rome.builders/ar/halat-alastkhdam/defi-protocols.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
