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.
The DEX contract allows users to:
- Deposit USDT and receive TokenX at a fixed rate.
- Transfer TokenX to a vesting contract where it will be locked until a specified vesting period expires.
The vesting contract:
- Locks the tokens received from the DEX contract.
- Allows users to withdraw their vested tokens after the vesting period has expired.
-
Deploy the Vesting contract with the token address, expiry duration, and owner address.
-
Deploy the Dex contract with the owner address, vesting contract address, tokenX address, and USDT/USDC address.
-
Set the DEX address in the Vesting contract using the setDexAddress method.
-
Depositing USDT and Receiving TokenX
-
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.
-
Withdrawing Vested Tokens After the vesting period has expired, users can withdraw their vested tokens by calling the withdraw function in the Vesting contract.
Use the nonReentrant modifier to prevent reentrancy attacks. The contracts implement pausability to allow emergency stops. Emergency Withdrawal Slither Report: text
This project is licensed under the MIT License.
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

