Gloop
WebsiteTwitterDiscord
  • gLoop Litepaper v2
    • Introduction
    • The Two Tokens
    • Roadmap
  • PRODUCTS
    • GM Index
      • Providing/Removing Liquidity
      • Fees and Reflection
      • Deposit/Withdrawal Examples
    • GM Lending/Looping (Coming Soon)
    • GLOOP Staking (Coming Soon)
  • GM Points (COMING SOON)
  • FREQUENTLY ASKED QUESTIONS (FAQs)
    • GM Index (GMI)
  • Technical
    • Gloop Protocol Parameters
    • Contracts
      • GMI
        • GM Index
        • GMI USDC Zap
        • Token Banks
        • Token Oracles
        • Fees
    • Audits
  • GLoop Ecosystem
    • Tokenomics
  • Security and Risk
    • Risks
  • Social
    • Socials
Powered by GitBook
On this page
  1. Technical
  2. Contracts
  3. GMI

GMI USDC Zap

How USDC Gets Zapped to GMI

PreviousGM IndexNextToken Banks

Last updated 6 months ago

When a user with USDC hits the Deposit button on the GMI front end, a data payload is built for use in a multicall that gets sent to the GMX Architecture. This payload includes the specific GM token that the USDC will be exchanged for. This is automatically determined in the GMI front end logic, which picks whatever GM asset currently has the lowest deposit fee. The specific contract that is then called within GMX is the . From here, tokens are transferred to the DepositVault. Here is an excerpt from the : "To create a deposit, tokens need to first be transferred to the DepositVault, ExchangeRouter.createDeposit can then be called after. The transfer of tokens and the calling of ExchangeRouter.createDeposit should be done in a single transaction, otherwise the tokens may be transferred out by other users." One of the parameters in the createDeposit() call is a callbackContract address. This callbackContract is our GMIZap contract, which has an afterDepositExecution() function. Once the USDC tokens have gone through a series of trials, tribulations, and obstacles to get into the GMX vaults, the GM asset tokens along with some event data are sent to the GMIZap contract and the afterDepositExecution() function is called. This function finally calls the deposit() function on the GM Index, and the GM tokens are deposited.

ExchangeRouter
GMX V2 docs