Skip to Content
GlowSwap Documentation 🎉
DevelopersIntegration Guide

Integration Guide

Welcome to the GlowSwap Integration Guide. This section will help you understand best practices and important considerations when integrating GlowSwap pools into your own applications or protocols.

Important Considerations

Exposing a Public Swap Function

If you are integrating an exclusive pool and plan to expose its swap function for public use, there are important caveats to consider:

  • Reserve Management: When the swap function is open to the public, frequent swaps by users can alter the pool’s reserves unpredictably. This can make it difficult to perform the final swap required to close the exclusive pool, as the reserves may not be in the expected state.
  • Pool Closure: To ensure you can safely and reliably close your exclusive pool, it is highly recommended to implement a pause guardian or similar mechanism. This allows you to temporarily pause public swaps, giving you a window to execute the final operations needed to close the pool without interference.

Example: Building a Uniswap V2-Style Wrapper

A common integration pattern is to build a Uniswap V2-compatible wrapper contract over a GlowSwap pool. This allows existing tools and interfaces that expect a Uniswap V2 interface to interact with GlowSwap liquidity.

However, if you do this for an exclusive pool, you must take extra care:

  • The wrapper’s swap function will likely be callable by anyone, increasing the risk of reserve manipulation.
  • To mitigate this, your wrapper should include a mechanism (such as a pause guardian or admin-controlled circuit breaker) to temporarily disable swaps. This ensures you can pause public access when you need to close or rebalance the underlying exclusive pool.

In summary:
When exposing exclusive pool swaps to the public—especially via familiar interfaces like Uniswap V2—always implement controls to pause or restrict access as needed. This will help you maintain control over the pool’s lifecycle and prevent issues during closure or maintenance operations.

Last updated on