Redeem

1. Redeem flow (generic)

Redemptions in ForgeYields are asynchronous and follow a request β†’ claim model.

  1. The user calls request_redeem(shares, owner, receiver) on the Token Gateway.

  2. The fyTokens are burned, and an ERC-721 redeem request is minted, recording:

    • the number of shares,

    • the epoch at which the request was created,

  3. During the next clearing cycle, the withdrawal pool is processed and the request becomes claimable.

  4. Anyone can then call claim(requestId, receiver). This burns the redeem NFT and transfers the corresponding underlying assets to the receiver.

Generic flow

TOKEN_GATEWAY.requestRedeem(shares, user, user)
β†’ redeem request created (ERC-721)

<withdrawal pool get processed>

TOKEN_GATEWAY.claim(requestId, user)
β†’ user receives underlying

Notes

  • No approve required, requestRedeem does not need a prior approval, fyTokens are burned internally.

  • Underlying is delivered on claim, the actual transfer of assets happens only during the claim step.

  • Claim is handled by ForgeYields relayers, we consume your request as soon as it is ready.

  • You can fetch pending redeem requests using the API.

  • Redeem fees might exists, you can fetch it via API.


2. Starknet example (starknet.js)


3. EVM example (ethers.js)


4. Optional: use a swap aggregator for instant withdrawal

Instead of going through request_redeem, you can exit immediately by swapping fyTokens for the underlying on the same chain.

How it works:

  • Query a swap aggregator for a fyToken β†’ underlying route.

  • Aggregators offer instant settlement, but usually at a worse price than the asynchronous redeem pipeline.

  • If the user prefers speed over optimal price, you can bypass the redeem process entirely.

Two withdrawal paths:

Base path (best execution, slower): request_redeem(shares, user, user) β†’ wait for withdrawal pool to be processed β†’ claim(requestId, user)

Instant path (faster but might involve a loss): Swap fyToken β†’ underlying through a DEX/aggregator for immediate exit.

Last updated