Euler V2¶
| Field | Value |
|---|---|
| Module | almanak.connectors.euler_v2 |
| Protocol kind | Lending |
| Aliases | N/A |
Supported Chains And Intents¶
| Chain | Family | Supported Intents |
|---|---|---|
| Arbitrum | EVM | BORROW, REPAY, SUPPLY, WITHDRAW |
| Avalanche | EVM | BORROW, REPAY, SUPPLY, WITHDRAW |
| Base | EVM | BORROW, REPAY, SUPPLY, WITHDRAW |
| Ethereum | EVM | BORROW, REPAY, SUPPLY, WITHDRAW |
API Reference¶
almanak.connectors.euler_v2
¶
Euler V2 lending protocol connector for Avalanche.
Euler V2 uses ERC-4626 vaults with the Ethereum Vault Connector (EVC) for cross-vault collateral/borrow relationships.
Supported operations: SUPPLY, WITHDRAW, BORROW, REPAY
EulerV2Adapter
¶
Adapter for Euler V2 lending protocol on Avalanche.
Builds raw transaction data for supply, withdraw, borrow, and repay operations against Euler V2 ERC-4626 vaults.
find_vault_for_asset
¶
find_vault_for_asset(
asset_symbol: str, vault_symbol: str | None = None
) -> EulerV2VaultInfo | None
Find an Euler V2 vault for a given asset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset_symbol
|
str
|
Token symbol (e.g., "USDC", "WAVAX") |
required |
vault_symbol
|
str | None
|
Optional specific vault symbol (e.g., "eUSDC-19") |
None
|
Returns:
| Type | Description |
|---|---|
EulerV2VaultInfo | None
|
EulerV2VaultInfo or None if not found |
get_supported_assets
¶
Return list of supported underlying asset symbols.
supply
¶
Build a deposit transaction for an Euler V2 vault.
Uses ERC-4626 deposit(uint256 amount, address receiver).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
str
|
Token symbol to deposit (e.g., "USDC") |
required |
amount
|
Decimal
|
Amount in human-readable units |
required |
vault_symbol
|
str | None
|
Optional specific vault symbol |
None
|
Returns:
| Type | Description |
|---|---|
TransactionResult
|
TransactionResult with tx_data for deposit |
withdraw
¶
withdraw(
asset: str,
amount: Decimal,
withdraw_all: bool = False,
vault_symbol: str | None = None,
) -> TransactionResult
Build a withdraw transaction for an Euler V2 vault.
Uses ERC-4626 withdraw(uint256 assets, address receiver, address owner) for specific amounts, or redeem(uint256 shares, address receiver, address owner) with MAX_UINT256 for withdraw_all.
A full exit does NOT bound the request by vault liquidity: MAX caps to the
owner's BALANCE, not to what the vault can SETTLE, so a cash-short vault
reverts E_InsufficientCash (0xf077d877). The compiler detects that
case ahead of time via maxRedeem(owner) and fails the compile
transiently rather than broadcasting a doomed transaction (VIB-5801).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
str
|
Token symbol to withdraw |
required |
amount
|
Decimal
|
Amount in human-readable units (ignored if withdraw_all=True) |
required |
withdraw_all
|
bool
|
If True, redeem all shares |
False
|
vault_symbol
|
str | None
|
Optional specific vault symbol |
None
|
Returns:
| Type | Description |
|---|---|
TransactionResult
|
TransactionResult with tx_data for withdraw |
borrow
¶
borrow(
borrow_asset: str,
borrow_amount: Decimal,
collateral_vault_address: str | None = None,
borrow_vault_symbol: str | None = None,
) -> TransactionResult
Build a borrow transaction for Euler V2.
Borrowing requires EVC setup: 1. enableCollateral(account, collateralVault) — register collateral 2. enableController(account, borrowVault) — grant borrow vault access 3. borrow(amount, receiver) — borrow from the vault
These are batched via EVC.batch() for atomicity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
borrow_asset
|
str
|
Token symbol to borrow |
required |
borrow_amount
|
Decimal
|
Amount in human-readable units |
required |
collateral_vault_address
|
str | None
|
Address of the collateral vault (must already have deposits) |
None
|
borrow_vault_symbol
|
str | None
|
Optional specific borrow vault symbol |
None
|
Returns:
| Type | Description |
|---|---|
TransactionResult
|
TransactionResult with tx_data for EVC batch |
repay
¶
repay(
asset: str,
amount: Decimal,
repay_all: bool = False,
vault_symbol: str | None = None,
) -> TransactionResult
Build a repay transaction for Euler V2.
Uses repay(uint256 amount, address receiver). For full repay, uses type(uint256).max which repays entire debt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
str
|
Token symbol to repay |
required |
amount
|
Decimal
|
Amount in human-readable units (ignored if repay_all=True) |
required |
repay_all
|
bool
|
If True, repay full debt using MAX_UINT256 |
False
|
vault_symbol
|
str | None
|
Optional specific vault symbol |
None
|
Returns:
| Type | Description |
|---|---|
TransactionResult
|
TransactionResult with tx_data for repay |
EulerV2Config
dataclass
¶
Configuration for EulerV2Adapter.
EulerV2VaultInfo
dataclass
¶
EulerV2VaultInfo(
vault_symbol: str,
vault_address: str,
underlying_symbol: str,
underlying_address: str,
decimals: int,
)
Information about an Euler V2 vault.
TransactionResult
dataclass
¶
TransactionResult(
success: bool,
tx_data: dict | None = None,
gas_estimate: int = 0,
description: str = "",
error: str | None = None,
)
Result of building a transaction.
EulerV2ParseResult
dataclass
¶
EulerV2ParseResult(
success: bool = False,
error: str | None = None,
deposit_amount: int = 0,
deposit_shares: int = 0,
withdraw_amount: int = 0,
withdraw_shares: int = 0,
borrow_amount: int = 0,
repay_amount: int = 0,
events: list[dict] = list(),
)
Result of parsing an Euler V2 transaction receipt.
EulerV2ReceiptParser
¶
Parser for Euler V2 transaction receipts.
Extracts deposit, withdraw, borrow, and repay data from on-chain events.
parse_receipt
¶
Parse a transaction receipt for Euler V2 events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
receipt
|
dict
|
Transaction receipt dict with 'logs' list |
required |
vault_address
|
str | None
|
Optional vault address to filter events |
None
|
Returns:
| Type | Description |
|---|---|
EulerV2ParseResult
|
EulerV2ParseResult with extracted data |
extract_supply_amount
¶
Extract supply amount from receipt for ResultEnricher.
Called by ResultEnricher for SUPPLY intents (field: supply_amount).
extract_borrow_amount
¶
Extract borrow amount from receipt for ResultEnricher.
Called by ResultEnricher for BORROW intents (field: borrow_amount).
extract_withdraw_amount
¶
Extract withdraw amount from receipt for ResultEnricher.
Called by ResultEnricher for WITHDRAW intents (field: withdraw_amount).
extract_repay_amount
¶
Extract repay amount from receipt for ResultEnricher.
Called by ResultEnricher for REPAY intents (field: repay_amount).
extract_primitive_money_legs
¶
VIB-5218 — declare the lending money legs as a typed PrimitiveMoneyLegs
the ledger dispatcher consumes directly (the Lido / Curve / Pendle pattern).
Inverts the legacy control flow (blueprint 27 §6.6): instead of the ledger
reverse-engineering a SUPPLY / WITHDRAW / BORROW / REPAY's token_in from
the intent (which it never matched for lending — landing an empty
token_in → asset = "UNKNOWN" → no FIFO lot → deployed_capital_usd =
0), the connector DECLARES the principal asset it actually moved on-chain.
Euler V2's ERC-4626 Deposit / Withdraw events (and the Euler-specific
Borrow / Repay) carry only assets / shares — NOT the
underlying token. The underlying is recovered from the emitting vault
address (the event's emitter) via the connector's static vault registry,
which also carries the underlying's decimals — so no token-resolver round-trip
is needed. Emits ONE PRINCIPAL leg (token = the underlying symbol, amount = a
human-unit MeasuredMoney), which the dispatcher projects onto token_in
/ amount_in.
Returns None (→ legacy fallback, byte-identical rows) when the receipt
carries no Euler V2 lending event or the emitting vault is not in the static
registry — so unknown-vault receipts degrade unchanged (Empty ≠ Zero). Never
raises: any failure degrades to None rather than halting the live
accounting writer.
extract_supply_data
¶
Extract supply data from receipt (legacy API).
extract_borrow_data
¶
Extract borrow data from receipt (legacy API).
extract_withdraw_data
¶
Extract withdraw data from receipt (legacy API).
extract_repay_data
¶
Extract repay data from receipt (legacy API).