Skip to content

jacobvanschenck/tsunami-trades

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to TsunamiTrades

TsunamiTradesScreenShot

A decentralised exchange to create Market Orders and Limit Orders for ERC20 coins.

Here is the app running on the Sepolia Test Network.


Tech Stack ⚙️

Solidity | React | Hardhat | OpenZeppelin | Viem | ReCharts


Running Locally 💻

Clone Repo 📂

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 install

Then 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"

Setup Blockchain 🔗

Next step is to get the Hardhat blockchain node running locally

cd /path_to_project/My-Dex/blockchain
pnpm hardhat node

Then 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 tokens

Start Client 🌐

Finally 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 start

Head 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


Features 📼

Connects with Metamask

connect_wallet GIF

 

 

Deposit and Withdraw | Shows dApp approving Dex contract to deposit and withdraw coins from wallet

deposit_tokens GIF

 

 

Create Limit Order

create_limit_order GIF

 

 

Create Market Order | Shows trader filling in limit order and trade appearing on dApp

create_market_order GIF

 

 


Feedback 🤝

Do you have any suggestions for code or additional features you'd like to see implemented? Hit me up on Twitter

Contract Deployments 🔗

Sepolia Testnet

  • Dex: 0xe3B970200669bB3258886e0a8E5c97504d93ba31 Etherscan
  • Dai: 0x2487fC2B8c785E57D9752ABFD8E9a6696DEebb1C Etherscan
  • Bat: 0x0DcC9f27a42a19d9b4dd3cf25A591DB030aB820A Etherscan
  • Rep: 0x58dfd3A9C6Cf1072E5A3A9D800E2aD47dD0327c8 Etherscan
  • Zrx: 0x6b65E74E68CaF377636e439B71f7D62d71F53cAe Etherscan

About

A decentralized exchange in React for Market/Limit orders on ERC20 tokens

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors