Skip to content

0xN2/LunarX

Repository files navigation

DEX and Vesting Smart Contracts

This project implements a decentralized exchange (DEX) and a vesting contract where users can swap USDT for a specific token (TokenX) and vest the tokens for a certain period before they can withdraw them. The exchange rate is 1 USDT = 100 TokenX.

Overview

DEX Contract

The DEX contract allows users to:

  1. Deposit USDT and receive TokenX at a fixed rate.
  2. Transfer TokenX to a vesting contract where it will be locked until a specified vesting period expires.

Vesting Contract

The vesting contract:

  1. Locks the tokens received from the DEX contract.
  2. Allows users to withdraw their vested tokens after the vesting period has expired.

Usage

  1. Deploy the Vesting contract with the token address, expiry duration, and owner address.

  2. Deploy the Dex contract with the owner address, vesting contract address, tokenX address, and USDT/USDC address.

  3. Set the DEX address in the Vesting contract using the setDexAddress method.

  4. Depositing USDT and Receiving TokenX

  5. Users can deposit USDT and receive TokenX by calling the depositUSDTandReceiveToken function in the DEX contract. The received tokens will be transferred to the vesting contract and locked until the vesting period expires.

  6. Withdrawing Vested Tokens After the vesting period has expired, users can withdraw their vested tokens by calling the withdraw function in the Vesting contract.

Security Considerations

Use the nonReentrant modifier to prevent reentrancy attacks. The contracts implement pausability to allow emergency stops. Emergency Withdrawal Slither Report: text

License

This project is licensed under the MIT License.

alt text

Echidna: alt text

Test Echidna

echidna test-echidna/dex.t.echidna.sol --contract EchidnaDexTest --config echidna-config.yaml 
echidna test-echidna/vesting.t.echidna.sol --contract EchidnaVestingTest --config echidna-config.yaml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •