A decentralised exchange to create Market Orders and Limit Orders for ERC20 coins.
Here is the app running on the Sepolia Test Network.
Solidity | React | Hardhat | OpenZeppelin | Viem | ReCharts
Start of by cloning this repo or downloading the zip file. After that open up your terminal and run these commands:
cd /path_to_project/My-Dex/blockchain
pnpm installThen you need to create an .env file in /blockchain for some values in hardhat.config.ts
ETHERSCAN_API_KEY="API_KEY"
ALCHEMY_API_KEY="API_KEY"
SEPOLIA_PRIVATE_KEY="PRIVATE_KEY"Next step is to get the Hardhat blockchain node running locally
cd /path_to_project/My-Dex/blockchain
pnpm hardhat nodeThen test, compile and deploy the contracts
pnpm test
pnpm compile
pnpm hardhat run scripts/deploy_mocks.ts --network localhost # this deploys the ERC20 tokens
pnpm hardhat run scripts/seed_wallet.ts --network localhost # fund wallet with ERC20 tokens
pnpm hardhat run scripts/deploy_dex.ts --network localhost # deploy dex using ERC20 tokensFinally get the client site running on localhost with the Hardhat node. We need to change a few things:
Open up /client/src/utils.ts and update the function getPublicClent() to this:
export function getPublicClient() {
return createPublicClient({
chain: hardhat,
transport: http("http://127.0.0.1:8545"),
});
}Next open up /client/src/components/providers and change both places createWalletClient is used to:
const client = createWalletClient({
chain: hardhat,
transport: custom(provider),
});Open a new Terminal window and run:
cd client/
pnpm install
pnpm startHead over to http://localhost:5173 and start using TsunamiTrades!
Note: Make sure to update your Metamask to use the local network as well. Check out step 5 in the MetaMask Developer docs
Do you have any suggestions for code or additional features you'd like to see implemented? Hit me up on Twitter




