- Kovan Testnet Contract Address: N/A
- Kovan Deploy TX: N/A
- TestNet Wallet Site: N/A
- Ethereum Main Net Contract Address: N/A
- Ethereum Main Net / Live Website: N/A
- Github repo: https://github.com/ChainWaveLabs/waveDEX
waveDEX is a simple example of Decentralized Exchange (DEX) that allows Etheruem individuals to trade ERC-20 tokens via a smart contract.
waveDEX includes a few components that are common to distributed apps (dApps). This includes:
- User wallet
- UI/ Frontend
- Smart Contracts (DEX Logic layer)
The user wallet is metamask for this iteration. In a main net deployment we would do more work to support the other main wallet types.
The UI is built with React JS , web3, and other front end utility libraries.
The smart contracts are built in solidity, with contract migrations and deployments managed through truffle.
Entire Logical Flow of Trading Sequence of Ethereum DEX
- Vitalik [TRANSFERS] 4 ETH to the DEX Smart contract
- Vitalik [CREATES] a buy limit order for a limit price of 2 ETH for 1 ABC Toke
- Satoshi [TRANSFERS] 1 ABC Token to the DEX smart contract
- Satoshi [CREATES] a sell market order for 1 ABC token
- At the time when the two orders are ‘matched’ by the DEX smart contract, the Trade will be carried out
- waveDEX [TRANSFERS] 1 ABC to Vitalik and 2 ETH to Satoshi
- Vitalik withdraws his 1 ABC
- Satoshi withdraws his 2ETH
- Vitalik has remainder of 2 ETH still in DEX Wallet for future trades
Tokens Available to Trade
In the initial iteration, only ERC-20 tokens are tradable. Ethereum (ETH) will is used to quote prices.
waveDEX DEX Wallet Smart Contract
The wallet smart contract collects ETH and ERC-20 tokens from users.
It allows users to store a balance of these types of tokens in the smart contract.
Users can add, withdraw, or create buy or sell orders of limit and market types.
The contract keeps its own ledger which manages balances as tokens are added and removed.
Orderbook is responsible for listing all orders, matching orders, and removing executed orders.
The orderbook is simple and it will match with the market order that has the best prices.
The limit orders will be matched in a first-come first serve order in the case where they have the same price.
Market and limit orders are matched, then the transaction is completed by sending the tokens/assets to their new owners.
These two transactions must both succeed, or the transaction will be reverted.