- git clone App repo
- install project dependencies : npm install
- Run ganache and set port to 8545
- import first account of ganache to your metamask wallet (funds sourcing)
- deploy smart contracts to Ganache network: truffle migrate --reset
- seed exhchange with orders for data visualization: truffle exec scripts/seed_exchange.js
- Run Project: npm run start Backend :
- Smart Contracts: Deployed to Local Network [Ganache]
- TOKEN : token (HAI) -> functionallity of ERC20 token
- EXCHANGE : manage the logique of exchange market(Trades, Orders Actions, Data Visualisiation )
- Truffle and ether.js for deployment and intercations with Blockchain Front End :
- React application
- Redux for state managment
- Set the fee account // Trades fee for exchange market
- Deposit Ether
- Withdraw Ether
- Deposit tokens
- Withdraw tokens
- Check balances
- Make order
- Cancel order
- Fill order
- Charge fees
- Smart Contract Test [Smart contracts test before deployment]
Contract: Exchange
-
deployment
- track the fee Account
- track the fee Percent
-
fallback
- reverts when ETher is sent (213ms)
-
deposit Ether
- Track Ether deposit (80ms)
- emit Deposit event
-
withdraw Ether
- sucess
- withdraws Ether funds
- emit Withdraw event
- failure
- reject Withdraw for insufficient balance (44ms)
- sucess
-
deposit Tokens
- success
- track the token deposit (76ms)
- emit Deposit event
- failure
- Rejects Ether deposit
- fails when No tokens Approved (120ms)
- success
-
Withdraw Tokens
- success
- Withdraw Tokens Funds
- emit Withdraw event
- failure
- reject Ether Withdraw
- fails to insufficient balances
- Check balances
- returns user balance (38ms)
- Making Orders
- track the new order created (47ms)
- emit an order event
- Order Actions
- Filling Orders
- success
- execute Trade & charge Fees (297ms)
- updates filled orders (39ms)
- emit an "Trade" event
- failure
- rejects invalid order Ids (48ms)
- rejects already filled order (301ms)
- rejects cancelled orders (156ms)
- success
- Filling Orders
- Cancelling Orders
- success
- updates cancelled orders
- emit an order event
- failure
- rejects invalid orders ID (47ms)
- rejects unauthorized cancelations
- success
- success
-
Contract: Token
-
deployment
- track the name
- track the symbol
- track the decimal
- track the total supply
- assign total supply to deployer (196ms)
-
sending Tokens
- sucess
- transfer token balances (56ms)
- emit Transfer
- failure
- rejects insufissient balances
- rejects invalid receipient
- approving tokens
- success
- allocates an allowance for the delegate token spending (49ms)
- emit an Approval event
- failure
- rejects invalid spender (171ms)
- success
- sending allowance Tokens
- sucess
- transfer token balances (196ms)
- decrease allowance
- emit Transfer
- failure
- rejects insufissient balances (209ms)
- rejects invalid receipient
- sucess
- sucess