Deploying Wrappers

Learn how to deploy asset wrappers for integrating new asset types with Flux Protocol.

Deploying a Wrapper

For Standard ERC20 Tokens

Most ERC20 tokens can use the standard wrapper:

// Deploy ERC20 wrapper for USDT
IAssetFactory factory = IAssetFactory(ASSET_FACTORY_ADDRESS);

address usdtWrapper = factory.deployERC20Wrapper(
    USDT_ADDRESS,          // Underlying token
    ORACLE_ADDRESS,        // Price oracle
    "Wrapped USDT",        // Wrapper name
    "wUSDT"                // Wrapper symbol
);

For LP Tokens

Deploy LP wrapper for Uniswap V2/V3 positions:

// Deploy Uniswap V2 LP wrapper
address lpWrapper = factory.deployUniswapV2Wrapper(
    UNI_V2_PAIR_ADDRESS,  // LP token address
    ORACLE_REGISTRY,       // Oracle for pricing
    "Wrapped UNI-V2",
    "wUNI-V2"
);

For Yield-Bearing Tokens

Deploy wrappers for assets that accrue value:


Wrapper Factory

The wrapper factory simplifies deployment:


Verification

After deployment, verify the wrapper:


Adding to Strategy

After deploying, add wrapper to strategy's allowed assets:


Best Practices

  1. Verify oracle - Ensure reliable price feed

  2. Test thoroughly - Test deposit/withdraw flows

  3. Check decimals - Handle decimal conversions correctly

  4. Audit custom wrappers - Get security review

  5. Document clearly - Explain wrapper behavior


Example: Custom Wrapper


Last updated