# DeFi Composer

DeFi Composer memungkinkan vault multi-protokol bergaya Yearn yang ditulis dalam Solidity, yang menyusun berbagai protokol DeFi Solana secara atomik melalui CPI.

## Ringkasan

Satu fungsi Solidity dapat mengoordinasikan operasi di seluruh Jupiter, Kamino, Drift, Meteora, dan protokol Solana lainnya — semuanya secara atomik. Jika satu langkah gagal, seluruh transaksi dibatalkan.

```solidity
function executeStrategy(uint256 amount) external {
    // 1. Tukar 50% USDC ke SOL melalui Jupiter
    IJupiter(JUPITER).swap(USDC, SOL, amount / 2, minSolOut);

    // 2. Setorkan SOL sebagai jaminan di Kamino
    IKamino(KAMINO).deposit(SOL, solAmount);

    // 3. Pinjam USDC dengan jaminan SOL
    IKamino(KAMINO).borrow(USDC, borrowAmount);

    // 4. Buka posisi short SOL-PERP di Drift (delta hedge)
    IDrift(DRIFT).placeOrder(SOL_PERP, SHORT, size, leverage);

    // Semuanya atomik. Satu fungsi Solidity. Empat lompatan CPI.
}
```

## Mengapa Solidity untuk Komposisi DeFi?

* **Perkakas yang familier** — developer Solidity tidak perlu mempelajari Rust/Anchor
* **Ekosistem matang** — manfaatkan OpenZeppelin, perkakas audit yang sudah ada, alur kerja Hardhat/Foundry
* **Komposabilitas** — `try/catch`, modifier, dan pewarisan bekerja secara alami
* **Eksekusi atomik** — model transaksi Solana menjamin semuanya atau tidak sama sekali

## Strategi Referensi (Direncanakan)

| Strategi              | Protokol               | Deskripsi                                                            |
| --------------------- | ---------------------- | -------------------------------------------------------------------- |
| Pengoptimal Hasil SOL | Kamino, Drift          | Setor SOL, pinjam aset stabil, lindungi delta pada perps             |
| Hasil Stablecoin      | Kamino, Orca           | Sediakan likuiditas stablecoin di seluruh pool, rebalancing otomatis |
| Netral Delta          | Jupiter, Kamino, Drift | Tukar + supply + hedge untuk hasil tanpa eksposur                    |
| Arbitrase LST         | Jupiter, Marinade      | Manfaatkan perbedaan harga LST                                       |

## Status

**Dirancang** — bergantung pada Rome SDK Phase 2 (antarmuka IJupiter, IDrift, IKamino). Infrastruktur CPI inti sudah aktif; antarmuka bertipe spesifik protokol sedang dalam pengerjaan.

## Berikutnya

* [Rome SDK](/id/produk/rome-sdk.md) — antarmuka Solidity bertipe untuk program Solana
* [Panggil Solana dari EVM](/id/panduan-pengembang/call-solana-from-evm.md) — panduan CPI
* [Batasan](/id/konsep-inti/constraints.md) — batas kedalaman CPI dan anggaran komputasi


---

# Agent Instructions: 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:

```
GET https://docs.rome.builders/id/produk/defi-composer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
