Integration Guide
This guide covers everything you need to integrate with Flux as a manager—from registering your executor to executing complex multi-protocol strategies with automated risk management.
Overview
As a manager in Flux, you get:
Automated Liquidation Protection: Continuous monitoring and liquidation management
Atomic Flexibility: Execute complex, multi-leg strategies in single transaction
Permissionless Execution: Swap, farm, LP, hedge—any on-chain action
Leveraged Capital: Access 5-10x your posted bond
Verifiable Collateral: Build trust through transparent bond requirements
The Only Rule: Return the vault's whitelisted assets by end of callback.
Getting Started
Step 1: Register an Executor
Before borrowing from any vault, you must register an executor that implements the callback interface. Once you have registered an executor, you can use it for all subsequent vault interactions.
Option A: Deploy Weiroll Executor (Recommended)
import {IFluxVaultFactory} from "flux-v1-contracts/interfaces/IFluxVaultFactory.sol";
contract ManagerSetup {
IFluxVaultFactory public factory;
function deployExecutor() external returns (address executor) {
// Deploy a Weiroll executor owned by you
executor = factory.deployWeirollExecutor();
// Automatically registered to msg.sender
// Can now borrow from any vault
}
}Option B: Deploy Custom Executor
Step 2: Choose a Vault
Select a vault based on:
Understanding the Unlock Pattern
All manager operations use the unified unlock() callback:
This is atomic: Either everything succeeds or everything reverts.
Borrowing Capital
Initial Borrow
Check Borrowing Capacity
Trading Assets
Register Asset Wrapper
Before depositing to a wrapper, register it:
Execute Trade (Swap + Deposit)
Complex Multi-Protocol Strategy
Here's a real example of delta-neutral farming:
Managing Collateral
Add Collateral (Improve Health)
Remove Collateral (If Health Allows)
Repaying Debt
Partial Repayment
Full Exit
Monitoring Position Health
Check Health Ratio
Set Up Alerts
Calculate Interest Owed
Advanced Patterns
Leveraged Yield Farming
Cross-Protocol Arbitrage
Best Practices
1. Always Monitor Health
2. Use Slippage Protection
3. Handle Callback Failures Gracefully
4. Test with Small Amounts First
5. Maintain Health Buffer
Risk Management
Interest Cost Tracking
Position Sizing
Read more about managing risk as a manager.
Complete Manager Integration Example
Learn More
Last updated