πŸ’²Integrating fxSAVE

To facilitate the integration of fxSAVE from any chain, Enso routed it. You'll find more information here.

Note that since fxSAVE withdrawal is a two-step process, Enso only routed the atomic withdrawal that charges a withdrawal fee. To avoid that fee, you can wait for the cooldown period instead.

Method 1: Direct Redemption via Router

function instantRedeemFromFxSave(
    LibRouter.ConvertOutParams memory fxusdParams,
    LibRouter.ConvertOutParams memory usdcParams,
    uint256 shares,
    address receiver
)

  • Parameter Struct Description (ConvertOutParams)

struct ConvertOutParams {
    address tokenOut;    // Address of the output token
    address converter;   // Address of the converter contract
    uint256 encodings;   // Encoding parameters for MultiPathConverter
    uint256[] routes;    // Route encodings for conversion
    uint256 minOut;      // Minimum expected amount of output token
    bytes signature;     // Optional data for future use
}

ConvertOutParams Example

ConvertOutParams defines how assets redeemed from fxSave are converted (swapped) into the target token, such as USDC, fxUSD, or USDC+fxUSD. Below are three typical usage scenarios:


βœ… Scenario 1: Redeeming USDC

In this case:

  • fxUSD needs to be swapped into USDC via the converter.

  • USDC is redeemed directly without swap.

fxusdParams (Swap fxUSD β†’ USDC)


{
  tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address
  converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
  encodings: 2097151n, // Encoding flags for routing
  routes: [13937444672719263997463500976868002028738657667021836n], // Swap path: fxUSD β†’ USDC
  minOut: tokenXMinOut, // Minimum acceptable output for USDC (should be queried from converter)
  signature: '0x'
}

usdcParams (Direct Redemption of USDC)

{
  tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address
  converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
  encodings: 0n, // No conversion
  routes: [],
  minOut: tokenYMinOut, // Minimum expected output for direct USDC
  signature: '0x'
}


βœ… Scenario 2: Redeeming fxUSD

In this case:

  • fxUSD is redeemed directly without swap.

  • USDC needs to be swapped into fxUSD via the converter.

fxusdParams (Direct Redemption of fxUSD)

{
  tokenOut: "0x085780639CC2cACd35E474e71f4d000e2405d8f6", // fxUSD address
  converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
  encodings: 0n,
  routes: [],
  minOut: tokenYMinOut,
  signature: '0x'
}

usdcParams (Swap USDC β†’ fxUSD)

{
  tokenOut: "0x085780639CC2cACd35E474e71f4d000e2405d8f6", // fxUSD address
  converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
  encodings: 2097151n,
  routes: [97745794563822560938935604024150535507888453411437580n], // Swap path: USDC β†’ fxUSD
  minOut: tokenXMinOut, // Should be obtained by querying the converter
  signature: '0x'
}

βœ… Scenario 3: Redeeming USDC + fxUSD(No Swap)

In this case:

  • fxUSD is redeemed directly without any swap.

  • USDC is redeemed directly without any swap.

fxusdParams (Direct Redemption of fxUSD)

{
  tokenOut: "0x085780639CC2cACd35E474e71f4d000e2405d8f6", // fxUSD address
  converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
  encodings: 0n,
  routes: [],
  minOut: fxusdMinOut, // Minimum expected fxUSD output
  signature: '0x'
}

usdcParams (Direct Redemption of USDC)

{
  tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address
  converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
  encodings: 0n,
  routes: [],
  minOut: usdcMinOut, // Minimum expected USDC output
  signature: '0x'
}


Method 2: Two-Step Redemption Process to Get fxUSD + USDC

Step 1: Redeem fxSP Tokens from fxSave


Step 2: Instantly Redeem fxSP Tokens to Obtain fxUSD and USDC

  • Function Call

    • Function:

      instantRedeem (0x9f56f9f0)

  • Return Values

    • amountStableOut: Amount of stable token (fxUSD and USDC) received

    • amountYieldOut: Amount of yield token received


Summary

Method

Description

Features

Method 1

Direct redemption of fxUSD, USDC, or both via Router

Single-step process; suitable for flexible and immediate conversion

Method 2

Two-step redemption: first redeem fxSP, then extract fxUSD and USDC

Fine-grained control over redemption; suitable for detailed asset management


Last updated