> 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

أنماط التكامل لـ DeFi على EVM في Rome — الإقراض باستخدام أوراكل Solana، وتركيب Jupiter وKamino من Solidity، ومجمّعات السيولة المشتركة.

تتيح Rome لبروتوكولات التمويل اللامركزي EVM أن تتكامل بشكلٍ ذري مع النظام البيئي الأصلي للتمويل اللامركزي على Solana. تغطي هذه الصفحة أنماط التكامل الشائعة. يعمل بعضها بالفعل على Rome — Aave v3 وCompound v3 (Aerarium) وUniswap V2/V3/V4 وRome DEX — انظر [التطبيقات على Rome](https://docs.rome.builders/ar/alttbyqat-ala-rome/apps.md).

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

## لماذا التمويل اللامركزي على Rome؟

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

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

الاستيراد أدناه يأتي من [`rome-solidity`](https://github.com/rome-protocol/rome-solidity)، والذي يتم تثبيته من GitHub وليس من npm: `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/ar/adlh-almtw-ryn/deploy-solidity.md#using-the-rome-solidity-sdk)). مرّر عنوان المصدر من [السجل](https://docs.rome.builders/ar/almntjat/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();
        // سعر 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 على Solana من 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` (عدة معاملات EVM على سلاسل Rome مختلفة، ذرية في معاملة Solana واحدة):

1. اشترِ على DEX A على إحدى سلاسل Rome
2. بع على DEX B على سلسلة Rome أخرى
3. يتم تنفيذ الاثنين بشكل ذري؛ إذا فشل أحدهما، يُلغى الاثنان.

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

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

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

## ذات صلة

* [بوابة الأوراكل](https://docs.rome.builders/ar/almntjat/oracle-gateway.md) — خلاصات أسعار متوافقة مع Chainlink
* [Rome SDK](https://docs.rome.builders/ar/almntjat/rome-sdk.md) — واجهات مُنَوَّعة لبروتوكولات التمويل اللامركزي


---

# 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/ar/halat-alastkhdam/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.
