bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 26쪽 중 19쪽
rent implementation routes these server functions under internal paths such as `/api/internal/v3`, `/api/internal/pyth/updates`, and `/api/internal/vaults`. Treat internal routes as implementation details and verify them against the pinned repository revision before building integrations around them.
### Customization
Euler UI is designed to be rebranded with minimal code changes:
* **Theme colors:** edit the `THEME CONFIGURATION` section at the top of `assets/styles/variables.scss`. Accent, status, chart, and graph palettes (plus their light/dark overrides and derived shadows/glows) all flow from these CSS custom properties.
* **Logo:** the logo renders as an inline SVG using `currentColor`, so it follows the accent color by default. Set `NUXT_PUBLIC_CONFIG_LOGO_URL` to use a custom logo, with the built-in Euler logo as fallback.
* **Favicon:** replace `favicon.ico` and `favicon.svg` in `public/favicons/`.
* **Token icons:** drop overrides into `assets/tokens/<symbol>.png`. Icons otherwise resolve from a unified server-side token list aggregating the Euler SDK list, DefiLlama, Uniswap, and Merkl.
* **Branding and feature flags:** toggle pages (Earn, Lend, Explore), entity branding, vault-type labels, reward integrations (Merkl, Incentra, Fuul, Turtle), social links, policy URLs, titles, and more via `NUXT_PUBLIC_CONFIG_*` environment variables.
* **Curated Earn vaults:** by default the app reads Euler's published labels from the Euler Data API and shows the EulerEarn vaults those labels list. A fork can point the app at its own label files instead, with chain-specific `earn-vaults.json` ([Label file format](/build/data-querying/label-file-format)), to restrict which EulerEarn vaults are shown.
See the repository [`README`](https://github.com/euler-xyz/euler-lite#readme) for the full list of `NUXT_PUBLIC_CONFIG_*` flags and SDK data-source controls.
### Security boundaries
Keep RPC credentials, API keys, signer material, and other secrets in server-only variables and a secret manager. Any `NUXT_PUBLIC_*` value is delivered to the browser and must be treated as public. Review which server endpoints proxy privileged upstreams, restrict CORS to intended origins, configure a content-security policy, rate-limit exposed endpoints, and avoid embedding unrestricted provider keys in client bundles.
Self-hosting also makes the operator responsible for dependency updates, domain and TLS configuration, wallet/app identifiers, policy links, monitoring, logging, incident response, and validation of every enabled chain and transaction flow.
### Build and deployment
```bash
npm run build
npm run preview # preview locally
```
The repository includes a Dockerfile with [Doppler](https://www.doppler.com/) integration for runtime secret injection:
```bash
docker build --build-arg APP_PORT=3000 -t euler-lite .
docker run -p 3000:3000 \
-e DOPPLER_TOKEN=your-doppler-token \
-e DOPPLER_PROJECT=euler-lite \
-e DOPPLER_CONFIG=production \
euler-lite
```
To run without Doppler, pass the required environment variables directly and override the default `CMD`:
```bash
docker run -p 3000:3000 \
-e V3_API_URL=https://v3.euler.finance \
-e EULER_SDK_V3_API_KEY=your-v3-api-key \
-e SWAP_API_URL=https://swap.euler.finance \
-e APPKIT_PROJECT_ID=your-project-id \
-e RPC_URL_1=https://your-rpc.com \
-e SUBGRAPH_URL_1=https://your-subgraph.com \
euler-lite node .output/server/index.mjs
```
### Repository
Source, issue tracker, and full configuration reference: [github.com/euler-xyz/euler-lite](https://github.com/euler-xyz/euler-lite).
### Read next
* [Build](/build)
* [Euler SDK](/build/sdk)
* [Reference](/reference)
## Liquidation bot
Liquidation bots monitor Euler accounts, identify unhealthy positions, simulate liquidation candidates, and may submit transactions under operator-defined constraints. Simulation and expected profit do not guarantee successful or profitable execution.
Read [Liquidations](/learn/liquidations) first if you need the protocol mechanics: health, reverse Dutch discounts, maximum liquidation discount, cool-off time, and bad-debt behavior.
### Reference implementation
[`liquidation-bot-v3`](https://github.com/euler-xyz/liquidation-bot-v3) is the reference liquidation bot for Euler V3. It is a Rust binary (built with Cargo) that runs as a long-lived process against a single chain.
On startup it does a one-shot historical sync from the Euler subgraph to discover every active borrower, then keeps account state fresh in three concurrent ways:
* It watches the EVC contract for on-chain events, so any new or changed account is picked up in real time.
* It polls the configured oracles (including Pyth) on a fixed interval. When a price moves, every account that depends on the affected oracle is re-evaluated.
* It runs a full resync and health check across every tracked account on a longer interval as a safety net.
When an account becomes unhealthy, the bot picks the most profitable borrow/collateral pair, gets a swap quote from the Euler swap API for the seized collateral, simulates the liquidation, and, if the result is profitable, submits it through the configured liquidator contract. Profit is routed to the configured profit receiver.
| Resource | Use |
| ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [liquidation-bot-v3](https://github.com/euler-xyz/liquidation-bot-v3) | Reference bot for account monitoring, oracle polling, opportunity detection, simulation, execution, and operations. |
| [Risk & Analytics dashboard](https://risk.euler.finance/accounts) | Inspect positions, vault issues, and oracle observations from configured bots. Read the [dashboard guide](/use/risk-dashboard) for coverage and verification context. |
| [EVC integration guide](/build/evc/integration-guide#5-liquidations-with-controlcollateral) | Understand how liquidations are coordinated through EVC-controlled collateral movement. |
| [Data API](/build/data-querying/euler-v3-api) | Query indexed protocol data for vaults, accounts, prices, liquidations, and timelines. |
| [Lens contracts](/build/data-querying/lens-contracts) | Read on-chain account and vault state for monitoring and validation. |
### Configuration
The reference bot merges configuration from three layers (later layers override earlier ones):
1. An `RPC_URL_<chain_id>` environment variable, which seeds the RPC endpoint for the matching chain.
2. A `Config.<chain_id>.toml` file loaded from the working directory. Ready-made files for every supported chain ship in the repository's `configs/` directory.
3. Other environment variables, mapped onto config fields by name (for example `EOA_PRIVATE_KEY`, `SUBGRAPH_URL_PREFIX`).
`CHAIN_ID` selects which config file is loaded and which `RPC_URL_<chain_id>` value is used. The shipped TOML files contain the chain-specific contract addresses and subgraph paths, but deliberately exclude secrets, RPC endpoints, and the subgraph host. Those are supplied through environment variables.
#### Required environment variables
| Variable | Purpose |
| --------------------- | -------------------------------------------------------------------------------------------- |
| `CHAIN_ID` | Selects which `Config.<chain_id>.toml` is loaded. |
| `RPC_URL_<chain_id>` | RPC endpoint for the chain. The chain id in the name must match `CHAIN_ID`. |
| `SUBGRAPH_URL_PREFIX` | Subgraph host, joined with `subgraph_url_path` from the TOML file to form the full endpoint. |
| `EOA_ADDRESS` | Public address of the signing wallet. Validated against `EOA_PRIVATE_KEY` on startup. |
| `EOA_PRIVATE_KEY` | Private key for the signing wallet. |
#### Key config fields
The TOML files define everything chain-specific, including the contract addresses the bot depends on:
* `evc_address`, `swapper_address`, `liquidator_address`, and the `oracle_lens_address`, `account_lens_address`, `vault_lens_address`, and `utils_lens_address` lens contracts.
* an optional `[pyth]` table with `address` and `endpoint` keys (the endpoint must end with `/`; omit the whole table on chains without a Pyth deployment), and `wrapped_native_asset_address`.
* `swap_url` and `pricing_url` for collateral-to-debt quotes and profitability evaluation.
* `profit_receiver` for liquidation profit.
* `oracle_polling_interval_seconds` and `full_resync_and_check_interval_seconds` to tune how aggressively the bot tracks price moves and re-checks accounts.
* `simulation_mode` (spins up a local Anvil fork and settles every liquidation against the fork instead of the real network — useful for dry-running against live data).
* `enable_observability_api` and `vault_filter` (`None`, `Whitelist`, or `Blacklist`) to restrict which vaults the bot tracks.
On startup the bot validates the configuration: it confirms the RPC reports the expected chain id, the signing key matches the configured EOA, and every configured contract address has bytecode deployed. If any check fails, the bot exits.
#### Observability API
When `enable_observability_api` is enabled, the bot serves a read-only HTTP API on port `3000`:
> **Do not expose this service directly to the public internet.** The reference service binds `0.0.0.0:3000`, permits broad CORS, and `/accounts` exposes tracked positions. Bind privately where supported, firewall the port, or place it behind an authenticated reverse proxy. Restrict CORS, monitor access, and treat the service as operationally sensitive even though its methods are read-only.
* `GET /health` — current state (`Syncing`, `Healthy`, or `Error`).
* `GET /accounts` — tracked accounts with computed health, dependent oracles, and positions.
* `GET /oracles` — known oracles with their latest cached value.
### Supported chains
The `configs/` directory contains chain-specific configuration. Adding a chain requires compatible deployed contracts, valid addresses, RPC and subgraph/data access, oracle support, code-path compatibility, a reviewed `Config.<chain_id>.toml`, and end-to-end simulation and submission testing. Confirm current support and addresses against the pinned repository and [Contract addresses](/build/contract-addresses) before production use.
### Run it
The bot is a Rust binary (Cargo, edition 2024). Build and run from a directory containing the relevant config file:
Load signing keys from a secret manager. Use a least-privilege, minimally funded signer; keep secrets out of shell history, process listings, and logs; and monitor simulation and submission failures. The environment exports below illustrate required names only and are not a recommended production secret-loading method.
```bash
cargo build --release
export CHAIN_ID=1
export RPC_URL_1="https://your-mainnet-rpc"
export SUBGRAPH_URL_PREFIX="https://your-subgraph-host/"
export EOA_ADDRESS="0xYourWalletAddress"
export EOA_PRIVATE_KEY="0xYourPrivateKey"
cd configs
../target/release/liquidation-bot-v3
```
A multi-stage Dockerfile is included. It uses [Doppler](https://www.doppler.com/) for secret injection by default; the entrypoint is straightforward to adapt if you supply environment variables another way. The image does not include Foundry, so `simulation_mode` (which spawns a local Anvil fork) requires adding Foundry to the image or running the bot outside Docker.
### Operator checklist
Use this non-exhaustive checklist before running a liquidation bot with real funds:
* Target chain, RPC endpoints, oracle polling and resync intervals, and retry behavior.
* Current EVC, lens, oracle, swapper, liquidator, and Pyth contract addresses for the chain.
* Account-health calculation against the controller vault's `accountLiquidity` behavior.
* Oracle routes, pull-oracle (Pyth) update requirements, and stale-price handling.
* Profit threshold, gas model, slippage limits, swap routing, and profit receiver.
* Secret-manager integration, least-privilege signer funding, nonce management, transaction replacement, and submission method.
* Observability API, metrics, logs, alerting, and incident response.
* A `simulation_mode` rehearsal against a fork and small-size runs before production sizing.
### Risks
Liquidation automation is competitive and operationally sensitive. A bot can lose money through stale data, reverted transactions, bad quotes, oracle updates, gas spikes, RPC failures, private-key compromise, or unexpected vault configuration. Treat the reference bot and dashboard as starting points, not guarantees.
### Read next
* [Liquidations](/learn/liquidations)
* [Interact with Euler](/build/evc/integration-guide)
* [Data querying](/build/data-querying)
* [Audits](/security/audits)
## Euler SDK
The Euler V2 SDK is the recommended TypeScript entry point for applications, bots, scripts, and operational tooling built on Euler V2. It reads protocol data, composes Ethereum Vault Connector (EVC) batches, simulates transactions, resolves approvals, and executes plans from frontend or backend clients.
The SDK package lives in the [`euler-sdks`](https://github.com/euler-xyz/euler-sdks/tree/main/packages/euler-v2-sdk) monorepo. Use this page as the high-level entry point, then follow the package docs and runnable examples for implementation details.
### What the SDK Provides
* Fetching account, vault, wallet, and market data
* Planning and composing EVC transaction batches
* Resolving approvals (standard `approve` and Permit2 paths)
* Simulating and estimating transaction plans with optional state overrides
* Swaps, pricing, rewards, labels, FeeFlow, and deployed address resolution
* Oracle adapter metadata and checks (provider, methodology, validation)
The SDK is built with dependency injection: use `buildEulerSDK()` for the default setup, run individual services in isolation, or plug in custom implementations.
### Installation
Use the latest stable release:
```bash
npm install @eulerxyz/euler-v2-sdk
```
### Minimal Setup
```typescript
import { buildEulerSDK } from "@eulerxyz/euler-v2-sdk";
import { mainnet } from "viem/chains";
const sdk = await buildEulerSDK({
config: {
rpcUrls: {
[mainnet.id]: "https://your-mainnet-rpc",
},
},
});
```
You can also configure RPC URLs with environment variables:
```bash
EULER_SDK_RPC_URL_1=https://your-mainnet-rpc
```
### Common Workflows
#### Read Accounts And Vaults
Use `accountService`, `portfolioService`, and `vaultMetaService` for user and market data.
```typescript
const { result: account } = await sdk.accountService.fetchAccount(
mainnet.id,
"0xOwner...",
{
populateAll: true,
},
);
const { result: portfolio } = await sdk.portfolioService.fetchPortfolio(
mainnet.id,
"0xOwner...",
);
const { result: vault } = await sdk.vaultMetaService.fetchVault(
mainnet.id,
"0xVault...",
);
```
Use `vaultMetaService` when you do not know whether an address is an EVault, EulerEarn vault, or another supported vault type.
Services can enrich (populate) their own entities with data from other services. For example, the account service can fetch vault details, token prices, rewards, and other data for user positions.
#### Plan, Simulate, And Execute Transactions
The `executionService` builds transaction plans for common Euler actions such as deposit, borrow, repay, withdraw, redeem, multiply, liquidation, debt transfer, and swap-driven flows. Plans separate required approvals from executable EVC batch items.
```typescript
import { parseUnits } from "viem";
const { result: account } = await sdk.accountService.fetchAccount(
mainnet.id,
"0xOwner...",
);
const plan = sdk.executionService.planDeposit({
account,
vault: "0xVault...",
asset: "0xAsset...",
receiver: "0xReceiverOrSubAccount...",
amount: parseUnits("100", 6),
enableCollateral: true,
});
const simulation = await sdk.executionService.simulateTransactionPlan(
mainnet.id,
account,
plan,
{ stateOverrides: true },
);
if (simulation.canExecute) {
await sdk.executionService.executeTransactionPlan({
plan,
chainId: mainnet.id,
account,
sendTransaction: walletClient.sendTransaction,
signTypedData: walletClient.signTypedData,
});
}
```
`executeTransactionPlan` processes configured plugins, resolves approvals, requests Permit2 signatures when needed, sends direct contract calls, and submits the final EVC batch.
#### Use Swaps, Rewards, Plugins, And FeeFlow
Use `swapService` for quote-backed operations such as repay-with-swap, deposit-with-swap, wallet-to-wallet swaps, wallet swap-and-borrow, wallet swap-and-repay, withdraw-and-swap, redeem-and-swap, swap collateral, and swap debt.
Use `rewardsService` to fetch campaign data, populate account and vault rewards, and build provider-specific reward claim plans.
Use `feeFlowService` to fetch FeeFlow state, filter eligible vaults, and build FeeFlow buy plans.
Use plugins for flows that need extra read-path or plan-path behavior, such as pull-based oracle updates.
### Examples
The repository ships with runnable examples:
* [TypeScript script examples](https://github.com/euler-xyz/euler-sdks/tree/main/packages/euler-v2-sdk/examples) - deposits, borrows, swaps, swap-and-borrow, swap-and-repay, withdraw-and-swap, redeem-and-swap, liquidations, wallet reads, simulations, FeeFlow, and end-to-end execution flows.
* [React app example](https://github.com/euler-xyz/euler-sdks/tree/main/packages/euler-v2-sdk/examples/react-sdk-example) - full frontend using React Query and Wagmi.
### Further Reading
Detailed documentation lives in [`packages/euler-v2-sdk/docs`](https://github.com/euler-xyz/euler-sdks/tree/main/packages/euler-v2-sdk/docs), covering:
* [Configuration](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/configuration.md)
* [Config Through Env](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/config-through-env.md)
* [Basic Usage](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/basic-usage.md)
* [SDK Architecture Overview](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/sdk-architecture-overview.md)
* [Services](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/services.md)
* [Wallet Service](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/wallet-service.md)
* [Execution Service](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/execution-service.md)
* [Simulations And State Overrides](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/simulations-and-state-overrides.md)
* [Swaps](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/swaps.md)
* [Pricing System](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/pricing-system.md)
* [Rewards Service](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/rewards-service.md)
* [Fee Flow Service](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/fee-flow-service.md)
* [Data Architecture](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/data-architecture.md)
* [Cross-Service Data Population](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/cross-service-data-population.md)
* [Portfolio](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/portfolio.md)
* [Account Computed Properties](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/account-computed-properties.md)
* [Caching External Data Queries](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/caching-external-data-queries.md)
* [Plugins](https://github.com/euler-xyz/euler-sdks/blob/main/packages/euler-v2-sdk/docs/plugins.md)
* [Labels](https://github.com/euler-xyz/euler-sdks/blob/ma프로젝트로 돌아가기