Architecture

Vexchange operates with two contracts: exchange.vy and factory.vy. Exchange.vy houses all of the exchange logic and acts as a template for all markets. Factor.vy then uses exchange.vy to clone and deploy new markets each-time a user passes a token address to factory.vy. If this token is a compatible VIP-180 then the new market will work as intended and have the same security guarantees as the other markets. This model has been retained from Uniswap's original implementation, since then a few adjustments have been made, most notably the ability for liquidity providers to claim generated vtho using the tokenScrape() function.

Enabling Global Liquidity

As we have one template that covers all VIP-180s, we are able to build an interlinked network of liquidity. This enables users of the VeChainThor blockchain to quickly swap between the various tokens in the ecosystem. This is especially important considering VeChain dual token setup, with vet and vtho. However, because we have all of these homogeneous contracts, we can also seamlessly swap directly from one token to another. To swap Token A to Token B, a user would first swap Token A to VET, then they would swap VET to Token B. Vexchange supports this functionality natively, ensuring that token to token swaps happen atomically within one transaction.

Last updated