> 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/ko/use-cases/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의 앱](/ko/rome/apps.md).

아래 코드는 예시용입니다. 타사 Solana 프로그램의 인터페이스 이름은 예시이며, 배포되는 SDK 인터페이스가 아닙니다.

## Rome에서 DeFi를 사용하는 이유?

* **Solana 유동성에 접근** — Jupiter, Kamino, Drift, Meteora, Raydium, Orca
* **원자적 조합성** — 하나의 트랜잭션으로 여러 단계의 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 컨트랙트 배포](/ko/developer-guides/deploy-solidity.md#using-the-rome-solidity-sdk)). 피드 주소는 [레지스트리](/ko/products/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
        // Solidity에서 모든 Solana DEX 유동성에 접근 가능
        CpiProgram.invoke(JUPITER_PROGRAM, accounts, swapData);
    }
}
```

## 패턴 3: 수익 창출 볼트

```solidity
contract YieldVault {
    function deposit(uint256 amount) external {
        // USDC 예치 수락
        // CPI → Jupiter: 최적의 토큰으로 스왑
        // CPI → Kamino: 담보로 공급
        // CPI → Drift: 델타 중립 헤지 개설
        // 모두 원자적으로 — 하나의 트랜잭션, 전부 아니면 전무
    }
}
```

## 패턴 4: 프로토콜 간 차익거래

사용: `RemusTx` (원자적 크로스 롤업 트랜잭션):

1. 롤업 1의 DEX A에서 매수
2. 롤업 2의 DEX B에서 매도
3. 둘 다 원자적으로 — 실행 리스크 0

## 참조 구현

빈 페이지에서 시작하는 대신 작동하는 Rome 앱을 포크하세요:

* [**rome-dex**](https://github.com/rome-protocol/rome-dex) — 듀얼 레인 AMM; 새로운 아이디어를 가져와 하나의 풀로 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를 통해 Solidity에 제공합니다 `AggregatorV3Interface`.

## 관련 항목

* [Oracle Gateway](/ko/products/oracle-gateway.md) — Chainlink 호환 가격 피드
* [Rome SDK](/ko/products/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/ko/use-cases/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.
