Deposits
How deposits flow through the protocol - inflow detection, subaccounts, and share minting
Deposit Flow Overview
Step 1: Send Assets to a Deposit Address
Send assets to the unique deposit address shown in the app for your selected asset, network, and action. Liquidium supports both native-chain deposits and direct ckAsset deposits on ICP.
Bitcoin Deposits
- Send BTC to the Bitcoin deposit address shown in the app
- The address is derived from the protocol's threshold ECDSA key
- Deposits require 4 confirmations (~40 minutes)
Ethereum Asset Deposits
- Send supported Ethereum assets to the asset-specific Ethereum deposit address shown in the app
- The app displays deposit and repay addresses for each supported Ethereum asset and action
- If an address-based flow is unavailable, use the linked-wallet flow or another option shown in the app
Direct ckAsset Deposits on ICP
- You can deposit supported ckAssets, including ckBTC, ckETH, ckUSDC, and ckUSDT, directly over ICP
- Enable ICP assets in the app, select the asset and action, and send the exact ckAsset to the ICRC-1 deposit address shown
- You do not need to send or mint the corresponding native asset first
Always match the asset, network, and address shown in the app. Do not send a native asset to a ckAsset address, a ckAsset to a native-chain address, or a different token to the displayed address.
Native ICP Deposits
- Send ICP to the Account ID or ICRC address shown in the app
- The app displays the supported address format for your selected action
Step 2: Native Asset Conversion, When Needed
When you deposit a supported native asset from Bitcoin or Ethereum:
- The ckAsset minter detects the confirmed native transaction
- The minter creates the corresponding ckAsset tokens, such as ckBTC or ckETH
- The tokens are credited to your inflow subaccount
When you deposit an existing ckAsset directly over ICP, this conversion step is skipped. The protocol detects the ICRC ledger transfer to your inflow subaccount.
Inflow Subaccount Encoding
Liquidium derives a unique deposit subaccount from your profile principal:
- Prefix byte
0x1indicates deposit type - Followed by principal length and bytes
- Padded to 32 bytes
Step 3: Inflow Detection
The pool scans for new deposits every 60 seconds by querying the ledger for transactions since the last seen index. For each transaction to a pool subaccount, it decodes the subaccount type and schedules processing.
Key Features:
- Batch processing: Up to 10,000 transactions per scan
- Archive support: Fetches from ledger archives if needed
- Debouncing: Each subaccount processed once per scan
- Persistent tracking: Last seen index stored in stable storage
Step 4: Transfer to Treasury
After detection, funds are transferred from your inflow subaccount to the pool treasury. The treasury is the pool's main account with no subaccount, where all pool liquidity is held.
Step 5: Treasury Movement Detection
The pool monitors the treasury for incoming transfers every 60 seconds. When it detects a transfer from an inflow subaccount, it decodes the source, associates it with the correct Liquidium profile, and creates a DepositConfirmed event.
Step 6: Event Notification
Queued events are sent to the lending canister. The event queue is persistent (survives canister upgrades), retries on failure, and processes up to 100 events per tick.
Step 7: Share Minting
The lending canister processes the deposit event:
- Checks idempotency and skips events already processed
- Syncs pool indices
- Validates the supply cap
- Mints shares:
shares = deposit_amount / lending_index
Example: A 1.0 BTC deposit at lending_index = 1.05 mints 0.952 shares. If the index later reaches 1.10, the balance becomes 1.0472 BTC, representing 4.72% earned.
Timing Summary
Step | Trigger | Latency |
|---|---|---|
Source transfer confirmation | Bitcoin, Ethereum, or ICP ledger | Varies by route |
ckAsset minting | Minter | Native-chain deposits only |
Inflow detection | Timer | ~60 sec |
Treasury transfer | WAL | ~30 sec |
Treasury detection | Timer | ~60 sec |
Event notification | Timer | ~60 sec |
Share minting | Event | Immediate |
The app shows the estimated time for your selected route. Direct ckAsset deposits typically take about 2 minutes. Native-chain deposits take longer because they also require source-chain confirmations and ckAsset minting.
Error Handling
Multiple layers prevent double-crediting:
- Ledger index tracking: Each transaction processed once
- PROCESSED_INFLOWS set: Event deduplication
- Subaccount debouncing: One job per subaccount per scan
Deposits are automatically detected after you send the correct asset over the correct network to the exact deposit address shown in the app.