Skip to content

An efficient and user-friendly DEX natively built on B² network.

Notifications You must be signed in to change notification settings

Kavorix/glowswap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

Glow Swap

An efficient and user-friendly DEX natively built on B² network.

Contracts

  • There are three main contracts, Factory Contract, Pool contract and Router contract.

DATA AND CONTROL FLOWS

  • Trader/liquidity provider interacts with Router contract not with main pool contract directly

Swap

Caller

  1. Approve periphery contract to use trader's tokens
  2. Trader uses router contract to swap tokens

In the Router contract

  1. Sends tokenA to core contract
  2. Calculates tokenOut
  3. Then iterate over path array and swap tokens untill desired token come

In the Pool contract

  1. Then we sends the token to trader
  2. Update the reserves

Add Liquidity

Caller

  1. Approve periphery contract to use liquidity provider's tokens
  2. Liquidity provider uses router contract to add liquidity

In the Router contract

  1. Sends assets of liquidity provider to core contract

In the Pool contract

  1. Calculate liquidity tokens to be minted
  2. Mint liquidity tokens for liquidity provider
  3. Update the reserves

Remove Liquidity

Caller

  1. Approve periphery contract to use liquidity provider's tokens
  2. Liquidity provider uses router contract to withdraw liquidity

In the Router contract

  1. Sends liquidity tokens of liquidity provider to core contract

In the Pool contract

  1. Burn liquidity tokens
  2. Send assets back to liquidity provider
  3. Update the reserves

About

An efficient and user-friendly DEX natively built on B² network.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published