Skip to content

mgnfy-view/thunder-swap

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Thunder Swap

A decentralized exchange and flash swapping protocol
Explore the docs »
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

About The Project

Thunder Swap is a decentralized exchange protocol that also supports flash swaps. A flash swap allows you to get a certain amount of a type of token within the pool as loan, and swap it for a certain amount of the other type of token in the pool, plus some minimal fee.

A thunder swap pool factory is deployed on-chain, and users can interact with it to deploy thunder swap pools for supported tokens (set by the deployer). Liquidity providers can supply pools with liquidity and earn a fees of 0.3% on each swap. Each liquidity provider is minted LP (Liquidity Provider) tokens representing the portion of the pool they own. At any time, liquidity providers can exit the protocol by burning these LP tokens, which allows them to withdraw their liquidity along with any accrued fees.

Both normal swaps and flash swaps take place using the ThunderSwapPool::flashSwapExactInput() and ThunderSwapPool::flashSwapExactOutput() functions. In a normal swap, the receiver address is the user's wallet address; however, in a flash swap, a user sets the receiver address as the contract's address (which is IThunderSwapReceiver interface compliant). The contract that receives the token loan has to ensure that enough tokens are approved to the ThunderSwapPool when the control returns to it and the loan is paid back (along with fees). With flash swaps, contracts can also activate hooks before and after a swap to fine tune their swapping strategy.

Thunder Swap is marching towards a community-driven future with the introduction of the $THUD token, which is the key utility and governance token in the Thunder Swap ecosystem. Currently, the only way to obtain $THUD is via an airdrop conducted by the protocol team to reward loyal and regular users of the protocol. $THUD can be used to partake in governance, allowing the community to support more tokens on the exchange.

Built With

  • Foundry
  • Solidity
  • NPM

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

Ensure that you have the Foundry framework installed on your system. You can get the installation instructions here. Also, you'll need pnpm and make installed and configured on your system.

Installation

Clone the repo

git clone https://github.com/mgnfy-view/thunder-swap

cd into the repo, and install the necessary dependencies

cd thunder-swap
make install
pnpm intall

That's it, you are good to go now!

Roadmap

  • Smart contract development
    • Thunder Swap Core
    • Thunder Swap $THUD token
    • Thunder Swap Governance
    • Thunder Swap Airdrop Manager
  • Testing
    • Unit testing
      • Pool deployment tests
      • Liquidity tests
      • Flash swap tests
      • Airdrop tests
      • Governance tests
      • Miscellaneous tests
  • Write a deployment script
  • Write docs and README.md

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Reach Out

Here's a gateway to all my socials, don't forget to hit me up!

Linktree