bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 26쪽 중 25쪽
uler-simple-avalanche/latest/gn](https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-avalanche/latest/gn) |
| Linea | 59144 | [https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-linea/latest/gn](https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-linea/latest/gn) |
| BOB | 60808 | [https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-bob/latest/gn](https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-bob/latest/gn) |
| Berachain | 80094 | [https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-berachain/latest/gn](https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-berachain/latest/gn) |
### Schema
The simple subgraph indexes vaults deployed by the EVK vault factory, the EulerEarn factory, and the Securitize collateral vault factory, and tracks account activity from vault `Transfer`, `Borrow`, and `Repay` events. It exposes three entities:
| Entity | Keyed by | Purpose |
| ----------------------- | ------------------------------- | -------------------------------------------------------------------------------------- |
| `Vault` | vault address | All indexed vaults and the factory that deployed them |
| `TrackingActiveAccount` | address prefix (first 19 bytes) | Lists of active deposit and borrow positions for all sub-accounts sharing a prefix |
| `TrackingVaultBalance` | account + vault (concatenated) | Internal data structure used to maintain the active position lists — do not rely on it |
The subgraph tells you **where** positions are, not their current size. `TrackingVaultBalance` holds raw values captured at the time of the last event and is immediately outdated — debt in particular accrues interest every second, but the subgraph only re-captures it when a new event touches the position. Read current balances, debt, and health through [lens contracts](./using-lens-contracts) or the [Euler V3 API](./euler-v3-api) instead.
### Address Prefixes
The key difference from the previous subgraphs: account activity is **grouped by address prefix, not by account address**. On Euler, every owner address controls 256 virtual sub-accounts via the [EVC](../evc/index). All of them share the first 19 bytes of the address and differ only in the last byte. The subgraph keys `TrackingActiveAccount` by this shared prefix, so a single query returns positions across all of a user's sub-accounts.
To compute the prefix, lowercase the address and drop the last byte (the last two hex characters):
```js
// 0x + 38 hex characters = first 19 bytes
const getAddressPrefix = (address) => address.toLowerCase().slice(0, 40);
getAddressPrefix("0x2B5A103a91B78E1352fDe6d3b7526bd932d1a2C4");
// => "0x2b5a103a91b78e1352fde6d3b7526bd932d1a2"
```
### How to Get Active Positions of an Account
This is the primary use case for the simple subgraph, and the exact flow used by the Euler apps and the [Euler SDK](../sdk).
#### Step 1: Query the Subgraph by Address Prefix
Use the `trackingActiveAccount` query with the address prefix as the `id`:
```graphql
query AccountPositions($prefix: ID!) {
trackingActiveAccount(id: $prefix) {
deposits
borrows
}
}
```
`deposits` and `borrows` are lists of active positions, each entry a concatenation of the sub-account address (20 bytes) and the vault address (20 bytes), e.g. `0x000000000000000000000000000000000000deade1ce9af672f8854845e5474400b6ddc7ae458a10`.
To parse the entries in JavaScript:
```js
import { getAddress } from "viem";
function parseEntry(entry) {
return {
subAccount: getAddress(entry.substring(0, 42)),
vault: getAddress(`0x${entry.substring(42)}`),
};
}
```
* `subAccount` is the sub-account holding the position
* `vault` is the vault the position is in
To look up several users in one request, batch the prefixes with `trackingActiveAccounts`:
```graphql
query AccountVaults($ids: [String!]!) {
trackingActiveAccounts(where: { id_in: $ids }) {
id
deposits
borrows
}
}
```
#### Step 2: Fetch Detailed Data Using Lens Contracts
Once you have the list of sub-accounts and vaults, use the [lens contracts](./using-lens-contracts) for detailed information:
* Use **`AccountLens`** for account-level data (balances, health, rewards, etc.)
* Use **`VaultLens`** for vault-specific details (configuration, caps, rates, etc.)
#### Step 3: Filter for Known Vaults
Use the [known-vault endpoints](./perspectives) to check whether a vault is known and to fetch its metadata (name, curator, deprecation status). This helps filter out unknown or experimental vaults — note that a vault being known is not a safety guarantee; only its initial configuration was reviewed.
### Other Queries
#### List Indexed Vaults
```graphql
query Vaults {
vaults(first: 1000, orderBy: id, orderDirection: asc) {
id
factory
}
}
```
#### Check Indexing Status
Use `_meta` to check how far the subgraph has indexed — useful for waiting until a recent transaction is reflected in query results:
```graphql
{
_meta {
block {
number
}
}
}
```
## Using Lens Contracts
This guide is for developers, analysts, and integrators who want to query protocol data efficiently and make sense of the results. We'll walk through practical examples and explain the key data types you'll encounter. If you would rather not call the contracts directly, the [Euler SDK](/build/sdk) wraps these lens queries behind typed helpers; the examples below show the underlying calls.
The contract ABIs and deployment addresses for lens contracts are available in the [euler-interfaces](https://github.com/euler-xyz/euler-interfaces) repository. Be sure to use the correct address for your target network.
### Connecting to a Lens Contract
To interact with a lens contract, you'll typically use a web3 library like ethers.js. All lens contracts are read-only, so you can call them from any off-chain context (scripts, dashboards, bots, etc.).
**Example: Connecting to `AccountLens`**
```js
const { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider(RPC_URL);
const accountLens = new ethers.Contract(ACCOUNT_LENS_ADDRESS, AccountLensABI, provider);
```
### Querying Account Data: `getAccountInfo`
The `getAccountInfo(account, vault)` function returns a comprehensive snapshot of a user's position in a vault. The result is an `AccountInfo` struct, which contains several nested types:
* **`EVCAccountInfo`:** General info about the EVC sub-account (owner, enabled controllers/collaterals, status flags)
* **`VaultAccountInfo`:** Position data for the vault (balances, shares, borrowings, collateral/controller status, liquidity info)
* **`AccountRewardInfo`:** On-chain reward and incentive data (balances and earned rewards)
If you want to query the same data for all enabled collaterals and controllers of an account in one call, use `getAccountEnabledVaultsInfo(evc, account)`. This function returns arrays of the same types for every enabled vault, making it efficient to fetch a user's full protocol exposure. Note that this function only returns data for vaults that are explicitly enabled as collateral or controller in the EVC - it won't return information about deposits in vaults that aren't enabled as collateral.
**Example:**
```js
const account = "0x...";
const vault = "0x...";
const info = await accountLens.getAccountInfo(account, vault);
// Accessing nested data:
console.log("Owner:", info.evcAccountInfo.owner);
console.log("Vault shares:", info.vaultAccountInfo.shares);
console.log("Borrowed:", info.vaultAccountInfo.borrowed);
console.log("Is Controller:", info.vaultAccountInfo.isController);
console.log("Earned rewards:", info.accountRewardInfo.enabledRewardsInfo);
```
#### Understanding the Types
* **`AccountInfo`**: The top-level struct, grouping all relevant data for a user/vault pair.
* **`EVCAccountInfo`**: Includes the EVC address, owner, enabled controllers/collaterals, and status flags (e.g., lockdown mode).
* **`VaultAccountInfo`**: Contains balances, shares, borrowings, allowances, collateral/controller status, and liquidity info (including time to liquidation and collateral values).
* **`AccountRewardInfo`**: Shows reward balances and details for any enabled onchain rewards.
> **Tip:** Many fields are nested structs or arrays. Use dot notation to access them (e.g., `info.vaultAccountInfo.liquidityInfo.timeToLiquidation`).
#### Position Health, Collateral Value, and Health Score
When analyzing your account's risk and health, it's important to understand how the protocol evaluates your positions. Here are some key concepts and how to extract them using the lens contracts:
* **Health Score (Health Rate):**
* The health score is a measure of how safe your borrow position is. It is calculated as:
`healthScore = collateralValueLiquidation / liabilityValueLiquidation`
where both values are found in `VaultAccountInfo.liquidityInfo`.
* To get the health score for a borrow position, you must query the vault from which you borrowed (the controller vault). In the context of `getAccountEnabledVaultsInfo`, this will be the vault where `isController` is true.
* **Risk-Adjusted Collateral Value:**
* The protocol uses different collateral values for borrowing and for liquidation:
* `collateralValueBorrowing`: The value of your enabled collaterals as seen for borrowing purposes.
* `collateralValueLiquidation`: The value of your enabled collaterals as seen for liquidation purposes (usually more conservative).
* Both are available in `VaultAccountInfo.liquidityInfo`.
* These values are aggregated across all enabled collaterals for the position, but you can also see the breakdown per collateral in the `collateralValuesBorrowing` and `collateralValuesLiquidation` arrays.
* **Collateral Market Value (Raw):**
* The raw market value of your collaterals, as seen by the controller vault, is given by `collateralValueRaw` in `VaultAccountInfo.liquidityInfo`.
* The breakdown per collateral is available in the `collateralValuesRaw` array.
* **Off-Chain Collateral Market Value:**
* If you want to compute the market value of your collateral using off-chain prices, multiply your collateral **asset balance** (not shares) by the current market price of the asset. For example:
`offChainCollateralValue = assetsAccount * assetPrice`
where `assetsAccount` is the asset balance from `VaultAccountInfo.assetsAccount` and `assetPrice` is the off-chain price per unit of the asset.
* Note: For some assets, you may need to use your own price source if the [Data API price endpoints](/build/data-querying/euler-v3-api#fetching-prices-from-the-euler-v3-api) do not return a value.
> **Tip:** The `getAccountEnabledVaultsInfo` function returns an `AccountMultipleVaultsInfo` struct, which contains an array of `VaultAccountInfo` for each enabled collateral and controller. For borrow positions, focus on the vault where `isController` is true to get the health and risk data for your position.
### Querying Vault Data: `getVaultInfoFull`
The `getVaultInfoFull(vault)` function (from `VaultLens`) returns a `VaultInfoFull` struct, which is a detailed snapshot of a vault's configuration and state.
**Example:**
```js
const vaultLens = new ethers.Contract(VAULT_LENS_ADDRESS, VaultLensABI, provider);
const vaultInfo = await vaultLens.getVaultInfoFull(vault);
console.log("Vault name:", vaultInfo.vaultName);
console.log("Total assets:", vaultInfo.totalAssets);
console.log("Interest rate model:", vaultInfo.interestRateModel);
console.log("Supply cap:", vaultInfo.supplyCap);
console.log("Recognized collaterals:", vaultInfo.collateralLTVInfo);
```
#### Key Types in `VaultInfoFull`
* **`VaultInfoFull`**: The main struct, with fields for vault configuration, totals, caps, fees, IRM, oracles, hooks, and more.
* **`LTVInfo[]`**: An array of collateral types and their LTV (Loan-to-Value) parameters. Each `LTVInfo` includes the collateral address, borrow and liquidation LTVs, and ramping info.
* **`VaultInterestRateModelInfo`**: Details about the vault's interest rate model, including type and parameters.
* **`AssetPriceInfo`**: Price and oracle data for assets and collaterals.
> **Tip:** Arrays like `collateralLTVInfo` are append-only, so not all entries may be active collaterals. Always check the LTV values - a collateral with zero `borrowLTV` is no longer accepted as collateral. Only iterate through entries with non-zero LTVs to display currently supported collaterals and their risk parameters.
> **Tip:**
> If a vault is ramping down its liquidation LTV, you can calculate the current liquidation LTV for a collateral using the following formula, based on the fields in the `LTVInfo` struct returned by the lens:
>
> ```js
> // LTVInfo fields:
> // - liquidationLTV: target value (uint256)
> // - initialLiquidationLTV: starting value at ramp start (uint256)
> // - targetTimestamp: when ramping ends (uint256, unix time)
> // - rampDuration: total ramp duration (uint256, seconds)
>
> function getCurrentLiquidationLTV(ltvInfo) {
> const now = Math.floor(Date.now() / 1000); // current unix timestamp
> if (
> now >= ltvInfo.targetTimestamp ||
> ltvInfo.liquidationLTV >= ltvInfo.initialLiquidationLTV
> ) {
> return ltvInfo.liquidationLTV;
> }
> const timeRemaining = ltvInfo.targetTimestamp - now;
> return (
> ltvInfo.liquidationLTV +
> ((ltvInfo.initialLiquidationLTV - ltvInfo.liquidationLTV) * timeRemaining) /
> ltvInfo.rampDuration
> );
> }
> ```
>
> This matches the on-chain logic: the liquidation LTV linearly ramps from `initialLiquidationLTV` to `liquidationLTV` over the period ending at `targetTimestamp`. If ramping is not active, just use `liquidationLTV`.
### Querying APYs for a Vault
To quickly fetch the current borrow and supply APYs for a vault, use the `getAPYs(vault)` function from the `UtilsLens` contract. This function returns the annualized borrow and supply rates, computed based on the vault's current interest rate model and utilization.
**Example:**
```js
const utilsLens = new ethers.Contract(UTILS_LENS_ADDRESS, UtilsLensABI, provider);
const [borrowAPY, supplyAPY] = await utilsLens.getAPYs(vault);
console.log("Borrow APY:", borrowAPY);
console.log("Supply APY:", supplyAPY);
```
The returned values are typically expressed in ray units (`1e27`), so you may need to convert them to a human-readable percentage (e.g., `Number(borrowAPY) / 1e25` gives the APY as a percent with two decimals).
> **Note:** The APYs returned here only include the Euler rates from lending and borrowing activity within the protocol. They do **not** include any intrinsic APY from the underlying asset (for example, the staking yield of wstETH) or any additional rewards. To account for those, you must supplement with external data sources.
### Where to Find Type Definitions and More Resources
The full definitions of all structs and types used by lens contracts can be found in the [LensTypes.sol](https://github.com/euler-xyz/evk-periphery/blob/master/src/Lens/LensTypes.sol) file in the EVK Periphery repository.
## Fee Flow
Euler does not currently charge protocol fees. In April 2026, Fee Flow was turned off and Euler protocol fees were set to 0% across live and future deployments. The DAO can reintroduce protocol fees through future governance. See [Reduce Euler Protocol Fees to Zero](https://forum.euler.finance/t/proposal-reduce-euler-protocol-fees-to-zero/1835/1).
Curators and vault operators may still configure separate vault-level fees, such as EVK interest fees or EulerEarn performance fees, where supported by the relevant vault.
Fee Flow is a continuous sequence of Dutch auctions. A `FeeFlowController` can hold multiple fee assets and has one immutable payment token and payment receiver. For Euler's EUL-denominated deployment, a buyer pays EUL and receives the controller's **entire balances of the asset addresses supplied to `buy`**. This is an asset sale for EUL, not an auction in which bidders offer progressively larger amounts.
### Mechanics
1. The current payment amount starts at the epoch's `initPrice` and decreases linearly to zero over `epochPeriod`.
2. A caller chooses the asset-address list and receiver, and supplies the current epoch ID, a deadline, and a maximum payment amount.
3. `buy` transfers the current payment amount from the caller to the immutable `paymentReceiver`, then transfers the controller's full balance of every supplied asset to `assetsReceiver`.
4. Settlement immediately starts the next epoch. Its initial price is the settlement payment multiplied by `priceMultiplier`, bounded below by `minInitPrice` and above by the contract maximum.
The contract does **not** value its inventory, determine when inventory is worth the price, or require a bid contest. Buyers make that assessment offchain. If an asset is omitted from the supplied list, it remains in the controller. After an epoch has elapsed the computed payment can be zero, subject to transaction ordering and the caller's safeguards.
```solidity
feeFlow.buy(
assets, // assets to sweep from the controller
assetsReceiver,
currentEpochId,
deadline,
maxPaymentTokenAmount
);
```
Use `getSlot0()` and `getPrice()` immediately before constructing a purchase. Protect execution with the epoch ID, deadline, maximum payment, private transaction strategy where appropriate, and an independently verified inventory list. A malicious token in the list can revert or behave unexpectedly.
### Accounting taxonomy
Keep these quantities separate:
* **Fee inventory:** non-payment assets held by the controller and available to a buyer.
* **Auction receipts:** payment tokens transferred directly to `paymentReceiver` at settlement.
* **Treasury-held EUL:** EUL controlled by a DAO treasury address or another DAO-controlled position.
* **Reward inventory/distributions:** EUL committed to or distributed by reward programs, including rEUL backing where applicable.
* **Burned EUL:** EUL actually sent to a burn address or otherwise destroyed according to the relevant token contract.
Paying EUL into Fee Flow does not itself burn EUL. Nor does the contract itself prove that its payment receiver is DAO-controlled; verify constructor parameters and receiver control for the deployment.
### Current status
Fee Flow has been turned off and Euler protocol fees are currently set to zero. Before integrating against a historical or future deployment, verify the relevant chain's `ProtocolConfig`, vault fee configuration, Fee Flow address, and governance state. Vault-level curator or governor fees are separate from protocol fees.
### Sources
* [`FeeFlowController.sol`](https://github.com/euler-xyz/fee-flow/blob/master/src/FeeFlowController.sol)
* [Fee Flow whitepaper](https://github.com/euler-xyz/fee-flow/blob/master/docs/whitepaper.md)
* [DAO treasury taxonomy](/euler-dao/treasury)
## Multichain EUL
Some EUL deployments use LayerZero OFT adapters. The set of networks, trusted peers, routes, limits, fees, and any preferred hubs are configuration facts that can change. Do not assume every EUL deployment can transfer directly to every other deployment, or that a historical hub-and-spoke proposal still describes current peers.
Ethereum's address files identify the original EUL token and an `eulOFTAdapter`; other chains may identify a bridged token or adapter. A label such as `MintBurnOFTAdapter` describes contract behavior, not current connectivity or governance.
### Before bridging
1. Obtain token and bridge addresses from [EUL addresses](/EUL/addresses) and the linked source files.
2. Verify the source and destination chain IDs and deployed bytecode.
3. Inspect the adapter's configured LayerZero peers and enforced options for that exact route.
4. Use the adapter/bridge quote for fees and limits; do not rely on a copied route diagram.
5. Con프로젝트로 돌아가기