Gaming DEX
  • Gaming DEX
    • Gaming DEX Overview
  • PRODUCT
    • Pools
      • Weight Pools
      • Stable Pool
      • Extra Rewards
    • The Vault
    • Smart Order Router (SOR)
    • Anti-Trader Field (AT-Field)
    • MultiGemSwap
  • LOGIC
    • Weight Math
    • Stable Math
    • Service Fee
  • BRIDGE
    • Bridge Specification
  • TOKEN
    • Z Token
    • Gauge
  • CONTRACTS
    • Oasys Hub
    • DeFi Verse
  • OTHRES
    • Roadmap
    • FAQ
    • Disclaimer
    • Revision History
Powered by GitBook
On this page
  • Overview
  • Separation of Token Accounting and Pool Logic
  • Gas Efficient BatchSwap
  • Security
  1. PRODUCT

The Vault

PreviousExtra RewardsNextSmart Order Router (SOR)

Last updated 6 months ago

Overview

Vault is Gaming DEX's smart contract core. It holds and manages all tokens for each pool and is also the portal where most operations (swap/join/exit) are performed.

Separation of Token Accounting and Pool Logic

The Vault architecture separates token calculation and management from the pool logic. The pool contracts are simplified as a result of this separation because the pool no longer needs to actively manage assets and only needs to calculate swap/join/exit amounts.

This architecture allows various pool designs to be completed as the same group. The Vault is not restricted to pool calculation methods and can be used for any system as long as it meets the requirements.

Gas Efficient BatchSwap

Other DEXs use a combination of token calculation and pooling logic, and multi-hop transactions (A->B->C) are costly because ERC20 tokens must be transferred at each hop. The advantage of the Vault is that all tokens are stored in the same contract. This difference is significant, and it has the potential to make swaps much more efficient. Rather than transferring tokens at each step of a multi-hop transaction, the Vault only needs to keep an internal record of which pool holds what and only transfer tokens at the input and output steps. This reduction in token transfers will ultimately save a significant amount of gas.

Security

It is critical that the Vault be designed to keep pool balances completely independent. This independence protects against tokens or custom pools that are maliciously or negligently designed and drain funds from other pools.So, even if Vault holds integrated liquidity for a specific token from multiple pools, the depth of that integrated liquidity has no effect on the price impact in the individual pools.