The Vault contract is a central component of BEX (not to be confused with Reward Vaults in Proof-of-Liquidity), acting as a unified smart contract that manages all tokens across liquidity pools. It serves as the primary interface for most protocol operations, including swaps, joins, and exits.Documentation Index
Fetch the complete documentation index at: https://berachain-422fce37-feat-nodes-section-reno.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Separating token accounting and pool logic
BEX’s Vault and Pool architecture separates the token accounting and management from the pool logic and AMM math. The responsibility for calculating amounts for swaps, joins, and exits is delegated to the pool contracts, while the Vault holds all of the tokens within the various pools (which can even be of different types).
Send swap request
You send a swap request to the Vault, specifying the pool ID to swap through and the amount to
swap.
Calculate balance changes
The pool contract calculates the balance changes from the swap, returning those amounts to the
Vault.