The Vault
Last updated
Last updated
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.
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.
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.
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.