Deposit

1. Deposit flow (generic)

The Token Gateway (contract handling deposits and redeems) implements the ERC-4626 standard:

  1. Approve the underlying token to the Token Gateway.

  2. Call:

  • deposit(assets, receiver): deposit a fixed amount of underlying

  • deposit_referral(assets, receiver, referral_code) : deposit variant with referral

  • mint(shares, receiver): mint a fixed amount of fyTokens.

  • mint_referral(shares, receiver, referral_code): mint variant with referral.

Generic flow

underlying.approve(token_gateway, amount)
token_gateway.deposit_referral(amount, user, referral_code)
→ User receives fyTokens
  • You can get the token_gateway address via our API.

  • The protocol does not charge any deposit fees.

  • Communicate your referral_code with the ForgeYields team. Revenue from depositors is credited to your integration.

2. Starknet example (starknet.js)

Mint variant


3. EVM example (ethers.js)

Mint variant


4. Optional: aggregator-based entry

You can also enter a strategy by swapping directly into fyTokens via an on-chain DEX aggregator. Some markets trade fyTokens at a premium/discount. In those cases:

  • compare aggregator output vs ERC-4626 deposit/mint (preview_deposit/preview_mint)

  • choose whichever gives the user more fyTokens

Last updated