Skip to content

Commit e7ea8ff

Browse files
committed
docs: add FeeAbstraction Composer
Signed-off-by: shankar <shankar@layerzerolabs.org>
1 parent bd86476 commit e7ea8ff

1 file changed

Lines changed: 77 additions & 5 deletions

File tree

packages/hyperliquid-composer/HYPERLIQUID.README.md

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,18 +319,90 @@ contract HyperLiquidComposer is IHyperLiquidComposer {
319319
}
320320
```
321321

322-
### There are 2 extensions for Hyperliquid Composers
322+
### There are 3 extensions for Hyperliquid Composers
323323

324324
#### Recovery Extension
325325

326-
This gives you the ability to pull tokens our of the composer on hypercore and into the composer's address on hyperevm.
327-
The priviledged address can also send those tokens to itself on HyperEVM, giving you the ability to recover locked tokens.
326+
This gives you the ability to pull tokens out of the composer on HyperCore and into the composer's address on HyperEVM.
327+
The privileged address can also send those tokens to itself on HyperEVM, giving you the ability to recover locked tokens.
328+
329+
**Use Case:** Useful for any token deployment where you want the ability to recover tokens that may become stuck in the composer contract.
330+
331+
**Constructor Arguments:**
332+
- `oft`: OFT address
333+
- `coreIndex`: Core spot index
334+
- `weiDiff`: Decimal difference between EVM and Core
335+
- `recoveryAddress`: Address with recovery privileges
328336

329337
#### FeeToken Extension
330338

331-
This extension is for tokens that are a `FeeToken` - can be used to activate users on hypercore. Should a composer deployed with this extension notice that a user's address has not been activated then it would send across bridge across the whole amount of tokens to HyperCore and then send across `amt - activationFee` to the user. This consumes `activationFee` from the composer's address.
339+
This extension is for tokens that are a **quote asset** (fee token) - tokens that can be used to activate users on HyperCore.
340+
341+
**How it Works:**
342+
When the composer detects that a user's address has not been activated on HyperCore, it:
343+
1. Sends the full amount of tokens across the bridge to HyperCore
344+
2. Transfers `amt - activationFee` to the user
345+
The transfer automatically consumes `activationFee` from the composer's address to activate the user
346+
347+
**Example:** User sends `1.5 USDT0` to a new address. The composer sends over `1.5 USDT0` to itself on HyperCore, then makes a core transfer of `0.5 USDT0` to the user. The `1.0 USDT0` activation fee is automatically consumed.
348+
349+
**Requirements:**
350+
- Token **must be a quote asset** (see [Quote Assets section](#quote-assets-fee-tokens))
351+
- Deployment scripts automatically verify this requirement
352+
- If not a quote asset, deployment will fail with guidance to use alternative composers
353+
354+
**Constructor Arguments:**
355+
- `oft`: OFT address
356+
- `coreIndex`: Core spot index
357+
- `weiDiff`: Decimal difference between EVM and Core
358+
359+
On-chain deployments:
360+
USDT0 : [0x80123Ab57c9bc0C452d6c18F92A653a4ee2e7585](https://hyperevmscan.io/address/0x80123Ab57c9bc0C452d6c18F92A653a4ee2e7585)
361+
362+
#### FeeAbstraction Extension
363+
364+
This extension provides automatic user activation using a **different token** for fees, combined with price oracle integration for dynamic fee calculation.
365+
366+
**How it Works:**
367+
1. Checks if a user's address is activated on HyperCore
368+
2. Uses the hyperliquid's spot pair oracle to convert between your token and the fee token value
369+
3. Can charge an overhead fee (set on deployment) in addition to the base activation cost
370+
4. If there is insufficient quote asset balance, the composer will revert the transaction and user gets tokens on HyperEVM
371+
372+
**Key Features:**
373+
- **Price Oracle Integration**: Queries real-time prices via `spotId` (e.g., 107 for HYPE/USDC)
374+
- **Overhead Fee**: Configurable additional fee in cents (e.g., 100 = $1.00 overhead on top of $1.00 base activation)
375+
- **Recovery Capability**: Includes recovery address functionality for fee management
376+
- **Flexible Fee Token**: Can work with any token, not limited to quote assets
377+
378+
**Example Configuration:**
379+
- SpotId: `107` (HYPE/USDC pair for price queries)
380+
- Activation Overhead Fee: `100` cents (adds $1.00 overhead)
381+
- Total User Fee: $2.00 (Base $1.00 + Overhead $1.00)
382+
383+
**Use Case:** Ideal for non-quote-asset tokens where you want to provide seamless user activation without requiring users to hold quote assets.
384+
385+
**Constructor Arguments:**
386+
- `oft`: OFT address
387+
- `coreIndex`: Core spot index
388+
- `weiDiff`: Decimal difference between EVM and Core
389+
- `spotId`: Spot pair ID for price queries (e.g., 107 for HYPE/USDC)
390+
- `activationOverheadFee`: Overhead fee in cents
391+
- `recoveryAddress`: Address with recovery privileges for fee management
392+
393+
On-chain deployments:
394+
ENA : [0x5879d9821909A41cd3A382A990A4A5A6Ca77F2f0](https://hyperevmscan.io/address/0x5879d9821909A41cd3A382A990A4A5A6Ca77F2f0)
395+
396+
### Choosing the Right Composer
397+
398+
| Composer Type | Best For | Key Feature |
399+
|--------------|----------|-------------|
400+
| **Regular** | Standard tokens | Basic functionality, no extensions |
401+
| **Recoverable** | Any token | Token recovery capability |
402+
| **FeeToken** | **Quote assets only** | Automatic activation using your token |
403+
| **FeeAbstraction** | Non-quote assets | Automatic activation using oracle-priced fees |
332404

333-
Ex: User sends `1.5 USDT0` to an new address. The composer sends over `1.5 USDT0` to itself and then makes a core transfer of `0.5 USDT0`. The `1 USDT0` is consumed as Fee.
405+
> ⚠️ **Important**: The deployment scripts automatically check if your token is a quote asset and guide you to use the appropriate composer type. See [Quote Assets (Fee Tokens)](#quote-assets-fee-tokens) for more details.
334406
335407
## LayerZero Transaction on HyperEVM
336408

0 commit comments

Comments
 (0)