├── README.md
├── src
├── redux
│ ├── actions
│ │ ├── auth.js
│ │ ├── wallet.js
│ │ ├── actionTypes.js
│ │ ├── balance.js
│ │ ├── trade.js
│ │ ├── crypto.js
│ │ ├── stake.js
│ │ └── order.js
│ ├── index.js
│ └── reducers
│ │ ├── auth.js
│ │ ├── stake.js
│ │ ├── wallet.js
│ │ ├── index.js
│ │ ├── balance.js
│ │ ├── order.js
│ │ ├── crypto.js
│ │ ├── trade.js
│ │ └── token.js
├── assets
│ ├── logo.png
│ ├── caladex.png
│ ├── logo1.png
│ ├── logo3.png
│ ├── metamask.jpg
│ ├── Untitled-2.png
│ └── avatar
│ │ ├── ADA.png
│ │ ├── BTC.png
│ │ ├── CAX.png
│ │ ├── DASH.png
│ │ ├── EOS.png
│ │ ├── ETH.png
│ │ ├── LTC.png
│ │ └── NEM.png
├── static
│ ├── languages
│ │ ├── tr.json
│ │ ├── fr.json
│ │ ├── po.json
│ │ ├── en.json
│ │ ├── sp.json
│ │ ├── du.json
│ │ ├── de.json
│ │ └── index.js
│ ├── tokensinfo
│ │ ├── avatar
│ │ │ ├── caladex.png
│ │ │ ├── eos.svg
│ │ │ ├── dash.svg
│ │ │ ├── ethereum.svg
│ │ │ ├── litecoin.svg
│ │ │ ├── bitcoin.svg
│ │ │ ├── nem.svg
│ │ │ └── cardano.svg
│ │ ├── history.json
│ │ ├── quotesOne.json
│ │ ├── quotesTwo.json
│ │ ├── baseinfo.json
│ │ ├── stakinginfo.js
│ │ ├── walletinfo.js
│ │ └── tokens.js
│ └── constants.js
├── setupTests.js
├── utils
│ ├── ProtectedRoute.js
│ ├── reportWebVitals.js
│ ├── Language.js
│ ├── theme.js
│ ├── helper.js
│ └── globalstyles.js
├── index.js
├── constants
│ ├── index.js
│ └── abis
│ │ ├── greeter.json
│ │ ├── erc20.json
│ │ └── token.json
├── hooks
│ ├── useTokenContract.js
│ └── useCaladexContract.js
├── components
│ ├── New folder (2)
│ │ ├── Balances
│ │ │ └── EmptyWidget
│ │ │ │ └── index.js
│ │ └── EarnStaking
│ │ │ └── StakingDialog
│ │ │ └── CheckButton.js
│ ├── Exchange
│ │ ├── OrderBook
│ │ │ ├── PriceMean
│ │ │ │ └── index.js
│ │ │ ├── OrderLableBox
│ │ │ │ └── index.js
│ │ │ ├── OrderSelectBox
│ │ │ │ ├── OrderTypeBt
│ │ │ │ │ ├── Badge.styled.js
│ │ │ │ │ └── index.js
│ │ │ │ └── index.js
│ │ │ ├── index.js
│ │ │ ├── OrderBuyList
│ │ │ │ └── index.js
│ │ │ └── OrderSellList
│ │ │ │ └── index.js
│ │ ├── TokenPriceBar
│ │ │ └── index.js
│ │ ├── TradingView
│ │ │ └── index.js
│ │ ├── Trade
│ │ │ ├── TradeSelectBox
│ │ │ │ └── index.js
│ │ │ ├── index.js
│ │ │ └── MarketTradeList
│ │ │ │ └── index.js
│ │ ├── RecentOrder
│ │ │ ├── index.js
│ │ │ ├── RecentSelectBox
│ │ │ │ └── index.js
│ │ │ └── RecentOrderList
│ │ │ │ └── index.js
│ │ ├── TradingWidget
│ │ │ └── index.js
│ │ ├── Marketing
│ │ │ ├── BuyAndSell
│ │ │ │ ├── SelectPairToken
│ │ │ │ │ └── index.js
│ │ │ │ └── index.js
│ │ │ ├── index.js
│ │ │ └── MarketSelectBox
│ │ │ │ └── index.js
│ │ ├── TokenList
│ │ │ ├── index.js
│ │ │ ├── TokenPairBox
│ │ │ │ └── index.js
│ │ │ ├── TokenSearchBox
│ │ │ │ └── index.js
│ │ │ └── TokenInfoList
│ │ │ │ └── index.js
│ │ ├── TokenPriceTable
│ │ │ └── index.js
│ │ ├── Table1
│ │ │ └── index.js
│ │ ├── Table2
│ │ │ └── index.js
│ │ ├── TradeHistoryTable
│ │ │ └── index.js
│ │ ├── OrderCrypto
│ │ │ └── index.js
│ │ ├── WalletConnect
│ │ │ └── index.js
│ │ └── CoinBanner
│ │ │ └── index.js
│ ├── Common
│ │ ├── TokenSearch
│ │ │ └── index.js
│ │ ├── Title
│ │ │ └── index.js
│ │ └── FruitBar
│ │ │ └── index.js
│ ├── Orders
│ │ ├── CustomDatePicker
│ │ │ └── index.js
│ │ └── OrdersHistory
│ │ │ └── index.js
│ ├── Routes.js
│ ├── Main.js
│ ├── EarnStaking
│ │ └── StakingDialog
│ │ │ └── CheckButton.js
│ ├── Balances
│ │ └── AddressWidget
│ │ │ └── index.js
│ └── Layouts
│ │ ├── Header
│ │ └── DrawerNavbar.js
│ │ └── Footer
│ │ └── index.js
├── pages
│ ├── Orders
│ │ └── index.js
│ ├── TokenInfoBase
│ │ └── index.js
│ ├── Balances
│ │ └── index.js
│ ├── EarnStaking
│ │ └── index.js
│ └── Landing
│ │ └── index.js
└── App.js
├── public
├── favicon.gif
├── favicon.ico
├── favicon.png
├── logo192.png
├── logo1921.png
├── logo512.png
├── logo5121.png
├── avatar
│ ├── ADA.png
│ ├── BTC.png
│ ├── CAX.png
│ ├── DASH.png
│ ├── EOS.png
│ ├── ETH.png
│ ├── LTC.png
│ └── NEM.png
├── robots.txt
├── caladex_logo.png
├── Details correction landing page and token info base.pdf
├── Mile stone 1 corrections and work still to be done.pdf
├── .htaccess
├── manifest.json
└── index.html
├── .gitignore
└── package.json
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/redux/actions/auth.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import ActionTypes from './actionTypes' ;
5 |
--------------------------------------------------------------------------------
/public/favicon.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/favicon.gif
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/favicon.png
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/logo192.png
--------------------------------------------------------------------------------
/public/logo1921.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/logo1921.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/logo512.png
--------------------------------------------------------------------------------
/public/logo5121.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/logo5121.png
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/public/avatar/ADA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/ADA.png
--------------------------------------------------------------------------------
/public/avatar/BTC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/BTC.png
--------------------------------------------------------------------------------
/public/avatar/CAX.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/CAX.png
--------------------------------------------------------------------------------
/public/avatar/DASH.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/DASH.png
--------------------------------------------------------------------------------
/public/avatar/EOS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/EOS.png
--------------------------------------------------------------------------------
/public/avatar/ETH.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/ETH.png
--------------------------------------------------------------------------------
/public/avatar/LTC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/LTC.png
--------------------------------------------------------------------------------
/public/avatar/NEM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/avatar/NEM.png
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/assets/caladex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/caladex.png
--------------------------------------------------------------------------------
/src/assets/logo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/logo1.png
--------------------------------------------------------------------------------
/src/assets/logo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/logo3.png
--------------------------------------------------------------------------------
/public/caladex_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/caladex_logo.png
--------------------------------------------------------------------------------
/src/assets/metamask.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/metamask.jpg
--------------------------------------------------------------------------------
/src/assets/Untitled-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/Untitled-2.png
--------------------------------------------------------------------------------
/src/assets/avatar/ADA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/ADA.png
--------------------------------------------------------------------------------
/src/assets/avatar/BTC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/BTC.png
--------------------------------------------------------------------------------
/src/assets/avatar/CAX.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/CAX.png
--------------------------------------------------------------------------------
/src/assets/avatar/DASH.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/DASH.png
--------------------------------------------------------------------------------
/src/assets/avatar/EOS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/EOS.png
--------------------------------------------------------------------------------
/src/assets/avatar/ETH.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/ETH.png
--------------------------------------------------------------------------------
/src/assets/avatar/LTC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/LTC.png
--------------------------------------------------------------------------------
/src/assets/avatar/NEM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/assets/avatar/NEM.png
--------------------------------------------------------------------------------
/src/static/languages/tr.json:
--------------------------------------------------------------------------------
1 | {
2 | "cryptochange": "Crypto Exchange tr",
3 | "tokenexchange": "Token Exchangetr"
4 | }
5 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/caladex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/src/static/tokensinfo/avatar/caladex.png
--------------------------------------------------------------------------------
/public/Details correction landing page and token info base.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/Details correction landing page and token info base.pdf
--------------------------------------------------------------------------------
/public/Mile stone 1 corrections and work still to be done.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Topten1004/Caladex/HEAD/public/Mile stone 1 corrections and work still to be done.pdf
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/src/static/languages/fr.json:
--------------------------------------------------------------------------------
1 | {
2 | "exchange": "Échange",
3 | "tokenlisting": "Jeton liste",
4 | "tokeninfobase": "Jeton Info Base",
5 | "earnstaking": "Gagner/Jalonnement",
6 | "balances": "Solde",
7 | "orders": "Ordres",
8 | "walletconnect": "Portefeuille Relier"
9 | }
--------------------------------------------------------------------------------
/src/static/languages/po.json:
--------------------------------------------------------------------------------
1 | {
2 | "exchange": "Troca",
3 | "tokenlisting": "Símbolo Listagem",
4 | "tokeninfobase": "Símbolo Info Base",
5 | "earnstaking": "Ganhar/Estacando",
6 | "balances": "Saldos",
7 | "orders": "Pedidas",
8 | "walletconnect": "Carteira Conectar"
9 | }
--------------------------------------------------------------------------------
/src/static/languages/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "exchange": "Exchange",
3 | "tokenlisting": "Token Listing",
4 | "tokeninfobase": "Token Info Base",
5 | "earnstaking": "Earn/Staking",
6 | "balances": "Balances",
7 | "orders": "Orders",
8 | "walletconnect": "Wallet Connect"
9 | }
10 |
--------------------------------------------------------------------------------
/src/static/languages/sp.json:
--------------------------------------------------------------------------------
1 | {
2 | "exchange": "Intercambio",
3 | "tokenlisting": "Simbólica Intercambio",
4 | "tokeninfobase": "Simbólica Info Base",
5 | "earnstaking": "Ganar/Replanteo",
6 | "balances": "Saldos",
7 | "orders": "Pedidos",
8 | "walletconnect": "Cartera Conectar"
9 | }
--------------------------------------------------------------------------------
/src/static/languages/du.json:
--------------------------------------------------------------------------------
1 | {
2 | "exchange": "Aandelenbeurs",
3 | "tokenlisting": "Símbolo Listagem",
4 | "tokeninfobase": "Símbolo Info Baseren",
5 | "earnstaking": "Verdienen/Uitzetten",
6 | "balances": "Saldi",
7 | "orders": "Bestellingen",
8 | "walletconnect": "Portemonnee Aansluiten"
9 | }
--------------------------------------------------------------------------------
/src/redux/index.js:
--------------------------------------------------------------------------------
1 | import rootReducer from './reducers';
2 | import { createStore, applyMiddleware , compose } from 'redux';
3 |
4 | import thunk from 'redux-thunk';
5 |
6 | const store = createStore(
7 | rootReducer,
8 | {},
9 | applyMiddleware(thunk)
10 | );
11 |
12 | export default store;
--------------------------------------------------------------------------------
/src/redux/reducers/auth.js:
--------------------------------------------------------------------------------
1 |
2 | // import ActionTypes from '../actions/actionTypes' ;
3 |
4 | const INITIAL_STATE = {
5 | isAuthenticated : false ,
6 | access_token : '' ,
7 | }
8 |
9 | export default ( state={INITIAL_STATE} , action={} ) => {
10 | switch(action.type) {
11 | default :
12 | return state ;
13 | }
14 | }
--------------------------------------------------------------------------------
/src/static/languages/de.json:
--------------------------------------------------------------------------------
1 | {
2 | "cryptochange": "Crypto Handel",
3 | "tokenexchange": "Token Handel",
4 | "margintrading": "Marge Handel",
5 | "futurestrading": "Futures Handel",
6 | "buycrypto": "Koop Crypto",
7 | "tokeninfobase": "Token Basis Info",
8 | "caxrewards": "CAX Beloningen",
9 | "aboutus": "Over ons",
10 | "signup": "Aanmelden",
11 | "login": "Log in"
12 | }
13 |
--------------------------------------------------------------------------------
/src/static/languages/index.js:
--------------------------------------------------------------------------------
1 | import en from './en.json';
2 | import sp from './sp.json';
3 | import fr from './fr.json';
4 | import po from './po.json';
5 | import du from './du.json';
6 |
7 | export const dictionaryList = { en, sp, fr, po, du };
8 |
9 | export const languageOptions = {
10 | en: 'English',
11 | sp: 'Spanish',
12 | fr: 'French',
13 | po: 'Portugeese',
14 | du: 'Dutch',
15 | };
16 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | RewriteEngine On
3 | RewriteCond %{HTTP_HOST} ^caladex\.org [NC]
4 | RewriteCond %{SERVER_PORT} 80
5 | RewriteRule ^(.*)$ https://www.caladex.org/$1 [R,L]
6 | RewriteBase /subdirectory
7 | RewriteRule ^index\.html$ - [L]
8 | RewriteCond %{REQUEST_FILENAME} !-f
9 | RewriteCond %{REQUEST_FILENAME} !-d
10 | RewriteCond %{REQUEST_FILENAME} !-l
11 | RewriteRule . /index.html [L]
12 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/eos.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/utils/ProtectedRoute.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 |
4 | import { Navigate , Outlet } from 'react-router-dom';
5 |
6 | import { isAuthenticated } from './helper';
7 |
8 | const ProtectedRoute = () => {
9 | // console.log(isAuthenticated()) ;
10 | // if (!isAuthenticated()) {
11 | // return ;
12 | // }
13 | return ;
14 | }
15 |
16 | export default ProtectedRoute ;
--------------------------------------------------------------------------------
/src/utils/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/src/static/constants.js:
--------------------------------------------------------------------------------
1 | export const DefaultLocale = 'EN';
2 |
3 | // export const BACKEND_URL = 'https://calahex.io/api/';
4 |
5 | // export const BACKEND_URL = 'http://127.0.0.1:8000/api/';
6 |
7 | export const PUBLIC_API_URL = "https://poloniex.com/public?" ;
8 |
9 | export const PUBULIC_EXCHANGE_RATE_API = "https://api.coinbase.com/v2/exchange-rates?currency=" ;
10 |
11 | export const PRIVATE_CALADEX_API = "http://10.10.10.171:5050/api/" ;
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | import { Web3ReactProvider } from '@web3-react/core';
6 |
7 | import reportWebVitals from './utils/reportWebVitals';
8 |
9 | import { getLibrary } from './utils/helper' ;
10 |
11 | ReactDOM.render(
12 |
13 |
14 | ,
15 | document.getElementById('root')
16 | );
17 |
18 | reportWebVitals();
19 |
--------------------------------------------------------------------------------
/src/constants/index.js:
--------------------------------------------------------------------------------
1 | import { InjectedConnector } from "@web3-react/injected-connector";
2 |
3 | export const injected = new InjectedConnector({ supportedChainIds: [1, 3, 4, 5, 42, 1337, 31337] });
4 |
5 | export const CALADEX_ADDR = "0x695690C290cCaEa84d3101039bd80698B249Ecc1" ;
6 | // export const CALADEX_ADDR = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" ;
7 |
8 | export const DAI_ADDR = "0xad6d458402f60fd3bd25163575031acdce07538d" ;
9 |
10 | export const BLOCK_CONFIRMATION_THRESHOLD = 1;
--------------------------------------------------------------------------------
/src/redux/reducers/stake.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import ActionTypes from "../actions/actionTypes" ;
5 |
6 | const INITIAL_STATE = {
7 | tokenStakeInfoList : []
8 | }
9 |
10 | export default (state=INITIAL_STATE , action) => {
11 | switch(action.type) {
12 | case ActionTypes.GetTokenStakeInfoList :
13 | return ({
14 | ...state ,
15 | tokenStakeInfoList : action.payload
16 | })
17 | default :
18 | return state ;
19 | }
20 | }
--------------------------------------------------------------------------------
/src/redux/reducers/wallet.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | import ActionTypes from '../actions/actionTypes' ;
6 |
7 | const INITIAL_STATE = {
8 | isConnected : false ,
9 | address : '' ,
10 | balance : 0 ,
11 | }
12 |
13 | export default (state=INITIAL_STATE , action={}) => {
14 | switch(action.type) {
15 | case ActionTypes.SetWalletAddress :
16 | return ({
17 | ...state ,
18 | address : action.payload ,
19 | })
20 | default :
21 | return state ;
22 | }
23 | }
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/dash.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/ethereum.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/hooks/useTokenContract.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import { useMemo } from "react";
4 | import { useWeb3React } from "@web3-react/core";
5 |
6 | import { ethers } from "ethers";
7 |
8 | import TOKEN_ABI from '../constants/abis/token.json';
9 |
10 | export const useTokenContract = (TOKEN_ADDR , SYMBOL) => {
11 |
12 | const { library, active } = useWeb3React();
13 |
14 | return useMemo(() => {
15 | if (!active || SYMBOL === "ETH") {
16 | return null;
17 | }
18 |
19 | return new ethers.Contract(TOKEN_ADDR, TOKEN_ABI, library.getSigner());
20 | })
21 | }
--------------------------------------------------------------------------------
/src/hooks/useCaladexContract.js:
--------------------------------------------------------------------------------
1 |
2 | import { useMemo } from "react";
3 | import { useWeb3React } from "@web3-react/core";
4 |
5 | import { ethers } from "ethers";
6 |
7 | import CALADEX_ABI from '../constants/abis/caladex.json';
8 | import { CALADEX_ADDR } from '../constants' ;
9 |
10 | export const useCaladexContract = () => {
11 | const { library, active } = useWeb3React();
12 |
13 | return useMemo(() => {
14 | if (!active) {
15 | return null;
16 | }
17 |
18 | return new ethers.Contract(CALADEX_ADDR, CALADEX_ABI, library.getSigner());
19 | })
20 | }
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.gif",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/history.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Time" : "014400" ,
4 | "Price" : "5000.00" ,
5 | "Amount" : "72.000000"
6 | },
7 | {
8 | "Time" : "014400" ,
9 | "Price" : "5000.00" ,
10 | "Amount" : "72.000000"
11 | },
12 | {
13 | "Time" : "014400" ,
14 | "Price" : "5000.00" ,
15 | "Amount" : "72.000000"
16 | },
17 | {
18 | "Time" : "014400" ,
19 | "Price" : "5000.00" ,
20 | "Amount" : "72.000000"
21 | },
22 | {
23 | "Time" : "014400" ,
24 | "Price" : "5000.00" ,
25 | "Amount" : "72.000000"
26 | }
27 | ]
--------------------------------------------------------------------------------
/src/redux/reducers/index.js:
--------------------------------------------------------------------------------
1 | import { combineReducers } from 'redux' ;
2 |
3 | import authReducer from './auth' ;
4 | import walletReducer from './wallet' ;
5 | import cryptoReducer from './crypto' ;
6 | import tokenReducer from './token' ;
7 | import tradeReducer from './trade' ;
8 | import stakeReducer from './stake' ;
9 | import orderReducer from './order' ;
10 | import balanceReducer from './balance' ;
11 |
12 | export default combineReducers({
13 | auth : authReducer ,
14 | wallet : walletReducer ,
15 | crypto : cryptoReducer ,
16 | token : tokenReducer ,
17 | trade : tradeReducer ,
18 | stake : stakeReducer ,
19 | order : orderReducer,
20 | balance : balanceReducer,
21 | });
--------------------------------------------------------------------------------
/src/redux/reducers/balance.js:
--------------------------------------------------------------------------------
1 | import ActionTypes from "../actions/actionTypes";
2 |
3 | const INITIAL_STATE = {
4 | depositStatusObject : {} ,
5 | withdrawStatusObject : {}
6 | }
7 |
8 | export default (state=INITIAL_STATE , action) => {
9 | switch(action.type) {
10 | case ActionTypes.UpdateDepositStatus :
11 | return ({
12 | ...state ,
13 | depositStatusObject : action.payload
14 | })
15 | case ActionTypes.UpdateWithdrawStatus :
16 | return ({
17 | ...state,
18 | withdrawStatusObject : action.payload
19 | })
20 | default :
21 | return state ;
22 | }
23 | }
--------------------------------------------------------------------------------
/src/components/New folder (2)/Balances/EmptyWidget/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import {
6 | Card,
7 | CardContent,
8 | } from '@mui/material';
9 |
10 | import { makeStyles } from '@mui/styles';
11 |
12 | const useStyles = makeStyles((theme) => ({
13 | root : {
14 | border : "1px solid lightgray"
15 | }
16 | }));
17 | const EmptyWidget = () => {
18 | const classes = useStyles() ;
19 |
20 | return (
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | )
29 | }
30 |
31 | export default EmptyWidget ;
--------------------------------------------------------------------------------
/src/pages/Orders/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { makeStyles } from '@mui/styles';
6 |
7 | import OrdersHistory from '../../components/Orders/OrdersHistory' ;
8 |
9 | const useStyles = makeStyles((theme) => ({
10 | root : {
11 | marginTop : theme.spacing(4),
12 | marginLeft : "7%",
13 | marginRight : "7%" ,
14 | height : "calc(100vh - 126px)",
15 | },
16 | }));
17 |
18 | const Orders = () => {
19 |
20 | const classes = useStyles() ;
21 |
22 | return (
23 | <>
24 |
25 |
26 |
27 | >
28 | )
29 | }
30 |
31 | export default Orders ;
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/litecoin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/quotesOne.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Price" : "0.014400" ,
4 | "Amount" : "5000.00",
5 | "Total" : "72.000000"
6 | },
7 | {
8 | "Price" : "0.014400" ,
9 | "Amount" : "5000.00",
10 | "Total" : "72.000000"
11 | },
12 | {
13 | "Price" : "0.014400" ,
14 | "Amount" : "5000.00",
15 | "Total" : "72.000000"
16 | },
17 | {
18 | "Price" : "0.014400" ,
19 | "Amount" : "5000.00",
20 | "Total" : "72.000000"
21 | },
22 | {
23 | "Price" : "0.014400" ,
24 | "Amount" : "5000.00",
25 | "Total" : "72.000000"
26 | },
27 | {
28 | "Price" : "0.014400" ,
29 | "Amount" : "5000.00",
30 | "Total" : "72.000000"
31 | }
32 | ]
--------------------------------------------------------------------------------
/src/static/tokensinfo/quotesTwo.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Price" : "0.014400" ,
4 | "Amount" : "5000.00",
5 | "Total" : "72.000000"
6 | },
7 | {
8 | "Price" : "0.014400" ,
9 | "Amount" : "5000.00",
10 | "Total" : "72.000000"
11 | },
12 | {
13 | "Price" : "0.014400" ,
14 | "Amount" : "5000.00",
15 | "Total" : "72.000000"
16 | },
17 | {
18 | "Price" : "0.014400" ,
19 | "Amount" : "5000.00",
20 | "Total" : "72.000000"
21 | },
22 | {
23 | "Price" : "0.014400" ,
24 | "Amount" : "5000.00",
25 | "Total" : "72.000000"
26 | },
27 | {
28 | "Price" : "0.014400" ,
29 | "Amount" : "5000.00",
30 | "Total" : "72.000000"
31 | }
32 | ]
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/PriceMean/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 |
7 | import {
8 | Box
9 | } from '@mui/material' ;
10 |
11 |
12 | import { makeStyles } from '@mui/styles';
13 |
14 | const useStyles = makeStyles((theme) => ({
15 | root : {
16 | display : "flex" ,
17 | justifyContent : "center" ,
18 | alignItems : "center" ,
19 | height : "33px" ,
20 | fontSize : "14px" ,
21 | fontWeight : "bold" ,
22 | color : props => `${props.color}`
23 | }
24 | }));
25 |
26 | const PriceMean = () => {
27 |
28 | const classes = useStyles({color : "#c74a4d"}) ;
29 |
30 | return (
31 |
32 | 36605.21578968 USD
33 |
34 | )
35 | }
36 |
37 | export default PriceMean ;
--------------------------------------------------------------------------------
/src/constants/abis/greeter.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "inputs": [
4 | {
5 | "internalType": "string",
6 | "name": "_greeting",
7 | "type": "string"
8 | }
9 | ],
10 | "stateMutability": "nonpayable",
11 | "type": "constructor"
12 | },
13 | {
14 | "inputs": [],
15 | "name": "greet",
16 | "outputs": [
17 | {
18 | "internalType": "string",
19 | "name": "",
20 | "type": "string"
21 | }
22 | ],
23 | "stateMutability": "view",
24 | "type": "function"
25 | },
26 | {
27 | "inputs": [
28 | {
29 | "internalType": "string",
30 | "name": "_greeting",
31 | "type": "string"
32 | }
33 | ],
34 | "name": "setGreeting",
35 | "outputs": [],
36 | "stateMutability": "nonpayable",
37 | "type": "function"
38 | }
39 | ]
--------------------------------------------------------------------------------
/src/redux/reducers/order.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import ActionTypes from '../actions/actionTypes' ;
4 |
5 | const INITIAL_STATE ={
6 | orderHistoryList : [],
7 | orderTradeHistoryList : [] ,
8 | exchangeOrderList : []
9 | }
10 |
11 | export default (state=INITIAL_STATE , action) => {
12 | switch(action.type) {
13 | case ActionTypes.GetOrderHistory :
14 | return ({
15 | ...state ,
16 | orderHistoryList : action.payload
17 | })
18 | case ActionTypes.GetOrderTradeHistory :
19 | return ({
20 | ...state ,
21 | orderTradeHistoryList : action.payload
22 | })
23 | case ActionTypes.GetExchangeOrderList :
24 | return ({
25 | ...state ,
26 | exchangeOrderList : action.payload
27 | })
28 | default :
29 | return state;
30 | }
31 | }
--------------------------------------------------------------------------------
/src/redux/actions/wallet.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import ActionTypes from "./actionTypes"
4 | import { setItem } from '../../utils/helper'
5 | import Web3 from 'web3' ;
6 |
7 | export const SetWalletAddress = ( address ) => async dispatch => {
8 | try {
9 |
10 | setItem("address" , address) ;
11 |
12 | dispatch({
13 | type : ActionTypes.SetWalletAddress ,
14 | payload : address ,
15 | });
16 | }
17 | catch(err) {
18 | console.log(err) ;
19 | }
20 | }
21 |
22 | export const GetWalletBalance = (address) => async dispatch => {
23 | try {
24 |
25 | // const web3 = new Web3('http://localhost:8545') ;
26 |
27 | // if(web3) web3.eth.getBalance( address, (err,bal) => {
28 | // // console.log('account 1 balance :' , web3.utils.fromWei(bal, 'ether'))
29 | // })
30 | }
31 | catch(err){
32 | console.log(err) ;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/redux/reducers/crypto.js:
--------------------------------------------------------------------------------
1 | import ActionTypes from "../actions/actionTypes";
2 |
3 | const INITIAL_STATE = {
4 | cryptoInfoList : [] ,
5 | cryptoExchangeRateList : [] ,
6 | cryptoBalanceList : []
7 | }
8 |
9 | export default (state = INITIAL_STATE , action ) => {
10 | switch(action.type) {
11 | case ActionTypes.GetAllCryptoInfo :
12 | return ({
13 | ...state ,
14 | cryptoInfoList : action.payload
15 | }) ;
16 | case ActionTypes.GetExchageRateToUSD :
17 | return ({
18 | ...state ,
19 | cryptoExchangeRateList : action.payload
20 | })
21 | case ActionTypes.GetWalletBalance :
22 | // console.log(action.payload) ;
23 | return ({
24 | ...state ,
25 | cryptoBalanceList : action.payload
26 | })
27 | default :
28 | return state ;
29 | }
30 | }
--------------------------------------------------------------------------------
/src/components/Exchange/TokenPriceBar/index.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import {
4 | Card ,
5 | CardContent ,
6 |
7 | } from '@mui/material' ;
8 |
9 | import { TickerTape } from 'react-ts-tradingview-widgets' ;
10 |
11 | import { makeStyles } from '@mui/styles';
12 |
13 | const useStyles = makeStyles((theme) => ({
14 | root : {
15 | marginTop : theme.spacing(5) ,
16 | boxShadow: "3px -4px 7px 0px lightblue !important",
17 | border : "1px solid lightblue !important" ,
18 | "& .js-copyright-label" : {
19 | visibility : "hidden !important",
20 | }
21 | } ,
22 | }));
23 |
24 | const TokenPriceTable = () => {
25 | const classes = useStyles() ;
26 |
27 | return (
28 |
29 |
30 |
31 |
32 |
33 |
34 | );
35 | }
36 |
37 | export default TokenPriceTable ;
--------------------------------------------------------------------------------
/src/components/Common/TokenSearch/index.js:
--------------------------------------------------------------------------------
1 |
2 | import React , { useEffect } from 'react' ;
3 |
4 | import {
5 | Box
6 | } from '@mui/material' ;
7 |
8 | import SearchIcon from '@mui/icons-material/Search';
9 |
10 | const TokenSearch = (props) => {
11 |
12 | const { searchForMoreTokens , searchCtrl} = props ;
13 |
14 | return (
15 | <>
16 |
17 |
18 |
19 |
20 |
21 |
22 | searchForMoreTokens(e.target.value)}/>
23 |
24 | >
25 | )
26 | }
27 |
28 | export default TokenSearch ;
--------------------------------------------------------------------------------
/src/components/Exchange/TradingView/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { AdvancedRealTimeChart } from 'react-ts-tradingview-widgets' ;
6 |
7 | import {
8 | Box
9 | } from '@mui/material' ;
10 |
11 | import { makeStyles } from '@mui/styles';
12 |
13 | const useStyles = makeStyles((theme) => ({
14 | root : {
15 | width : "100%" ,
16 | borderBottom : "1px solid gray" ,
17 | paddingBottom : "1px" ,
18 | height : "calc(50vh - 48px)" ,
19 | minHeight : "calc(50vh - 48px)"
20 | } ,
21 | }));
22 |
23 | const TradingView = () => {
24 |
25 | const classes = useStyles() ;
26 |
27 | return (
28 |
29 |
36 |
37 | )
38 | }
39 |
40 | export default TradingView ;
--------------------------------------------------------------------------------
/src/components/Orders/CustomDatePicker/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { makeStyles } from '@mui/styles';
7 |
8 | const useStyles = makeStyles((theme) => ({
9 | root : {
10 |
11 | }
12 | }));
13 |
14 | const CustomDatePicker = (props) => {
15 |
16 | const classes = useStyles() ;
17 |
18 | const {
19 | id ,
20 | setStartTime ,
21 | setEndTime
22 | } = props ;
23 |
24 | const handleDateTime = (e) => {
25 | if(id === 1) {
26 | setStartTime(e.target.value) ;
27 | return ;
28 | }
29 | if(id === 2) {
30 | setEndTime(e.target.value) ;
31 | return ;
32 | }
33 | }
34 |
35 | return (
36 |
37 | handleDateTime(e)}/>
38 |
39 | )
40 | }
41 |
42 | export default CustomDatePicker ;
--------------------------------------------------------------------------------
/src/redux/reducers/trade.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import ActionTypes from '../actions/actionTypes' ;
5 |
6 | const INITIAL_STATE = {
7 | tradeInfo : {} ,
8 | orderSellList : [] ,
9 | orderBuyList : [] ,
10 | orderTradeList : []
11 | }
12 |
13 | export default (state=INITIAL_STATE , action ) => {
14 | switch(action.type) {
15 | case ActionTypes.GetTradeHistory :
16 | return ({
17 | ...state ,
18 | tradeInfo : action.payload
19 | })
20 | case ActionTypes.GetTokenOrderSellList :
21 | return ({
22 | ...state ,
23 | orderSellList : action.payload
24 | })
25 | case ActionTypes.GetTokenOrderBuyList :
26 | return ({
27 | ...state ,
28 | orderBuyList : action.payload
29 | })
30 | case ActionTypes.GetTokenTradeList :
31 | return ({
32 | ...state ,
33 | orderTradeList : action.payload
34 | })
35 | default :
36 | return state;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/static/tokensinfo/baseinfo.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Name" : "Black Dragon" ,
4 | "Symbol" : "BDT" ,
5 | "Pair" : "ETH" ,
6 | "Address" : "0x4Efe8665e564bF454cCF5C90Ee16817F7485d5Cf",
7 | "Logo" : "https://s2.coinmarketcap.com/static/img/coins/64x64/7763.png"
8 | },
9 | {
10 | "Name" : "Nexo" ,
11 | "Symbol" : "NEXO" ,
12 | "Pair" : "ETH" ,
13 | "Address" : "0xb62132e35a6c13ee1ee0f84dc5d40bad8d815206",
14 | "Logo" : "https://s2.coinmarketcap.com/static/img/coins/64x64/2694.png"
15 | },
16 | {
17 | "Name" : "Harmony" ,
18 | "Symbol" : "ONE" ,
19 | "Pair" : "USDT" ,
20 | "Address" : "0x4Efe8665e564bF454cCF5C90Ee16817F7485d5Cf",
21 | "Logo" : "https://s2.coinmarketcap.com/static/img/coins/64x64/3945.png"
22 | },
23 | {
24 | "Name" : "The Sandbox" ,
25 | "Symbol" : "SAND" ,
26 | "Pair" : "ETH" ,
27 | "Address" : "0x3845badAde8e6dFF049820680d1F14bD3903a5d0",
28 | "Logo" : "https://s2.coinmarketcap.com/static/img/coins/64x64/6210.png"
29 | }
30 | ]
--------------------------------------------------------------------------------
/src/components/Exchange/Trade/TradeSelectBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | import React from 'react' ;
6 |
7 | import {
8 | Box
9 | } from '@mui/material' ;
10 |
11 |
12 | import { makeStyles } from '@mui/styles';
13 |
14 | const useStyles = makeStyles(() => ({
15 | root : {
16 | borderBottom : "2px solid lightgray" ,
17 | height : "40px" ,
18 | display : "flex" ,
19 | alignItems : "flex-end" ,
20 | paddingLeft : "20px" ,
21 | fontWeight : "bold"
22 | },
23 | token :{
24 | fontSize : "13px",
25 | paddingLeft : "15px"
26 | }
27 | }));
28 |
29 | const TradeSelectBox = (props) => {
30 |
31 | const { tradeToken } = props ;
32 |
33 | const classes = useStyles() ;
34 |
35 | return (
36 |
37 | Market Trade
38 |
39 | ({ tradeToken ? ( tradeToken.symbol + " / " + tradeToken.pair_type ) : "..."})
40 |
41 |
42 | )
43 | }
44 |
45 |
46 | export default TradeSelectBox ;
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/bitcoin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/Exchange/RecentOrder/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import RecentSelectBox from './RecentSelectBox' ;
7 | import RecentOrderList from './RecentOrderList' ;
8 |
9 | import {
10 | Box,
11 | Grid
12 | } from '@mui/material' ;
13 |
14 | import { makeStyles } from '@mui/styles';
15 |
16 | const useStyles = makeStyles(() => ({
17 | root : {
18 | maxHeight : "calc(50vh - 115px)" ,
19 | height : "calc(50vh - 115px)" ,
20 | }
21 | }));
22 |
23 | const RecentOrder = (props) => {
24 |
25 | const classes = useStyles() ;
26 |
27 | const {
28 | tradeToken
29 | } = props ;
30 |
31 | return (
32 |
33 |
34 |
35 |
36 |
37 |
38 |
41 |
42 |
43 |
44 | )
45 | }
46 |
47 | export default RecentOrder ;
--------------------------------------------------------------------------------
/src/components/Exchange/TradingWidget/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import {AdvancedRealTimeChart , } from 'react-ts-tradingview-widgets' ;
6 |
7 | import {
8 | Card ,
9 | CardContent
10 | } from '@mui/material' ;
11 |
12 | import { makeStyles } from '@mui/styles';
13 |
14 | const useStyles = makeStyles((theme) => ({
15 | root : {
16 | marginTop : theme.spacing(3) ,
17 | boxShadow: "3px -4px 7px 0px lightblue !important",
18 | border : "1px solid lightblue" ,
19 | height : "415px" ,
20 | } ,
21 | }));
22 |
23 | const TradingWidget = () => {
24 |
25 | const classes = useStyles() ;
26 |
27 | return (
28 | <>
29 |
30 |
31 |
37 |
38 |
39 |
40 | >
41 | )
42 | }
43 |
44 | export default TradingWidget ;
--------------------------------------------------------------------------------
/src/pages/TokenInfoBase/index.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react' ;
3 |
4 |
5 | import { makeStyles } from '@mui/styles';
6 | import TokenInfoBaseTable from '../../components/TokenInfoBase/TokenInfoBaseTable';
7 |
8 | import {
9 | CardContent ,
10 | Card
11 | } from '@mui/material';
12 |
13 | const useStyles = makeStyles((theme) => ({
14 | root : {
15 | marginTop : theme.spacing(10) ,
16 | minHeight : "calc(100vh - 124px)" ,
17 | },
18 | card : {
19 | boxShadow: "3px -4px 7px 0px lightblue !important",
20 | border : "1px solid lightblue" ,
21 | marginLeft : theme.spacing(2) + " !important" ,
22 | marginRight : theme.spacing(2) + " !important" ,
23 | marginBottom : "0px !important"
24 | }
25 | }));
26 | const TokenInfoBase = () => {
27 |
28 | const classes = useStyles() ;
29 |
30 | return (
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | )
39 | }
40 |
41 | export default TokenInfoBase ;
--------------------------------------------------------------------------------
/src/components/Exchange/Marketing/BuyAndSell/SelectPairToken/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | import React from 'react' ;
6 |
7 | import {
8 | Box,
9 | CircularProgress ,
10 | } from '@mui/material' ;
11 |
12 | import { makeStyles } from '@mui/styles';
13 |
14 | const useStyles = makeStyles((theme) => ({
15 | root : {
16 | marginTop : "10px",
17 | padding : "20px",
18 | textAlign : "center" ,
19 | "& .MuiGrid-item" : {
20 | marginBottom : "15px"
21 | },
22 | "& .MuiButton-root" : {
23 | borderRadius : "15px",
24 | marginLeft : "5px",
25 | marginRight : "5px"
26 | }
27 | },
28 | btGp : {
29 | "& .MuiButton-root" : {
30 | borderRadius : "5px",
31 | marginLeft : "15px",
32 | marginRight : "15px" ,
33 | textTransform : "capitalize"
34 | }
35 | }
36 | }));
37 |
38 | const SelectPairToken = () => {
39 |
40 | const classes = useStyles() ;
41 |
42 | return (
43 |
44 |
45 |
46 | )
47 | }
48 | export default SelectPairToken;
--------------------------------------------------------------------------------
/src/components/Exchange/Trade/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import TradeSelectBox from './TradeSelectBox';
6 | import MarketTradeList from './MarketTradeList';
7 |
8 | import {
9 | Box ,
10 | Grid
11 | } from '@mui/material' ;
12 |
13 | import { makeStyles } from '@mui/styles';
14 |
15 | const useStyles = makeStyles(() => ({
16 | root : {
17 | height : "calc(50vh - 48px)" ,
18 | borderLeft : "1px solid gray" ,
19 | borderBottom : "1px solid gray"
20 | }
21 | }));
22 |
23 | const Trade = (props) => {
24 |
25 | const { tradeToken } = props ;
26 |
27 | const classes = useStyles() ;
28 |
29 | return (
30 |
31 |
32 |
33 |
36 |
37 |
38 |
41 |
42 |
43 |
44 | )
45 | }
46 |
47 |
48 | export default Trade ;
--------------------------------------------------------------------------------
/src/pages/Balances/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect } from 'react' ;
4 |
5 | import { makeStyles } from '@mui/styles';
6 |
7 | import {
8 | Grid ,
9 | useMediaQuery
10 | } from '@mui/material';
11 |
12 | import AddressWidget from '../../components/Balances/AddressWidget';
13 | import WalletManagement from '../../components/Balances/WalletManagement' ;
14 |
15 |
16 | const useStyles = makeStyles((theme) => ({
17 | root : {
18 | marginTop : "50px" ,
19 | marginLeft : "7%",
20 | marginRight : "7%" ,
21 | minHeight : "calc(100vh - 124px)" ,
22 | },
23 | }));
24 |
25 | const Balances = () => {
26 |
27 | const classes = useStyles() ;
28 |
29 | const isXs = useMediaQuery("(min-width: 1285px)") ;
30 |
31 | return (
32 | <>
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | >
44 | )
45 | }
46 |
47 | export default Balances ;
--------------------------------------------------------------------------------
/src/utils/Language.js:
--------------------------------------------------------------------------------
1 | import React, { useState, createContext , useContext } from 'react';
2 |
3 | import { languageOptions, dictionaryList } from '../static/languages';
4 |
5 | // create the language context with default selected language
6 | export const LanguageContext = createContext({
7 | userLanguage: 'en',
8 | dictionary: dictionaryList.en
9 | });
10 |
11 | // it provides the language context to app
12 | export function LanguageProvider({ children }) {
13 |
14 | const [userLanguage, setUserLanguage] = useState('en');
15 |
16 | const provider = {
17 |
18 | userLanguage,
19 |
20 | dictionary: dictionaryList[userLanguage],
21 |
22 | userLanguageChange : selected => {
23 |
24 | const newLanguage = languageOptions[selected] ? selected : 'en'
25 | setUserLanguage(newLanguage);
26 | window.localStorage.setItem('rcml-lang', newLanguage);
27 |
28 | }
29 |
30 | };
31 |
32 | return (
33 |
34 | {children}
35 |
36 | );
37 | };
38 |
39 | // get text according to id & current language
40 | export function Text({ tid }) {
41 | const languageContext = useContext(LanguageContext);
42 |
43 | return languageContext.dictionary[tid] || tid;
44 | };
45 |
--------------------------------------------------------------------------------
/src/components/Routes.js:
--------------------------------------------------------------------------------
1 | import React, { memo } from "react";
2 | // import PropTypes from "prop-types";
3 |
4 | import { Routes , Route } from "react-router-dom";
5 |
6 | import ProtectedRoute from "../utils/ProtectedRoute";
7 |
8 | // Pages
9 | import Landing from "../pages/Landing" ;
10 | import Exchange from "../pages/Exchange" ;
11 | import TokenInfoBase from '../pages/TokenInfoBase' ;
12 | import EarnStaking from '../pages/EarnStaking' ;
13 | import Balances from "../pages/Balances";
14 | import Orders from '../pages/Orders' ;
15 |
16 | const Routing = () => {
17 | // const { selectLanding } = props;
18 |
19 | return (
20 |
21 | } />
22 | }>
23 | } />
24 | } />
25 | } />
26 | } />
27 | } />
28 |
29 |
30 | );
31 | }
32 |
33 | Routing.propTypes = {
34 | // selectLanding: PropTypes.func.isRequired,
35 | };
36 |
37 | export default memo(Routing);
38 |
--------------------------------------------------------------------------------
/src/pages/EarnStaking/index.js:
--------------------------------------------------------------------------------
1 |
2 | import React, { useEffect , useState} from 'react' ;
3 |
4 | import Title from '../../components/Common/Title';
5 | import CalaDexTradingTickerTape from '../../components/Common/CalaDexTradingTickerTape' ;
6 |
7 | import StakingTable from '../../components/EarnStaking/StakingTable' ;
8 | import { TickerTape } from 'react-ts-tradingview-widgets';
9 |
10 | import { makeStyles } from '@mui/styles';
11 | import { getItem } from '../../utils/helper';
12 |
13 | const useStyles = makeStyles(() => ({
14 | root : {
15 | minHeight : "calc( 100vh - 125px )" ,
16 | }
17 | }));
18 | const EarnStaking = () => {
19 |
20 | const classes = useStyles() ;
21 |
22 | return (
23 |
24 |
30 |
31 |
32 |
33 | {/* */}
34 |
35 |
36 |
37 | )
38 | }
39 |
40 | export default EarnStaking ;
--------------------------------------------------------------------------------
/src/redux/reducers/token.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import ActionTypes from '../actions/actionTypes' ;
5 |
6 | const INITIAL_STATE = {
7 | message : "IDLE" ,
8 | tokenInfoList : [] ,
9 | tokenLiquidityList : [] ,
10 | tokenBalanceInfo : []
11 | }
12 |
13 | export default (state=INITIAL_STATE , action) => {
14 | switch(action.type){
15 | case ActionTypes.AddTokenSuccess :
16 | return ({
17 | ...state ,
18 | message : "SUCCESS"
19 | })
20 | case ActionTypes.AddTokenError :
21 | return ({
22 | ...state,
23 | message : "ERROR"
24 | })
25 | case ActionTypes.ConfirmAddToken :
26 | return ({
27 | ...state ,
28 | message : "IDLE"
29 | })
30 | case ActionTypes.GetTokenInfoList :
31 | return ({
32 | ...state ,
33 | tokenInfoList : action.payload
34 | })
35 | case ActionTypes.GetTokenLiquidityList :
36 | return ({
37 | ...state ,
38 | tokenLiquidityList : action.payload
39 | })
40 | case ActionTypes.GetTokenBalanceInfo :
41 | return ({
42 | ...state,
43 | tokenBalanceInfo : action.payload
44 | });
45 | default :
46 | return state ;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/components/Main.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect , useRef } from 'react' ;
4 |
5 | import { useNavigate } from 'react-router-dom' ;
6 |
7 | import Header from './Layouts/Header';
8 | import Footer from './Layouts/Footer' ;
9 |
10 | import Routing from './Routes';
11 |
12 | import { makeStyles } from '@mui/styles';
13 |
14 | import { getItem , setItem } from '../utils/helper';
15 |
16 | const useStyles = makeStyles((theme) => ({
17 | root : {
18 | "&::-webkit-scrollbar-thumb" : {
19 | backgroundColor : "gray" ,
20 | borderRadius : "5px"
21 | } ,
22 | "&::-webkit-scrollbar-track" : {
23 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
24 | },
25 | "&::-webkit-scrollbar":{
26 | width : "0.625rem"
27 | } ,
28 | maxHeight : "100vh" ,
29 | overflowY : "scroll" ,
30 | overflowX : "auto" ,
31 | padding : "0px !important" ,
32 | margin : "0px important"
33 | } ,
34 | }))
35 |
36 | const Main = () => {
37 | const classes = useStyles() ;
38 | const scrollTop = useRef({
39 | current : {
40 | innerText : "efefef"
41 | }
42 | }) ;
43 |
44 | return (
45 |
46 |
50 | )
51 | }
52 | export default Main ;
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 |
4 | // Suspense
5 | import { Fragment , Suspense , lazy } from 'react' ;
6 |
7 | // Theme
8 | import { ThemeProvider , CssBaseline } from '@mui/material';
9 | import theme from './utils/theme' ;
10 |
11 | // Global Style
12 | // import GlobalStyles from "./utils/globalstyles";
13 |
14 | // Language
15 | import { LanguageProvider } from "./utils/Language";
16 |
17 | // Pace
18 | // import Pace from "./utils/Pace";
19 |
20 | // Store
21 | import { Provider } from 'react-redux' ;
22 | import store from './redux';
23 |
24 | // Router
25 | import { BrowserRouter , Routes , Route } from 'react-router-dom';
26 |
27 | import "bootstrap/dist/css/bootstrap.min.css" ;
28 | import "bootstrap/dist/js/bootstrap.min.js" ;
29 |
30 | const MainComponent = lazy(() => import('./components/Main')) ;
31 |
32 |
33 | const App = () => {
34 | return (
35 |
36 |
37 |
38 |
39 |
40 | {/* */}
41 | {/* */}
42 | } >
43 |
44 | } />
45 |
46 |
47 |
48 |
49 |
50 |
51 | );
52 | }
53 |
54 | export default App;
55 |
--------------------------------------------------------------------------------
/src/components/EarnStaking/StakingDialog/CheckButton.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import CheckIcon from '@mui/icons-material/Check';
7 | import { makeStyles } from '@mui/styles';
8 |
9 | const useStyles = makeStyles(() => ({
10 | root :{
11 | position : 'absolute' ,
12 | visibility : props => props.visible ? "visible" : "hidden" ,
13 | width : props => props.width ,
14 | height : props => props.height,
15 | right : props => props.right ,
16 | top : props => props.top ,
17 | background : props => `linear-gradient(to top right, transparent 50%, ${props.color} 0)` ,
18 | borderRadius : props => props.borderRadius ,
19 | "& .MuiSvgIcon-root" : {
20 | width: "50%",
21 | height: "50%" ,
22 | fontWeight : "bold",
23 | },
24 | },
25 | check : {
26 | color : "white" ,
27 | marginBottom : "50%" ,
28 | marginLeft: "50%" ,
29 | display : "flex" ,
30 | alignItems : "center" ,
31 | justifyContent : "center" ,
32 | fontSize : "18px !important" ,
33 | }
34 | }));
35 | const CheckButton = (props) => {
36 |
37 | const { width , height , right , top , color , borderRadius} = props ;
38 |
39 | const classes = useStyles(props) ;
40 |
41 | return (
42 |
43 |
44 |
45 | )
46 | }
47 |
48 |
49 | export default CheckButton ;
--------------------------------------------------------------------------------
/src/components/New folder (2)/EarnStaking/StakingDialog/CheckButton.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import CheckIcon from '@mui/icons-material/Check';
7 | import { makeStyles } from '@mui/styles';
8 |
9 | const useStyles = makeStyles(() => ({
10 | root :{
11 | position : 'absolute' ,
12 | visibility : props => props.visible ? "visible" : "hidden" ,
13 | width : props => props.width ,
14 | height : props => props.height,
15 | right : props => props.right ,
16 | top : props => props.top ,
17 | background : props => `linear-gradient(to top right, transparent 50%, ${props.color} 0)` ,
18 | borderRadius : props => props.borderRadius ,
19 | "& .MuiSvgIcon-root" : {
20 | width: "50%",
21 | height: "50%" ,
22 | fontWeight : "bold",
23 | },
24 | },
25 | check : {
26 | color : "white" ,
27 | marginBottom : "50%" ,
28 | marginLeft: "50%" ,
29 | display : "flex" ,
30 | alignItems : "center" ,
31 | justifyContent : "center" ,
32 | fontSize : "18px !important" ,
33 | }
34 | }));
35 | const CheckButton = (props) => {
36 |
37 | const { width , height , right , top , color , borderRadius} = props ;
38 |
39 | const classes = useStyles(props) ;
40 |
41 | return (
42 |
43 |
44 |
45 | )
46 | }
47 |
48 |
49 | export default CheckButton ;
--------------------------------------------------------------------------------
/src/redux/actions/actionTypes.js:
--------------------------------------------------------------------------------
1 |
2 | const ActionTypes = {
3 | SignUpUser : "SignUpUser" ,
4 |
5 | SetWalletAddress : "SetWalletAddress" ,
6 | GetWalletBalance : "GetWalletBalance" ,
7 |
8 | // Landing Page's TokenTable
9 | GetTokenLiquidityList : "GetTokenLiquidityList" ,
10 | GetTradeHistory : "GetTradeHistory" ,
11 |
12 |
13 | // Balances Page 's WalletMangement
14 | GetExchageRateToUSD : "GetExchageRateToUSD",
15 | GetTokenBalanceInfo : "GetTokenBalanceInfo" ,
16 | SetTokenBalance : "SetTokenBalance" ,
17 | UpdateDepositStatus : "UpdateDepositStatus" ,
18 | UpdateWithdrawStatus : "UpdateWithdrawStatus" ,
19 |
20 |
21 | //Token Listing Page
22 | AddTokenSuccess : "AddTokenSuccess" ,
23 | AddTokenError : "AddTokenError" ,
24 | ConfirmAddToken : "ConfirmAddToken" ,
25 |
26 |
27 |
28 | //Token Info Base page
29 | GetTokenInfoList : "GetTokenInfoList" ,
30 |
31 |
32 | //Earn Staking Page
33 | GetTokenStakeInfoList : "GetTokenStakeInfoList" ,
34 |
35 |
36 | // Exchange Page
37 | GetTokenOrderSellList : "GetTokenOrderSellList" ,
38 | GetTokenOrderBuyList : "GetTokenOrderBuyList" ,
39 | GetTokenTradeList : "GetTokenTradeList" ,
40 | GetExchangeOrderList : "GetExchangeOrderList" ,
41 |
42 | OrderLimit : "OrderLimit" ,
43 | OrderMarket : "OrderMarket" ,
44 | OrderError : "OrderError" ,
45 |
46 | // Orders Page
47 | GetOrderHistory : "GetOrderHistory" ,
48 | GetOrderTradeHistory : "GetOrderTradeHistory" ,
49 |
50 | }
51 |
52 | export default ActionTypes ;
--------------------------------------------------------------------------------
/src/components/Exchange/TokenList/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect , useRef } from 'react' ;
4 |
5 | import TokenPairBox from './TokenPairBox';
6 | import TokenSearchBox from './TokenSearchBox';
7 | import TokenInfoList from './TokenInfoList';
8 |
9 | import {
10 | Box ,
11 | Grid
12 | } from '@mui/material' ;
13 |
14 | import { makeStyles } from '@mui/styles';
15 |
16 | const useStyles = makeStyles(() => ({
17 | root : {
18 | backgroundColor : "white" ,
19 | top : 0,
20 | width : '100%' ,
21 | height : "calc(100vh - 122px)" ,
22 | position : "absolute" ,
23 | zIndex : 2000
24 | }
25 | }));
26 |
27 | const TokenList = (props) => {
28 |
29 | const classes = useStyles() ;
30 |
31 | const {
32 | handleChangeTokenId , handleChangeToken, handlePairInfoVisible
33 | } = props ;
34 |
35 | return (
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
53 | )
54 | }
55 |
56 | export default TokenList ;
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/OrderLableBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React, { useEffect } from 'react' ;
5 |
6 | import {
7 | Grid ,
8 | Box
9 | } from '@mui/material' ;
10 |
11 | import { makeStyles } from '@mui/styles';
12 |
13 | const useStyles = makeStyles((theme) => ({
14 | root : {
15 | height : "30px",
16 | display : "flex" ,
17 | alignItems : "center",
18 | "& .MuiGrid-item" : {
19 | color : theme.palette.primary.main ,
20 | textAlign : "center" ,
21 | fontSize : "11px" ,
22 | fontWeight : "bold" ,
23 | textAlign : "right"
24 | }
25 | }
26 | }));
27 |
28 | const OrderLableBox = (props) => {
29 |
30 | const { tradeToken } = props ;
31 |
32 | const classes = useStyles() ;
33 |
34 | useEffect(() => {
35 |
36 |
37 | } , [tradeToken]) ;
38 | return (
39 |
40 |
41 |
42 | PRICE({
43 | tradeToken ? tradeToken.symbol : "..."
44 | })
45 |
46 |
47 | AMOUNT({
48 | tradeToken ? tradeToken.symbol : "..."
49 | })
50 |
51 |
52 | TOTAL({
53 | tradeToken ? tradeToken.pair_type : "..."
54 | })
55 |
56 |
57 |
58 | )
59 | }
60 |
61 |
62 | export default OrderLableBox ;
--------------------------------------------------------------------------------
/src/components/Exchange/Marketing/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useState } from 'react' ;
4 |
5 | import { useWeb3React } from '@web3-react/core';
6 |
7 | import MarketSelectBox from './MarketSelectBox';
8 | import BuyAndSell from './BuyAndSell' ;
9 | import WalletConnect from '../WalletConnect';
10 |
11 | import {
12 | Box
13 | } from '@mui/material' ;
14 |
15 | import { makeStyles } from '@mui/styles';
16 |
17 | const useStyles = makeStyles((theme) => ({
18 | root : {
19 | // maxHeight : "calc(50vh - 113.815px)" ,
20 | // height : "calc(50vh - 113.815px)" ,
21 | } ,
22 | }));
23 |
24 | const Marketing = (props) => {
25 |
26 | const classes = useStyles() ;
27 |
28 | const { active } = useWeb3React() ;
29 |
30 |
31 | const {
32 | tradeToken , price , status , handleChangePrice ,
33 | methodType , setMethodType
34 | } = props ;
35 |
36 | return (
37 |
38 |
44 | {
45 | active ? :
53 | }
54 |
55 |
56 | )
57 | }
58 |
59 | export default Marketing ;
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/OrderSelectBox/OrderTypeBt/Badge.styled.js:
--------------------------------------------------------------------------------
1 |
2 | import { styled } from '@mui/system';
3 | import BadgeUnstyled from '@mui/base/BadgeUnstyled';
4 |
5 | const StyledBadge = styled(BadgeUnstyled)`
6 | box-sizing: border-box;
7 | margin: 0;
8 | padding: 0;
9 | color: rgba(0, 0, 0, 0.85);
10 | font-size: 11px;
11 | font-variant: tabular-nums;
12 | list-style: none;
13 | font-feature-settings: 'tnum';
14 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
15 | 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
16 | 'Segoe UI Symbol';
17 | position: relative;
18 | display: inline-block;
19 | line-height: 1;
20 |
21 | & .MuiBadge-badge {
22 | visibility : ${props => props.badgeContent === "0" ? "hidden" : "visible"} ;
23 | z-index: 1300;
24 | width: 10px;
25 | height: 10px;
26 | color: #fff;
27 | font-weight: 400;
28 | font-size: 9px;
29 | text-align : center;
30 | white-space: nowrap;
31 | text-align: center;
32 | background: green;
33 | border-radius: 10px;
34 | box-shadow: 0 0 0 1px #fff;
35 | }
36 |
37 | & .MuiBadge-dot {
38 | padding: 0;
39 | z-index: auto;
40 | min-width: 6px;
41 | width: 6px;
42 | height: 6px;
43 | background: #ff4d4f;
44 | border-radius: 100%;
45 | box-shadow: 0 0 0 1px #fff;
46 | }
47 |
48 | & .MuiBadge-anchorOriginTopRight {
49 | position: absolute;
50 | top: 0;
51 | right: 0;
52 | transform: translate(50%, -50%);
53 | transform-origin: 100% 0;
54 | }
55 |
56 | & .MuiSvgIcon-root {
57 | padding : 0px;
58 | color : white;
59 | font-size : 10px;
60 | margin : 0px;
61 | vertical-align : none;
62 | }
63 | `;
64 |
65 |
66 | export default StyledBadge ;
--------------------------------------------------------------------------------
/src/components/Exchange/TokenList/TokenPairBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { useState } from 'react' ;
6 |
7 | import StarIcon from '@mui/icons-material/Star';
8 |
9 | import {
10 | Box ,
11 | } from '@mui/material' ;
12 |
13 | import { makeStyles } from '@mui/styles';
14 |
15 | const useStyles = makeStyles(() => ({
16 | root : {
17 | boxSizing : "border-box" ,
18 |
19 | display:"flex" ,
20 | alignItems : "flex-end" ,
21 | justifyContent : "space-around",
22 |
23 | borderBottom : "2px solid lightgray" ,
24 |
25 | height : "40px" ,
26 |
27 | "& div" :{
28 | cursor : "pointer" ,
29 | fontWeight : "bold" ,
30 | paddingLeft : "20px" ,
31 | paddingRight : "20px"
32 | }
33 | },
34 | active : {
35 | borderBottom : "1px solid blue"
36 | }
37 | }));
38 |
39 | const TokenPairBox = () => {
40 |
41 | const classes = useStyles() ;
42 |
43 | const [pairType , setPairType] = useState("ETH") ;
44 |
45 | const emitPairType = (pairType) => {
46 | setPairType(pairType) ;
47 |
48 | return ;
49 | }
50 |
51 | return (
52 |
53 |
54 |
55 |
56 | emitPairType("ETH")} className={pairType === "ETH" ? classes.active : ""}>
57 | ETH
58 |
59 | emitPairType("USDT")} className={pairType === "USDT" ? classes.active : ""}>
60 | USDT
61 |
62 |
63 | )
64 | }
65 |
66 | export default TokenPairBox ;
--------------------------------------------------------------------------------
/src/redux/actions/balance.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import axios from 'axios' ;
5 | import { PRIVATE_CALADEX_API } from '../../static/constants';
6 | import ActionTypes from './actionTypes' ;
7 |
8 | export const SetTokenBalance = (account , token_id , is_deposit , amount) => async dispatch => {
9 |
10 | try {
11 | let res = await axios.post(`${PRIVATE_CALADEX_API}balance/set` , {
12 | address : account ,
13 | token_id : token_id ,
14 | is_deposit : is_deposit ,
15 | amount : amount
16 | }) ;
17 |
18 |
19 | return ;
20 | }
21 | catch(err) {
22 | console.log(err) ;
23 | }
24 | }
25 |
26 | export const ApproveToken = async (amount , address , symbol ) => {
27 | try {
28 |
29 | let reqBody = {
30 | amount : amount ,
31 | symbol : symbol
32 | };
33 |
34 | if(address !== null) {
35 | reqBody = {
36 | ...reqBody ,
37 | address : address ,
38 | }
39 | }
40 |
41 | let res = await axios.post(`${PRIVATE_CALADEX_API}balance/withdraw` , reqBody) ;
42 |
43 | if(res.status === 201) {
44 | return "Error"
45 | }
46 |
47 | return "Ok"
48 | }
49 | catch(err) {
50 | console.log(err) ;
51 | return "Error"
52 | }
53 | }
54 |
55 | export const UpdateDepositStatus = (depositStatusObject) => async dispatch => {
56 | return dispatch({
57 | type : ActionTypes.UpdateDepositStatus ,
58 | payload : depositStatusObject
59 | })
60 | }
61 |
62 | export const UpdateWithdrawStatus = (withdrawStatusObject) => async dispatch => {
63 | return dispatch({
64 | type : ActionTypes.UpdateWithdrawStatus ,
65 | payload : withdrawStatusObject
66 | })
67 | }
--------------------------------------------------------------------------------
/src/components/Exchange/TokenPriceTable/index.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import {
4 | Card ,
5 | CardContent ,
6 | } from '@mui/material' ;
7 |
8 | // import { CryptoCurrencyMarket } from 'react-ts-tradingview-widgets' ;
9 |
10 | import { makeStyles } from '@mui/styles';
11 |
12 | const useStyles = makeStyles((theme) => ({
13 | root : {
14 | marginTop : theme.spacing(5) ,
15 | boxShadow: "3px -4px 7px 0px lightblue !important",
16 | border : "1px solid lightblue" ,
17 | height : "450px"
18 | } ,
19 | crpytoList : {
20 | overflowX : "scroll !important"
21 | }
22 | }));
23 |
24 |
25 | const TokenPriceTable = () => {
26 | const classes = useStyles() ;
27 |
28 | return (
29 |
30 |
31 | {/* */}
38 |
39 |
52 |
53 |
54 |
55 | );
56 | }
57 |
58 | export default TokenPriceTable ;
--------------------------------------------------------------------------------
/src/components/Exchange/Marketing/MarketSelectBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { useState } from 'react' ;
7 |
8 | import {
9 | Box ,
10 | Grid ,
11 | } from '@mui/material' ;
12 |
13 | import { makeStyles } from '@mui/styles';
14 |
15 | const useStyles = makeStyles((theme) => ({
16 | root : {
17 | height : "42px" ,
18 | paddingLeft : "20px" ,
19 | fontWeight : "bold" ,
20 | display : "flex" ,
21 | alignItems : "flex-end" ,
22 | borderBottom : "2px solid lightgray",
23 | "& .MuiGrid-root" : {
24 |
25 | },
26 | "& .MuiGrid-item" :{
27 | textAlign : "center" ,
28 | cursor : "grab"
29 | }
30 | } ,
31 | active : {
32 | borderBottom : "1px solid blue !important"
33 | }
34 | }));
35 |
36 | const MarketSelectBox = (props) => {
37 |
38 | const classes = useStyles() ;
39 |
40 | const {
41 | handleChangePrice ,
42 | setMethodType ,
43 | methodType
44 | } = props ;
45 |
46 | const emitChangeMethodType = async (methodType) => {
47 | await handleChangePrice(null) ;
48 |
49 | if(methodType === 1) {
50 | setMethodType(1) ;
51 | }
52 | if(methodType === 2) {
53 | setMethodType(2)
54 | }
55 | }
56 |
57 | return (
58 |
59 |
60 | emitChangeMethodType(1)} className={ methodType === 1 ? classes.active : ""}>
61 | Limit
62 |
63 | emitChangeMethodType(2)} className={ methodType === 2 ? classes.active : ""}>
64 | Market
65 |
66 |
67 |
68 | )
69 | }
70 |
71 | export default MarketSelectBox ;
--------------------------------------------------------------------------------
/src/utils/theme.js:
--------------------------------------------------------------------------------
1 | import { createTheme, responsiveFontSizes } from "@mui/material/styles";
2 | import * as locale from '@mui/material/locale';
3 |
4 | import { DefaultLocale } from '../static/constants';
5 |
6 | // colors
7 | const primary = "#337ab7";
8 | const secondary = "#ec2027";
9 | const black = "#303030";
10 | const darkBlack = "#0c1319";
11 | const background = "#fff";
12 | const warningLight = "rgba(255, 246, 32, .3)";
13 | const warningMain = "rgba(255, 246, 32, .5)";
14 | const warningDark = "rgba(255, 246, 32, .7)";
15 |
16 | // border
17 | const borderWidth = 1;
18 | const borderColor = "#2e6da4";
19 |
20 | // breakpoints
21 | // const xl = 1920;
22 | // const lg = 1280;
23 | // const md = 960;
24 | // const sm = 600;
25 | // const xs = 0;
26 |
27 | // spacing
28 | const spacing = 8;
29 |
30 | const theme = createTheme({
31 | layout: {
32 | contentWidth: 1140,
33 | footerWidth: 1400
34 | },
35 | palette: {
36 | primary: { main: primary, footer: '#055da6' },
37 | secondary: { main: secondary },
38 | common: {
39 | black,
40 | darkBlack
41 | },
42 | warning: {
43 | light: warningLight,
44 | main: warningMain,
45 | dark: warningDark
46 | },
47 | tonalOffset: 0.2,
48 | background: {
49 | default: background,
50 | gray: '#f1f1f170'
51 | },
52 | spacing
53 | },
54 | // breakpoints: {
55 | // values: {
56 | // xl,
57 | // lg,
58 | // md,
59 | // sm,
60 | // xs
61 | // }
62 | // },
63 | border: {
64 | borderColor: borderColor,
65 | borderWidth: borderWidth
66 | },
67 | overrides: {
68 |
69 | },
70 | typography: {
71 | useNextVariants: true
72 | }
73 | }, locale[DefaultLocale]);
74 |
75 | export default responsiveFontSizes(theme);
76 |
--------------------------------------------------------------------------------
/src/components/Exchange/TokenList/TokenSearchBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { useState } from 'react' ;
6 |
7 | import SavedSearchOutlinedIcon from '@mui/icons-material/SavedSearchOutlined';
8 |
9 | import {
10 | Box ,
11 | FormControl,
12 | RadioGroup,
13 | FormControlLabel ,
14 | Radio
15 | } from '@mui/material' ;
16 |
17 | import { makeStyles } from '@mui/styles';
18 |
19 | const useStyles = makeStyles(() => ({
20 | root : {
21 | boxSizing : "border-box" ,
22 | padding : "5px",
23 |
24 | height : "30px",
25 |
26 | display : "flex" ,
27 | justifyContent : "space-between" ,
28 | alignItems : "center" ,
29 |
30 | borderBottom : "1px solid gray"
31 | },
32 | searchGp : {
33 | "& svg" : {
34 | fontSize : "20px"
35 | },
36 | "& input" : {
37 | border : "none" ,
38 | width : "70%" ,
39 | fontSize : "12px"
40 | },
41 | "& input:focus" : {
42 | outline : "none"
43 | }
44 | },
45 | radioGp : {
46 | display : "flex" ,
47 | alignItems : "center" ,
48 | fontSize : "12px",
49 | "& input" :{
50 | marginLeft : "15px",
51 | marginRight : "5px"
52 | }
53 | }
54 | }));
55 |
56 | const TokenSearchBox = () => {
57 |
58 | const classes = useStyles() ;
59 |
60 | return (
61 |
62 |
63 |
64 |
65 |
66 |
67 | Volume
68 | Balance
69 |
70 |
71 | )
72 | }
73 |
74 | export default TokenSearchBox ;
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 |
--------------------------------------------------------------------------------
/src/components/Orders/OrdersHistory/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { useState , useEffect } from 'react' ;
4 | import { useWeb3React } from '@web3-react/core';
5 | import { useNavigate } from 'react-router-dom';
6 |
7 | import CurrentOrderList from '../CurrentOrderList';
8 | import OrderHistoryList from '../OrderHistoryList' ;
9 |
10 | import {makeStyles} from '@mui/styles' ;
11 |
12 | import {
13 | Box ,
14 | Tab ,
15 | } from '@mui/material' ;
16 |
17 | import {
18 | TabContext ,
19 | TabList ,
20 | TabPanel
21 | } from '@mui/lab' ;
22 |
23 | const useStyles = makeStyles((theme) => ({
24 | root : {
25 | border : "1px solid lightgray"
26 | } ,
27 | tabLabel : {
28 | fontWeight : 'bold !important' ,
29 | },
30 | }));
31 |
32 | const OrdersHistory = () => {
33 |
34 | const classes = useStyles() ;
35 |
36 | const { active } = useWeb3React() ;
37 | const navigate = useNavigate() ;
38 |
39 | const [value, setValue] = useState('1');
40 |
41 | const handleChange = (event, newValue) => {
42 | setValue(newValue);
43 | };
44 |
45 | useEffect(() => {
46 | if(!active) {
47 | navigate('/') ;
48 | }
49 | } , [active]);
50 |
51 | return (
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | );
71 | }
72 |
73 | export default OrdersHistory ;
--------------------------------------------------------------------------------
/src/components/Exchange/RecentOrder/RecentSelectBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { useNavigate } from 'react-router-dom' ;
7 | import { useWeb3React } from '@web3-react/core' ;
8 |
9 | import GridViewIcon from '@mui/icons-material/GridView';
10 |
11 | import swal from 'sweetalert' ;
12 | import clsx from 'clsx';
13 |
14 | import {
15 | Box,
16 | Grid ,
17 | Stack
18 | } from '@mui/material' ;
19 |
20 | import { makeStyles } from '@mui/styles';
21 |
22 | const useStyles = makeStyles(() => ({
23 | root : {
24 | height : "30px" ,
25 | display : "flex" ,
26 | alignItems : "flex-end" ,
27 | paddingLeft : "30px",
28 | paddingRight : "30px",
29 | borderBottom : "1px solid gray"
30 | },
31 | tab : {
32 | paddingLeft : "10px" ,
33 | paddingRight :"10px" ,
34 | fontWeight : "bold" ,
35 | cursor : "grab"
36 | },
37 | active : {
38 | borderBottom : "1px solid blue"
39 | } ,
40 | stack : {
41 | width : "100%"
42 | }
43 | }));
44 |
45 | const RecentSelectBox = () => {
46 |
47 | const { active } = useWeb3React() ;
48 |
49 | const classes = useStyles() ;
50 |
51 | const navigate = useNavigate() ;
52 |
53 | const goToMoreOrder = () => {
54 | if(!active){
55 | swal({
56 | title : "Warning" ,
57 | text : "You have to connect to metamask." ,
58 | icon : "warning" ,
59 | timer : 2000 ,
60 | button : false
61 | })
62 | } else navigate("/orders") ;
63 | }
64 |
65 | return (
66 |
67 |
68 |
69 | Current Order
70 |
71 | {/* goToMoreOrder()}>
72 | More
73 | */}
74 |
75 |
76 | )
77 | }
78 |
79 | export default RecentSelectBox ;
--------------------------------------------------------------------------------
/src/static/tokensinfo/stakinginfo.js:
--------------------------------------------------------------------------------
1 | import CAX from '../../assets/avatar/CAX.png' ;
2 | import ADA from '../../assets/avatar/ADA.png' ;
3 | import BTC from '../../assets/avatar/BTC.png' ;
4 | import LTC from '../../assets/avatar/LTC.png' ;
5 | import NEM from '../../assets/avatar/NEM.png' ;
6 | import ETH from '../../assets/avatar/ETH.png' ;
7 | import EOS from '../../assets/avatar/EOS.png' ;
8 | import DASH from '../../assets/avatar/DASH.png' ;
9 |
10 | export const stakingInfo = [
11 | {
12 | "Avatar" : CAX ,
13 | "Coin" : "CAX" ,
14 | "Product" : "DOT Slot Action" ,
15 | "Est" : "--" ,
16 | "Duration" : "Fixed" ,
17 | "Action" : "Stake"
18 | },
19 | {
20 | "Avatar" : ADA,
21 | "Coin" : "ADA" ,
22 | "Product" : "Fixed Savings" ,
23 | "Est" : "25.00%" ,
24 | "Duration" : "7 Days" ,
25 | "Action" : "Stake"
26 | },
27 | {
28 | "Avatar" : BTC,
29 | "Coin" : "BTC" ,
30 | "Product" : "LaunchPool-MC" ,
31 | "Est" : "12.21%" ,
32 | "Duration" : "Flexible" ,
33 | "Action" : "Stake"
34 | },
35 | {
36 | "Avatar" : LTC ,
37 | "Coin" : "LTC" ,
38 | "Product" : "Staking" ,
39 | "Est" : "11.51%" ,
40 | "Duration" : "30 Days" ,
41 | "Action" : "Stake"
42 | },
43 | {
44 | "Avatar" : NEM,
45 | "Coin" : "NEM" ,
46 | "Product" : "Fixed Saving" ,
47 | "Est" : "9.00%" ,
48 | "Duration" : "60 Days" ,
49 | "Action" : "Stake"
50 | },
51 | {
52 | "Avatar" : ETH ,
53 | "Coin" : "ETH" ,
54 | "Product" : "Staking" ,
55 | "Est" : "6.53%" ,
56 | "Duration" : "Flexible" ,
57 | "Action" : "Stake"
58 | },
59 | {
60 | "Avatar" : EOS,
61 | "Coin" : "EOS" ,
62 | "Product" : "LaunchPool-MC" ,
63 | "Est" : "5.56%" ,
64 | "Duration" : "60 Days" ,
65 | "Action" : "Stake"
66 | },
67 | {
68 | "Avatar" : DASH ,
69 | "Coin" : "DASH" ,
70 | "Product" : "Flexible Savings" ,
71 | "Est" : "5.00%" ,
72 | "Duration" : "Flexible" ,
73 | "Action" : "Stake"
74 | }
75 | ]
--------------------------------------------------------------------------------
/src/components/Exchange/Marketing/BuyAndSell/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import Options from './Options' ;
6 | import SelectPairToken from './SelectPairToken';
7 |
8 | import clsx from 'clsx';
9 |
10 | import {
11 | Box ,
12 | Grid ,
13 | } from '@mui/material' ;
14 |
15 | import { makeStyles } from '@mui/styles';
16 |
17 | const useStyles = makeStyles((theme) => ({
18 | root : {
19 |
20 | '&::-webkit-scrollbar': {
21 | width: '8px',
22 | backgroundColor : "lightgray",
23 | borderRadius : "5px"
24 | },
25 | '&::-webkit-scrollbar-track': {
26 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
27 | },
28 | '&::-webkit-scrollbar-thumb': {
29 | backgroundColor: 'gray',
30 | borderRadius : "5px"
31 | },
32 |
33 | overflow :"hidden" ,
34 | overflowY : "scroll" ,
35 | height : "calc(100vh - 163px)" ,
36 | borderBottom : "1px solid gray" ,
37 | display : "flex " ,
38 | } ,
39 | btGp : {
40 | textAlign : "right" ,
41 | marginBottom : "15px !important",
42 | marginRight : clsx( theme.spacing(7) , " !important" ) ,
43 | "& .MuiButton-root" : {
44 | marginLeft : "25px"
45 | }
46 | }
47 | }));
48 |
49 | const BuyAndSell = (props) => {
50 |
51 | const {
52 | tradeToken , price , status , methodType ,
53 | handleChangePrice
54 | } = props ;
55 |
56 | const classes = useStyles() ;
57 |
58 | return (
59 |
60 |
61 |
62 | {
63 | tradeToken ? :
70 | }
71 |
72 |
73 |
74 |
75 | )
76 | }
77 |
78 | export default BuyAndSell ;
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
19 |
20 |
29 |
35 | CALADEX - Tokenize The World With Caladex
36 |
37 |
38 |
39 |
40 |
50 |
51 |
52 |
57 |
58 |
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | import React from 'react' ;
6 |
7 | import { useState } from 'react' ;
8 |
9 | import {
10 | Box
11 | } from '@mui/material' ;
12 |
13 | import OrderSelectBox from './OrderSelectBox';
14 | import OrderLableBox from './OrderLableBox';
15 | import OrderSellList from './OrderSellList';
16 | import PriceMean from './PriceMean' ;
17 | import OrderBuyList from './OrderBuyList';
18 |
19 | import { makeStyles } from '@mui/styles' ;
20 |
21 | const useStyles = makeStyles(() => ({
22 | root : {
23 | paddingLeft : "5px" ,
24 | paddingRight : "5px" ,
25 | borderRight : "1px solid gray" ,
26 | borderLeft : "1px solid lightgray" ,
27 | borderBottom : "1px solid gray" ,
28 | minHeight : "calc(100vh - 121px)" ,
29 | }
30 | }));
31 |
32 | const OrderBook = (props) => {
33 |
34 | const {
35 | tradeToken , tokenId ,
36 | handleChangePrice , handleChangeStatus ,
37 | setMethodType
38 | } = props ;
39 |
40 | const [ decimal , handleChangeDecimal ] = useState(6) ;
41 | const [ orderType , handleChangeOrderType ] = useState(3) ;
42 |
43 | const classes = useStyles() ;
44 |
45 | return (
46 |
47 |
48 |
52 |
53 |
56 |
57 |
65 |
66 |
67 |
68 |
76 |
77 |
78 | )
79 | }
80 |
81 |
82 | export default OrderBook ;
--------------------------------------------------------------------------------
/src/utils/helper.js:
--------------------------------------------------------------------------------
1 | import { ethers } from 'ethers';
2 |
3 | export const setItem = (key, item) => {
4 | if(item) {
5 | window.localStorage.setItem(key, item);
6 | } else {
7 | window.localStorage.removeItem(key);
8 | }
9 | }
10 |
11 | export const removeItem = (key) => {
12 | if(key) return window.localStorage.removeItem(key) ;
13 | }
14 | export const getItem = (key) => {
15 | if(key) {
16 | return window.localStorage.getItem(key);
17 | }
18 | }
19 |
20 | export const isAuthenticated = () => {
21 | if(getItem('access_token')) {
22 | return true ;
23 | }
24 | return false ;
25 | }
26 |
27 | export const getLibrary = (provider) => {
28 | return new ethers.providers.Web3Provider(provider) ;
29 | }
30 |
31 | export const isMetaMaskInstalled = () => {
32 | return Boolean(window.ethereum && window.ethereum.isMetaMask) ;
33 | }
34 | export const sleep = (milliseconds) => {
35 | const date = Date.now();
36 | let currentDate = null;
37 | do {
38 | currentDate = Date.now();
39 | } while (currentDate - date < milliseconds);
40 | }
41 |
42 | export const convertBalance = (balanceBigInt , decimal) => {
43 | // console.log(Number(Number(balanceBigInt) / Math.pow(10 , Number(decimal)) ) ) ;
44 | return Number(Number(balanceBigInt) / Math.pow(10 , Number(decimal)) ) ;
45 |
46 |
47 | }
48 |
49 | export const json2array = (json) => {
50 | var result = [];
51 | var keys = Object.keys(json);
52 |
53 | keys.forEach( key => {
54 | result.push(json[key]);
55 | });
56 |
57 | return result;
58 | }
59 |
60 | export const formatDBDate = (db_date) => {
61 |
62 | if(typeof db_date === "undefined") return ;
63 |
64 | let removeT_db_date = db_date.replace("T" , " ") ;
65 |
66 | let removeTail_db_date = removeT_db_date.replace(".000Z" , "") ;
67 |
68 | return removeTail_db_date.toString() ;
69 | }
70 |
71 | export const updateDepositTokensArray = async (token_id , value) => {
72 |
73 | let tmp = JSON.parse(getItem('depositArray')) ;
74 |
75 | tmp[token_id] = value ;
76 |
77 | await setItem('depositArray' , JSON.stringify(tmp)) ;
78 | }
79 |
80 | export const updateWithdrawTokensArray = async (token_id , value) => {
81 |
82 | let tmp = JSON.parse(getItem('withdrawArray')) ;
83 |
84 | tmp[token_id] = value ;
85 |
86 | await setItem('withdrawArray' , JSON.stringify(tmp)) ;
87 | }
--------------------------------------------------------------------------------
/src/redux/actions/trade.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import * as config from "../../static/constants" ;
4 | // import ActionTypes from "./actionTypes";
5 | import axios from 'axios' ;
6 | import ActionTypes from "./actionTypes";
7 |
8 | export const GetTokenTradeHistory = async (token_id , pair_type) => {
9 |
10 | try {
11 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}trade/get` , {token_id : token_id , pair_token : pair_type}) ;
12 |
13 | if(res.data.data.data.length === 0) {
14 | return [] ;
15 | } else {
16 | // console.log("adfafdads" , res.data.data.data) ;
17 | return res.data.data.data ;
18 | }
19 | }
20 | catch (err) {
21 | console.log(err) ;
22 | return [] ;
23 | }
24 | }
25 |
26 | export const GetTokenOrderList = ( token_id , pair_type , order_type=null) => async dispatch => {
27 |
28 | try {
29 |
30 | let jsonReqBody ;
31 |
32 | if(order_type === null) {
33 | jsonReqBody = {
34 | token_id : token_id ,
35 | pair_token : pair_type
36 | }
37 | } else {
38 | jsonReqBody = {
39 | token_id : token_id ,
40 | pair_token : pair_type ,
41 | type : order_type
42 | }
43 | }
44 |
45 |
46 | // alert(JSON.stringify(jsonReqBody));
47 |
48 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}order/get` , jsonReqBody) ;
49 |
50 | if(order_type === "sell") {
51 |
52 | return dispatch({
53 | type : ActionTypes.GetTokenOrderSellList ,
54 | payload : res.data.data.data
55 | })
56 | }
57 | if(order_type === "buy"){
58 |
59 | return dispatch({
60 | type : ActionTypes.GetTokenOrderBuyList ,
61 | payload : res.data.data.data
62 | })
63 | }
64 |
65 | }
66 | catch (err) {
67 | console.log(err) ;
68 | }
69 | }
70 |
71 | export const GetTokenTradeList = (token_id , pair_type) => async dispatch => {
72 | try {
73 |
74 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}trade/get` , {
75 | token_id : token_id ,
76 | pair_token : pair_type
77 | });
78 |
79 | return dispatch({
80 | type : ActionTypes.GetTokenTradeList ,
81 | payload : res.data.data.data
82 | })
83 | }
84 | catch (err) {
85 | console.log(err) ;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Caladex",
3 | "version": "0.1.0",
4 | "private": true,
5 | "homepage": "",
6 | "dependencies": {
7 | "@chakra-ui/react": "^1.7.4",
8 | "@emotion/react": "^11.7.1",
9 | "@emotion/styled": "^11.6.0",
10 | "@ethersproject/providers": "^5.0.23",
11 | "@ethersproject/units": "^5.5.0",
12 | "@metamask/detect-provider": "^1.2.0",
13 | "@mui/icons-material": "^5.2.5",
14 | "@mui/lab": "^5.0.0-alpha.64",
15 | "@mui/material": "^5.2.8",
16 | "@mui/styles": "^5.2.3",
17 | "@mycrypto/eth-scan": "^3.5.3",
18 | "@testing-library/jest-dom": "^5.11.4",
19 | "@testing-library/react": "^11.1.0",
20 | "@testing-library/user-event": "^12.1.10",
21 | "@usedapp/core": "^0.9.1",
22 | "@walletconnect/client": "^1.7.1",
23 | "@walletconnect/qrcode-modal": "^1.7.1",
24 | "@walletconnect/web3-provider": "^1.7.1",
25 | "@web3-react/core": "^6.1.9",
26 | "@web3-react/injected-connector": "^6.0.7",
27 | "aos": "^2.3.4",
28 | "apexcharts": "^3.33.0",
29 | "axios": "^0.24.0",
30 | "bootstrap": "^4.6.1",
31 | "clsx": "^1.1.1",
32 | "enzyme": "^3.11.0",
33 | "enzyme-adapter-react-15": "^1.4.3",
34 | "enzyme-adapter-react-16": "^1.15.6",
35 | "eth-balance-checker": "^0.1.2",
36 | "ethers": "^5.1.3",
37 | "mdbreact": "^5.2.0",
38 | "prop-types": "^15.8.1",
39 | "react": "^17.0.1",
40 | "react-apexcharts": "^1.3.9",
41 | "react-beforeunload": "^2.5.2",
42 | "react-bootstrap": "^2.1.0",
43 | "react-device-detect": "^2.1.2",
44 | "react-dom": "^17.0.1",
45 | "react-moralis": "^1.1.0",
46 | "react-redux": "^7.2.2",
47 | "react-router-dom": "^6.2.1",
48 | "react-scripts": "4.0.2",
49 | "react-ts-tradingview-widgets": "^1.0.8",
50 | "redux": "^4.0.5",
51 | "redux-thunk": "^2.4.1",
52 | "sweetalert": "^2.1.2",
53 | "truffle": "5.1.39",
54 | "walletlink": "^2.4.5",
55 | "web-vitals": "^1.0.1",
56 | "web3": "1.2.11",
57 | "web3modal": "^1.9.5"
58 | },
59 | "scripts": {
60 | "start": "react-scripts start",
61 | "build": "react-scripts build",
62 | "test": "react-scripts test",
63 | "eject": "react-scripts eject"
64 | },
65 | "eslintConfig": {
66 | "extends": [
67 | "react-app",
68 | "react-app/jest"
69 | ]
70 | },
71 | "browserslist": {
72 | "production": [
73 | ">0.2%",
74 | "not dead",
75 | "not op_mini all"
76 | ],
77 | "development": [
78 | "last 1 chrome version",
79 | "last 1 firefox version",
80 | "last 1 safari version"
81 | ]
82 | },
83 | "devDependencies": {
84 | "react-test-renderer": "^15.5.0"
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/nem.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/Exchange/Table1/index.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import {
4 | Card ,
5 | CardContent ,
6 | } from '@mui/material' ;
7 |
8 | import { makeStyles } from '@mui/styles';
9 |
10 | import quotesOne from '../../../static/tokensinfo/quotesOne.json' ;
11 |
12 | const useStyles = makeStyles((theme) => ({
13 | root : {
14 | marginTop : theme.spacing(3) ,
15 | boxShadow: "3px -4px 7px 0px lightblue !important",
16 | border : "1px solid lightblue",
17 | "& th" : {
18 | fontSize : ".625rem" ,
19 | },
20 | "& td" : {
21 | fontSize : "14px" ,
22 | fontFamily : "Inter,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif" ,
23 | color : "#D63939"
24 | }
25 | } ,
26 | }));
27 |
28 |
29 | const Table1 = () => {
30 | const classes = useStyles() ;
31 |
32 | return (
33 |
34 |
35 |
36 |
37 |
38 |
39 | |
40 | PRICE(ETH)
41 | |
42 |
43 | AMOUNT(BZTC)
44 | |
45 |
46 | TOTAL(ETH)
47 | |
48 |
49 | {
50 | quotesOne.map((element, index) => {
51 | return(
52 |
53 | |
54 | {element.Price}
55 | |
56 |
57 | {element.Amount}
58 | |
59 |
60 | {element.Total}
61 | |
62 |
63 | )
64 | })
65 | }
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | );
74 | }
75 |
76 | export default Table1 ;
--------------------------------------------------------------------------------
/src/components/Exchange/Table2/index.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import {
4 | Card ,
5 | CardContent ,
6 | } from '@mui/material' ;
7 |
8 | import { makeStyles } from '@mui/styles';
9 |
10 | import quotesOne from '../../../static/tokensinfo/quotesOne.json' ;
11 |
12 | const useStyles = makeStyles((theme) => ({
13 | root : {
14 | marginTop : theme.spacing(3) ,
15 | boxShadow: "3px -4px 7px 0px lightblue !important",
16 | border : "1px solid lightblue",
17 | "& th" : {
18 | fontSize : ".625rem" ,
19 | },
20 | "& td" : {
21 | fontSize : "14px" ,
22 | fontFamily : "Inter,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif" ,
23 | color : "#D63939"
24 | }
25 | } ,
26 | }));
27 |
28 |
29 | const Table1 = () => {
30 | const classes = useStyles() ;
31 |
32 | return (
33 |
34 |
35 |
36 |
37 |
38 |
39 | |
40 | PRICE(ETH)
41 | |
42 |
43 | AMOUNT(BZTC)
44 | |
45 |
46 | TOTAL(ETH)
47 | |
48 |
49 | {
50 | quotesOne.map((element, index) => {
51 | return(
52 |
53 | |
54 | {element.Price}
55 | |
56 |
57 | {element.Amount}
58 | |
59 |
60 | {element.Total}
61 | |
62 |
63 | )
64 | })
65 | }
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | );
74 | }
75 |
76 | export default Table1 ;
--------------------------------------------------------------------------------
/src/components/Exchange/TradeHistoryTable/index.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import {
4 | Card ,
5 | CardContent,
6 | CardHeader,
7 | Divider,
8 | } from '@mui/material' ;
9 |
10 | import { makeStyles } from '@mui/styles';
11 |
12 | import tokenHistory from '../../../static/tokensinfo/history.json' ;
13 |
14 | const useStyles = makeStyles((theme) => ({
15 | root : {
16 | marginTop : theme.spacing(5) ,
17 | boxShadow: "3px -4px 7px 0px lightblue !important",
18 | border : "1px solid lightblue" ,
19 | height : "430px" ,
20 | "& .MuiCardHeader-title" : {
21 | fontSize : "16px !important" ,
22 | color : "#206BC4 !important"
23 | },
24 | "& th" : {
25 | fontSize : ".625rem" ,
26 | } ,
27 | "& td" : {
28 | fontSize : "14px" ,
29 | fontFamily : "Inter,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif"
30 | }
31 | } ,
32 | }));
33 |
34 | const TradeHistoryTable = () => {
35 | const classes = useStyles() ;
36 |
37 | return (
38 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | |
50 | TIME
51 | |
52 |
53 | PRICE
54 | |
55 |
56 | AMOUNT(BTZC)
57 | |
58 |
59 | {
60 | tokenHistory.map((element, index) => {
61 | return (
62 |
63 | |
64 | {element.Time}
65 | |
66 |
67 | {element.Price}
68 | |
69 |
70 | {element.Amount}
71 | |
72 |
73 | )
74 | })
75 | }
76 |
77 |
78 |
79 |
80 |
81 | );
82 | }
83 |
84 | export default TradeHistoryTable ;
--------------------------------------------------------------------------------
/src/components/Exchange/OrderCrypto/index.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import {
4 | Card ,
5 | CardContent,
6 | CardHeader,
7 | Divider
8 | } from '@mui/material' ;
9 |
10 | import { makeStyles } from '@mui/styles';
11 |
12 | const useStyles = makeStyles((theme) => ({
13 | root : {
14 | marginTop : theme.spacing(5) ,
15 | boxShadow: "3px -4px 7px 0px lightblue !important",
16 | border : "1px solid lightblue" ,
17 | "& .MuiCardHeader-title" : {
18 | fontSize : "14px !important" ,
19 | color : "#232E3C" ,
20 | width : "120px",
21 | height : "36px !important" ,
22 | display : "flex" ,
23 | alignItems : "center" ,
24 | paddingLeft : theme.spacing(2),
25 | borderBottom : "1px solid #206bc4" ,
26 | cursor : "pointer"
27 | } ,
28 | "& .MuiCardHeader-action" : {
29 | fontSize : "14px !important" ,
30 | color : "#232E3C" ,
31 | margin : "0px" ,
32 | display : "flex" ,
33 | alignItems : "center" ,
34 | height : "36px",
35 | paddingRight : theme.spacing(2)
36 | } ,
37 | "& .MuiCardHeader-root" : {
38 | padding : "0px !important" ,
39 | height : "36px"
40 | },
41 | } ,
42 | cardHeader : {
43 | color : theme.palette.primary.main ,
44 | fontWeight : "bold" ,
45 | }
46 | }));
47 |
48 | const OrderCrpyto = () => {
49 | const classes = useStyles() ;
50 |
51 | return (
52 |
53 |
58 |
65 | More
66 |
67 | }
68 | >
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | );
78 | }
79 |
80 | export default OrderCrpyto ;
--------------------------------------------------------------------------------
/src/redux/actions/crypto.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import ActionTypes from "./actionTypes";
5 | import * as config from "../../static/constants" ;
6 | import axios from 'axios' ;
7 | import Web3 from 'web3' ;
8 | import { getAddressBalances } from "eth-balance-checker/lib/web3";
9 |
10 | // const web3 = new Web3('https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161') ;
11 | const web3 = new Web3('https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161') ;
12 | // const web3 = new Web3('http://localhost:8545') ;
13 |
14 | export const GetAllCryptoInfo = () => async dispatch => {
15 | try {
16 | let res = await axios.get(`${config.PUBLIC_API_URL}command=returnTicker`) ;
17 |
18 | let cryptoInfoList = [] ;
19 |
20 | for(let key in res.data) {
21 | if( key.slice(0 , 5) === "USDT_"){
22 | cryptoInfoList.push({
23 | name : key.slice(5 , key.length) ,
24 | info : res.data[key]
25 | });
26 | }
27 | }
28 |
29 | dispatch({
30 | type : ActionTypes.GetAllCryptoInfo ,
31 | payload : cryptoInfoList
32 | })
33 | console.log(cryptoInfoList) ;
34 | }
35 | catch (err) {
36 | console.log(err) ;
37 | }
38 | }
39 |
40 | export const GetExchageRateToUSD = (walletInfo) => async dispatch => {
41 | try {
42 | let cryptoExchangeRateList = [] ;
43 |
44 | for(let element of walletInfo){
45 | await axios.get(`${config.PUBULIC_EXCHANGE_RATE_API}${element.Token}`)
46 | .then(res => {
47 | cryptoExchangeRateList.push({
48 | rate : res.data.data.rates.USD ,
49 | })
50 | })
51 | .catch(err => {
52 | cryptoExchangeRateList.push({
53 | rate : "Invalid" ,
54 | })
55 |
56 | // let jsonString = "{'" + element.Token + "':'Invalid Currency'}" ;
57 | // let jsonObj = await JSON.parse(jsonString) ;
58 |
59 | // cryptoExchangeRateList.push(jsonObj) ;
60 | })
61 |
62 | }
63 |
64 | dispatch({
65 | type : ActionTypes.GetExchageRateToUSD ,
66 | payload : cryptoExchangeRateList ,
67 | })
68 | }
69 | catch(err) {
70 |
71 | }
72 | }
73 |
74 | export const GetAllTokenBalance = (address , tokensInfo) => async dispatch => {
75 |
76 | const tokensAddress = [] ;
77 |
78 | await tokensInfo.map((element) => {
79 | tokensAddress.push(element.Address) ;
80 | });
81 |
82 | try{
83 | await getAddressBalances( web3 , address , tokensAddress).then(balances => {
84 | dispatch({
85 | type : ActionTypes.GetWalletBalance ,
86 | payload : balances
87 | })
88 | });
89 | }
90 | catch (err) {
91 | console.log(err) ;
92 | }
93 | }
--------------------------------------------------------------------------------
/src/pages/Landing/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { useState } from 'react';
6 |
7 | import Title from '../../components/Common/Title' ;
8 | import FruitBar from '../../components/Common/FruitBar';
9 |
10 | import GraphTape from '../../components/Landing/GraphTape' ;
11 | import TokenLiquidityTable from '../../components/Landing/TokenLiquidityTable';
12 |
13 | import { makeStyles } from '@mui/styles';
14 |
15 | const useStyles = makeStyles((theme) => ({
16 | root : {
17 | minHeight : "calc(100vh - 60px - 64px)"
18 | }
19 | }));
20 | const Landing = () => {
21 |
22 | const classes = useStyles() ;
23 |
24 | const [isOffTimer , setOffTimer] = useState(false) ;
25 |
26 | const [firstTradingIndex , setFirstTradingIndex] = useState(0) ;
27 | const [firstTokenInfo , setFirstTokenInfo] = useState("") ;
28 | const [lastTokenInfo , setLastTokenInfo] = useState("") ;
29 | const [middleTokenInfo , setMiddleTokenInfo] = useState('') ;
30 | const [countTokens , setCountTokens] = useState(0) ;
31 |
32 | const handleCloseTimer = () => {
33 | setOffTimer(true) ;
34 | }
35 |
36 | const goToNext = () => {
37 | switch(countTokens) {
38 | case 1:
39 | return ;
40 | case 2 :
41 | return ;
42 | default :
43 | if(firstTradingIndex === countTokens-3) {
44 | return ;
45 | }
46 | setFirstTradingIndex(firstTradingIndex + 1) ;
47 | return;
48 | }
49 | }
50 |
51 | const goToPrevious = () => {
52 |
53 | if(firstTradingIndex === 0) {
54 | return ;
55 | }
56 | setFirstTradingIndex(firstTradingIndex - 1) ;
57 | }
58 |
59 | return (
60 |
61 |
68 |
69 |
78 |
79 |
86 |
87 |
90 |
91 | )
92 | }
93 |
94 | export default Landing ;
--------------------------------------------------------------------------------
/src/components/Exchange/WalletConnect/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect , useRef } from 'react' ;
4 |
5 | import { useWeb3React } from '@web3-react/core';
6 |
7 | import { InjectedConnector } from "@web3-react/injected-connector";
8 | import detectEthereumProvider from '@metamask/detect-provider' ;
9 | import { isMobile } from 'react-device-detect' ;
10 |
11 | import MetamaskImg from '../../../assets/metamask.jpg';
12 |
13 | import {
14 | Box ,
15 | Button,
16 | Grid
17 | } from '@mui/material' ;
18 |
19 | import { makeStyles } from '@mui/styles';
20 |
21 | const useStyles = makeStyles(() => ({
22 | root : {
23 | '&::-webkit-scrollbar': {
24 | width: '8px',
25 | backgroundColor : "lightgray",
26 | borderRadius : "5px"
27 | },
28 | '&::-webkit-scrollbar-track': {
29 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
30 | },
31 | '&::-webkit-scrollbar-thumb': {
32 | backgroundColor: 'gray',
33 | borderRadius : "5px"
34 | },
35 |
36 | overflow : "hidden" ,
37 | overflowY : "scroll" ,
38 | boxSizing : "border-box" ,
39 | backgroundColor : "white" ,
40 | display : "flex" ,
41 | flexDirection :"column" ,
42 | justifyContent : "center" ,
43 | alignItems : "center" ,
44 | top : 0,
45 | width : '100%' ,
46 | height : "calc(100vh - 122px)" ,
47 | position : "absolute" ,
48 | zIndex : 1000
49 | }
50 | }));
51 |
52 | const WalletConnect = () => {
53 |
54 | const classes = useStyles() ;
55 |
56 | const { library , account , active , activate } = useWeb3React() ;
57 |
58 | const connectToWallet = async () => {
59 |
60 | if(!isMobile) {
61 | const provider = await detectEthereumProvider() ;
62 |
63 | if(provider) {
64 |
65 | const chainId = await provider.request({
66 | method : 'eth_chainId'
67 | }) ;
68 |
69 | const injected = new InjectedConnector({ supportedChainIds: [Number(chainId)] });
70 |
71 | try {
72 |
73 | await activate(injected);
74 |
75 | } catch (exception) {
76 | // console.log(exception);
77 | }
78 |
79 | } else {
80 | alert("Please Install MetaMask.") ;
81 | }
82 |
83 | } else {
84 | window.location.href ="https://metamask.app.link/dapp/caladex.org";
85 | }
86 | }
87 |
88 | return (
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | )
98 | }
99 |
100 | export default WalletConnect ;
--------------------------------------------------------------------------------
/src/static/tokensinfo/walletinfo.js:
--------------------------------------------------------------------------------
1 | import CAX from '../../assets/avatar/CAX.png' ;
2 | import ADA from '../../assets/avatar/ADA.png' ;
3 | import BTC from '../../assets/avatar/BTC.png' ;
4 | import LTC from '../../assets/avatar/LTC.png' ;
5 | import NEM from '../../assets/avatar/NEM.png' ;
6 | import ETH from '../../assets/avatar/ETH.png' ;
7 | import EOS from '../../assets/avatar/EOS.png' ;
8 | import DASH from '../../assets/avatar/DASH.png' ;
9 |
10 | export const walletInfo = [
11 | {
12 | "Avatar" : CAX ,
13 | "Token" : "CAX" ,
14 | "WalletBalance" : "0.000000" ,
15 | "CaladexBalance" : "0.000000" ,
16 | "Orders" : "0.000000" ,
17 | "Eth" : "0.000000" ,
18 | "Usd" : "0.00" ,
19 | "Address" : "0x2546BcD3c84621e976D8185a91A922aE77ECEc30"
20 | },
21 | {
22 | "Avatar" : ADA,
23 | "Token" : "ADA" ,
24 | "WalletBalance" : "0.000000" ,
25 | "CaladexBalance" : "0.000000" ,
26 | "Orders" : "0.000000" ,
27 | "Eth" : "0.000000" ,
28 | "Usd" : "0.00" ,
29 | "Address" : "0x3ee2200efb3400fabb9aacf31297cbdd1d435d47"
30 | },
31 | {
32 | "Avatar" : BTC,
33 | "Token" : "BTC" ,
34 | "WalletBalance" : "0.000000" ,
35 | "CaladexBalance" : "0.000000" ,
36 | "Orders" : "0.000000" ,
37 | "Eth" : "0.000000" ,
38 | "Usd" : "0.00" ,
39 | "Address" : "0x321162Cd933E2Be498Cd2267a90534A804051b11"
40 | },
41 | {
42 | "Avatar" : LTC ,
43 | "Token" : "LTC" ,
44 | "WalletBalance" : "0.000000" ,
45 | "CaladexBalance" : "0.000000" ,
46 | "Orders" : "0.000000" ,
47 | "Eth" : "0.000000" ,
48 | "Usd" : "0.00",
49 | "Address" : "0x169895d29282c29090783006f95ab2324c6b819f"
50 | },
51 | {
52 | "Avatar" : NEM,
53 | "Token" : "XEM" ,
54 | "WalletBalance" : "0.000000" ,
55 | "CaladexBalance" : "0.000000" ,
56 | "Orders" : "0.000000" ,
57 | "Eth" : "0.000000" ,
58 | "Usd" : "0.00" ,
59 | "Address" : "0x0a1abedd1f62c495750f3190e2f7e1d6c0a67a14"
60 | },
61 | {
62 | "Avatar" : ETH ,
63 | "Token" : "ETH" ,
64 | "WalletBalance" : "0.000000" ,
65 | "CaladexBalance" : "0.000000" ,
66 | "Orders" : "0.000000" ,
67 | "Eth" : "0.000000" ,
68 | "Usd" : "0.00" ,
69 | "Address" : "0xD76b5c2A23ef78368d8E34288B5b65D616B746aE"
70 | },
71 | {
72 | "Avatar" : EOS,
73 | "Token" : "EOS" ,
74 | "WalletBalance" : "0.000000" ,
75 | "CaladexBalance" : "0.000000" ,
76 | "Orders" : "0.000000" ,
77 | "Eth" : "0.000000" ,
78 | "Usd" : "0.00" ,
79 | "Address" : "0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0"
80 | },
81 | {
82 | "Avatar" : DASH ,
83 | "Token" : "DASH" ,
84 | "WalletBalance" : "0.000000" ,
85 | "CaladexBalance" : "0.000000" ,
86 | "Orders" : "0.000000" ,
87 | "Eth" : "0.000000" ,
88 | "Usd" : "0.00" ,
89 | "Address" : "0xf04f22b39bf419fdec8eae7c69c5e89872915f53"
90 | }
91 | ]
--------------------------------------------------------------------------------
/src/static/tokensinfo/tokens.js:
--------------------------------------------------------------------------------
1 |
2 | import CAX from '../../assets/avatar/CAX.png' ;
3 | import ADA from '../../assets/avatar/ADA.png' ;
4 | import BTC from '../../assets/avatar/BTC.png' ;
5 | import LTC from '../../assets/avatar/LTC.png' ;
6 | import NEM from '../../assets/avatar/NEM.png' ;
7 | import ETH from '../../assets/avatar/ETH.png' ;
8 | import EOS from '../../assets/avatar/EOS.png' ;
9 | import DASH from '../../assets/avatar/DASH.png' ;
10 |
11 | export const tokensInfo = [
12 | {
13 | "Avatar" : CAX,
14 | "Pair" : "CAX/USDT" ,
15 | "LastPrice" : "0.036400" ,
16 | "State" : "Up" ,
17 | "Change" : "2.54%" ,
18 | "High" : "0.037000" ,
19 | "Low" : "0.033300" ,
20 | "Volume" : "2,577,464 TRX" ,
21 | "Total" : "92,362 USDT"
22 | },
23 | {
24 | "Avatar" : ADA,
25 | "Pair" : "ADA/USDT" ,
26 | "LastPrice" : "0.036400" ,
27 | "State" : "Up" ,
28 | "Change" : "2.54%" ,
29 | "High" : "0.037000" ,
30 | "Low" : "0.033300" ,
31 | "Volume" : "2,577,464 TRX" ,
32 | "Total" : "92,362 USDT"
33 | },
34 | {
35 | "Avatar" : BTC,
36 | "Pair" : "BTC/USDT" ,
37 | "LastPrice" : "0.036400" ,
38 | "State" : "Down" ,
39 | "Change" : "2.54%" ,
40 | "High" : "0.037000" ,
41 | "Low" : "0.033300" ,
42 | "Volume" : "2,577,464 TRX" ,
43 | "Total" : "92,362 USDT"
44 | },
45 | {
46 | "Avatar" : LTC ,
47 | "Pair" : "LTC/USDT" ,
48 | "LastPrice" : "0.036400" ,
49 | "State" : "Down" ,
50 | "Change" : "2.54%" ,
51 | "High" : "0.037000" ,
52 | "Low" : "0.033300" ,
53 | "Volume" : "2,577,464 TRX" ,
54 | "Total" : "92,362 USDT"
55 | },
56 | {
57 | "Avatar" : NEM,
58 | "Pair" : "NEM/USDT" ,
59 | "LastPrice" : "0.036400" ,
60 | "State" : "Down" ,
61 | "Change" : "2.54%" ,
62 | "High" : "0.037000" ,
63 | "Low" : "0.033300" ,
64 | "Volume" : "2,577,464 TRX" ,
65 | "Total" : "92,362 USDT"
66 | },
67 | {
68 | "Avatar" : ETH ,
69 | "Pair" : "ETH/USDT" ,
70 | "LastPrice" : "0.036400" ,
71 | "State" : "Down" ,
72 | "Change" : "2.54%" ,
73 | "High" : "0.037000" ,
74 | "Low" : "0.033300" ,
75 | "Volume" : "2,577,464 TRX" ,
76 | "Total" : "92,362 USDT"
77 | },
78 | {
79 | "Avatar" : EOS,
80 | "Pair" : "EOS/USDT" ,
81 | "LastPrice" : "0.036400" ,
82 | "State" : "Down" ,
83 | "Change" : "2.54%" ,
84 | "High" : "0.037000" ,
85 | "Low" : "0.033300" ,
86 | "Volume" : "2,577,464 TRX" ,
87 | "Total" : "92,362 USDT"
88 | },
89 | {
90 | "Avatar" : DASH ,
91 | "Pair" : "DASH/USDT" ,
92 | "LastPrice" : "0.036400" ,
93 | "State" : "Up" ,
94 | "Change" : "2.54%" ,
95 | "High" : "0.037000" ,
96 | "Low" : "0.033300" ,
97 | "Volume" : "2,577,464 TRX" ,
98 | "Total" : "92,362 USDT"
99 | }
100 | ]
--------------------------------------------------------------------------------
/src/components/Common/Title/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { Link } from 'react-router-dom' ;
6 |
7 | import {
8 | Button,
9 | Container ,
10 | Grid ,
11 | Typography
12 | } from '@mui/material' ;
13 |
14 |
15 | import { makeStyles } from '@mui/styles';
16 |
17 | const useStyles = makeStyles((theme) => ({
18 | root : {
19 | marginTop : theme.spacing(5) ,
20 | padding: "0px !important",
21 | "& .MuiTypography-root" :{
22 | color : theme.palette.primary.main ,
23 | fontWeight : "600 !important" ,
24 | fontFamily : "Segoe UI !important",
25 | } ,
26 | "& a:hover" : {
27 | textDecoration : "none !important"
28 | }
29 | } ,
30 | title : {
31 | textAlign : "center"
32 | },
33 | bigTitle : {
34 | fontSize : "60px !important" ,
35 | [theme.breakpoints.down("md")] : {
36 | fontSize: "45px !important"
37 | },
38 | [theme.breakpoints.down("sm")] : {
39 | fontSize: "30px !important"
40 | },
41 | },
42 | mediumTitle : {
43 | fontSize : "40px !important" ,
44 | [theme.breakpoints.down("md")] : {
45 | fontSize: "30px !important"
46 | },
47 | [theme.breakpoints.down("sm")] : {
48 | fontSize: "20px !important"
49 | },
50 | } ,
51 | smallTitle : {
52 | fontSize : "30px !important" ,
53 | [theme.breakpoints.down("md")] : {
54 | fontSize: "20px !important"
55 | },
56 | [theme.breakpoints.down("sm")] : {
57 | fontSize: "15px !important"
58 | },
59 | },
60 | titleFooter : {
61 | marginBottom : theme.spacing(3) ,
62 | }
63 | }));
64 | const Title = (props) => {
65 |
66 | const classes = useStyles() ;
67 |
68 | const {
69 | bigTitle ,
70 | smallTitle,
71 | mediumTitle ,
72 | isVisibleTradeButton ,
73 | handleCloseTimer
74 | } = props ;
75 |
76 | return (
77 | <>
78 |
79 |
80 |
81 | {bigTitle}
82 |
83 |
84 | {mediumTitle}
85 |
86 |
87 | {smallTitle}
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | >
99 |
100 | )
101 | }
102 |
103 | export default Title ;
--------------------------------------------------------------------------------
/src/utils/globalstyles.js:
--------------------------------------------------------------------------------
1 | import { withStyles } from "@mui/styles";
2 |
3 | const styles = theme => ({
4 | "@global": {
5 | "*:focus": {
6 | outline: 0
7 | },
8 | ".text-white": {
9 | color: theme.palette.common.white
10 | },
11 | ".listItemLeftPadding": {
12 | paddingTop: `${theme.spacing(1.75)}px !important`,
13 | paddingBottom: `${theme.spacing(1.75)}px !important`,
14 | paddingLeft: `${theme.spacing(4)}px !important`,
15 | [theme.breakpoints.down("sm")]: {
16 | paddingLeft: `${theme.spacing(4)}px !important`
17 | },
18 | "@media (max-width: 420px)": {
19 | paddingLeft: `${theme.spacing(1)}px !important`
20 | }
21 | },
22 | ".container": {
23 | width: "100%",
24 | paddingRight: theme.spacing(4),
25 | paddingLeft: theme.spacing(4),
26 | marginRight: "auto",
27 | marginLeft: "auto",
28 | [theme.breakpoints.up("sm")]: {
29 | maxWidth: 540
30 | },
31 | [theme.breakpoints.up("md")]: {
32 | maxWidth: 720
33 | },
34 | [theme.breakpoints.up("lg")]: {
35 | maxWidth: 1170
36 | }
37 | },
38 | ".row": {
39 | display: "flex",
40 | flexWrap: "wrap",
41 | marginRight: -theme.spacing(2),
42 | marginLeft: -theme.spacing(2)
43 | },
44 | ".container-fluid": {
45 | width: "100%",
46 | paddingRight: theme.spacing(2),
47 | paddingLeft: theme.spacing(2),
48 | marginRight: "auto",
49 | marginLeft: "auto",
50 | maxWidth: 1370
51 | },
52 | ".lg-mg-top": {
53 | marginTop: `${theme.spacing(20)}px !important`,
54 | [theme.breakpoints.down("md")]: {
55 | marginTop: `${theme.spacing(18)}px !important`
56 | },
57 | [theme.breakpoints.down("sm")]: {
58 | marginTop: `${theme.spacing(16)}px !important`
59 | },
60 | [theme.breakpoints.down("xs")]: {
61 | marginTop: `${theme.spacing(14)}px !important`
62 | }
63 | },
64 | ".lg-mg-bottom": {
65 | marginBottom: `${theme.spacing(20)}px !important`,
66 | [theme.breakpoints.down("md")]: {
67 | marginBottom: `${theme.spacing(18)}px !important`
68 | },
69 | [theme.breakpoints.down("sm")]: {
70 | marginBottom: `${theme.spacing(16)}px !important`
71 | },
72 | [theme.breakpoints.down("xs")]: {
73 | marginBottom: `${theme.spacing(14)}px !important`
74 | }
75 | },
76 | ".lg-p-top": {
77 | paddingTop: `${theme.spacing(20)}px !important`,
78 | [theme.breakpoints.down("md")]: {
79 | paddingTop: `${theme.spacing(18)}px !important`
80 | },
81 | [theme.breakpoints.down("sm")]: {
82 | paddingTop: `${theme.spacing(16)}px !important`
83 | },
84 | [theme.breakpoints.down("xs")]: {
85 | paddingTop: `${theme.spacing(14)}px !important`
86 | }
87 | }
88 | }
89 | });
90 |
91 | const GlobalStyles = () => {
92 | return null;
93 | }
94 |
95 | export default withStyles(styles, { withTheme: true })(GlobalStyles);
96 |
--------------------------------------------------------------------------------
/src/static/tokensinfo/avatar/cardano.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/OrderSelectBox/OrderTypeBt/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { useState , useEffect } from 'react' ;
7 |
8 | import clsx from 'clsx';
9 |
10 | import {
11 | Box ,
12 | Stack ,
13 | Tooltip
14 | } from '@mui/material' ;
15 |
16 | import CheckOutlinedIcon from '@mui/icons-material/CheckOutlined';
17 |
18 | import StyledBadge from './Badge.styled' ;
19 | import { makeStyles } from '@mui/styles' ;
20 |
21 | const useStyles = makeStyles(() => ({
22 | root : {
23 | width : "20px" ,
24 | marginLeft : "5px" ,
25 | marginRight : "5px" ,
26 | cursor : "pointer"
27 | },
28 | sell : {
29 | backgroundColor : "#c74a4d",
30 | border : "1px solid #c74a4d"
31 | },
32 | buy : {
33 | backgroundColor : "#3c868f" ,
34 | border : "1px solid #3c868f"
35 | },
36 | line : {
37 | marginTop : "2px"
38 | }
39 | }));
40 |
41 |
42 | const OrderTypeBt = (props) => {
43 |
44 | const classes = useStyles() ;
45 |
46 | const {
47 | orderType , isChecked , setOrderType ,
48 | handleChangeOrderType ,
49 | } = props ;
50 |
51 | const [sellCount , setSellCount] = useState(0) ;
52 | const [buyCount , setBuyCount] = useState(0) ;
53 |
54 | let title ;
55 |
56 | const emitOrderType = () => {
57 | if(handleChangeOrderType){
58 | switch(orderType){
59 | case "sell" :
60 | setOrderType(1) ;
61 | handleChangeOrderType(1) ;
62 | return ;
63 | case "buy" :
64 | setOrderType(2);
65 | handleChangeOrderType(2) ;
66 | return ;
67 | case "both" :
68 | setOrderType(3);
69 | handleChangeOrderType(3) ;
70 | return ;
71 | default :
72 | return ;
73 | }
74 | }
75 | return ;
76 | }
77 |
78 | useEffect(() => {
79 | switch(orderType){
80 | case "sell" :
81 | setSellCount(4);
82 | return ;
83 | case "buy" :
84 | setBuyCount(4)
85 | return ;
86 | case "both" :
87 | setSellCount(2);
88 | setBuyCount(2) ;
89 | return ;
90 | default :
91 | return ;
92 | }
93 | } , [orderType]) ;
94 |
95 | return (
96 |
97 | :"0"}>
98 | emitOrderType()}>
99 |
100 | {
101 | [...Array(sellCount)].map((item , index) => {
102 | return (
103 |
104 |
105 | )
106 | })
107 | }
108 | {
109 | [...Array(buyCount)].map((item , index) => {
110 | return (
111 |
112 |
113 | )
114 | })
115 | }
116 |
117 |
118 |
119 |
120 | )
121 | }
122 |
123 | export default OrderTypeBt;
--------------------------------------------------------------------------------
/src/components/Exchange/TokenList/TokenInfoList/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import { useState } from 'react' ;
6 |
7 | import { connect } from 'react-redux';
8 |
9 | import {
10 | Box ,
11 | TableContainer ,
12 | Table,
13 | TableHead,
14 | TableBody,
15 | TableCell,
16 | TableRow
17 | } from '@mui/material' ;
18 |
19 | import { makeStyles } from '@mui/styles';
20 |
21 | const useStyles = makeStyles(() => ({
22 | root : {
23 | '&::-webkit-scrollbar': {
24 | width: '8px',
25 | backgroundColor : "lightgray",
26 | borderRadius : "5px"
27 | },
28 | '&::-webkit-scrollbar-track': {
29 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
30 | },
31 | '&::-webkit-scrollbar-thumb': {
32 | backgroundColor: 'gray',
33 | borderRadius : "5px"
34 | },
35 |
36 | overflow : "hidden" ,
37 | overflowY : "scroll" ,
38 | boxSizing : "border-box" ,
39 |
40 | height : "calc(100vh - 192px)" ,
41 |
42 | "& .MuiTableCell-root" :{
43 | padding : "0px !important",
44 | textAlign : "center",
45 | fontSize : "11px" ,
46 | fontWeight : "bold" ,
47 | textAlign : "right" ,
48 | cursor : "pointer"
49 | }
50 | }
51 | }));
52 |
53 | const TokenInfoList = (props) => {
54 |
55 | const classes = useStyles() ;
56 |
57 | const {
58 | tokenLiquidityList ,
59 | handleChangeTokenId , handleChangeToken , handlePairInfoVisible
60 | } = props ;
61 |
62 | const headFields = [
63 | "Pair" ,
64 | "Price" ,
65 | "Volume" ,
66 | "24H"
67 | ];
68 |
69 | const onSelectToken = (index , item) => {
70 | handleChangeToken(item) ;
71 | handleChangeTokenId(index) ;
72 | handlePairInfoVisible() ;
73 |
74 | return ;
75 | }
76 |
77 | return (
78 |
79 |
80 |
81 |
82 |
83 | {
84 | headFields.map((field, index) => {
85 | return (
86 | { field }
87 | )
88 | })
89 | }
90 |
91 |
92 |
93 | {
94 | tokenLiquidityList.length !== 0 ? tokenLiquidityList.map((item , index) => {
95 | return (
96 | onSelectToken(index , item)}>
97 | {item.symbol} / {item.pair_type}
98 | {Number(item.price).toFixed(5)}
99 | {Number(item.total24hr).toFixed(0)}
100 | {item.percentChange}%
101 |
102 | )
103 | }) : <>
104 | >
105 | }
106 |
107 |
108 |
109 |
110 | )
111 | }
112 |
113 |
114 | const mapStateToProps = state => ({
115 | tokenLiquidityList : state.token.tokenLiquidityList
116 | })
117 |
118 | const mapDispatchToProps = {
119 | }
120 |
121 | export default connect(mapStateToProps, mapDispatchToProps)(TokenInfoList) ;
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/OrderSelectBox/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { useState } from 'react' ;
7 |
8 | import OrderTypeBt from './OrderTypeBt';
9 |
10 | import clsx from 'clsx';
11 |
12 | import {
13 | Box ,
14 | Grid ,
15 | MenuItem ,
16 | FormControl ,
17 | Select
18 | } from '@mui/material' ;
19 |
20 | import { makeStyles } from '@mui/styles' ;
21 |
22 | const useStyles = makeStyles (() => ({
23 | root : {
24 | borderBottom : "2px solid lightgray" ,
25 | height : "43px" ,
26 | display: "flex" ,
27 | alignItems : "center" ,
28 | "& .MuiSvgIcon-root" : {
29 | marginLeft : "5px" ,
30 | marginRight : "5px"
31 | },
32 | },
33 | menuItem : {
34 | padding:"0px !important" ,
35 | display:"flex !important" ,
36 | justifyContent : "center !important"
37 | },
38 | flexBox : {
39 | display : "flex" ,
40 | alignItems : "center"
41 | },
42 | orderLabel : {
43 | justifyContent : "center" ,
44 | fontWeight : 'bold'
45 | },
46 | orderType : {
47 | justifyContent : "flex-end" ,
48 | }
49 | }));
50 |
51 | const OrderSelectBox = (props) => {
52 |
53 | const classes = useStyles() ;
54 |
55 | const {
56 | handleChangeDecimal, handleChangeOrderType
57 | } = props ;
58 |
59 | const [decimal, setDecimal] = useState(6);
60 | const [orderType , setOrderType] = useState(3) ;
61 |
62 | const handleChange = (event) => {
63 |
64 | setDecimal(event.target.value) ;
65 | handleChangeDecimal(event.target.value) ;
66 |
67 | return ;
68 | };
69 |
70 | return (
71 |
72 |
73 |
74 | Order Book
75 |
76 |
77 |
78 |
84 |
90 |
96 |
97 |
109 |
110 |
111 |
112 |
113 |
114 | )
115 | }
116 |
117 | export default OrderSelectBox ;
--------------------------------------------------------------------------------
/src/components/Balances/AddressWidget/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect, useRef , useState } from 'react' ;
4 |
5 | import { useWeb3React } from "@web3-react/core";
6 |
7 | import styled from '@emotion/styled';
8 |
9 | import Tooltip, { tooltipClasses } from '@mui/material/Tooltip';
10 |
11 | import ContentCopyIcon from '@mui/icons-material/ContentCopy';
12 |
13 | import {
14 | Card ,
15 | CardContent,
16 | Grid ,
17 | FormLabel ,
18 | useMediaQuery ,
19 | Box
20 | } from '@mui/material';
21 |
22 | import {
23 | MDBContainer ,
24 | MDBInputGroup,
25 | } from "mdbreact";
26 |
27 | import AccountCircleOutlinedIcon from '@mui/icons-material/AccountCircleOutlined';
28 |
29 | import { makeStyles } from '@mui/styles';
30 |
31 | const BootstrapTooltip = styled( ({ className, ...props }) => (
32 |
33 |
34 | ) ) ( ({ theme }) => ({
35 | [`& .${tooltipClasses.arrow}`]: {
36 | color: theme.palette.common.black,
37 | },
38 | [`& .${tooltipClasses.tooltip}`]: {
39 | backgroundColor: theme.palette.common.black,
40 | },
41 | }));
42 |
43 | const useStyles = makeStyles(() => ({
44 | root : {
45 | "& .MuiPaper-root" : {
46 | border : "1px solid lightgray" ,
47 | } ,
48 | "& .MuiGrid-root" :{
49 | textAlign : "center"
50 | },
51 | "& input" : {
52 | fontSize : "14px"
53 | } ,
54 | },
55 | sendBtn : {
56 | backgroundColor : "#206bc4 !important" ,
57 | },
58 | receiveBtn : {
59 | backgroundColor : "#f76707 !important"
60 | },
61 | toolTip : {
62 | color : "white" ,
63 | position : "absolute",
64 | right : "0px" ,
65 | padding : "5px" ,
66 | opacity : "0"
67 | },
68 | }));
69 |
70 |
71 | const AddressWidget = () => {
72 |
73 | const { active, account, chainId, library, activate , deactivate} = useWeb3React();
74 |
75 | const classes = useStyles() ;
76 | const addressCtrl = useRef(null) ;
77 | const [isCopied , setIsCopied] = useState(false) ;
78 |
79 | const isXs = useMediaQuery("(min-width : 645px)") ;
80 |
81 | useEffect(() =>{
82 | if(active) {
83 | if(addressCtrl) {
84 | addressCtrl.current.value = account ;
85 | }
86 | }
87 | } , [active, account , library]) ;
88 |
89 | const emitCopyEvent = () => {
90 | setIsCopied(true) ;
91 | addressCtrl.current.select() ;
92 | document.execCommand("copy");
93 | }
94 | return (
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
110 | emitCopyEvent()} onMouseLeave={() => setIsCopied(false)}>
111 |
112 |
113 |
114 | }
115 | inputs={
116 |
117 | }
118 | />
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | )
128 | }
129 |
130 | export default AddressWidget ;
--------------------------------------------------------------------------------
/src/redux/actions/stake.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import axios from 'axios' ;
4 | import { PRIVATE_CALADEX_API } from '../../static/constants';
5 | import { json2array } from '../../utils/helper';
6 | import ActionTypes from './actionTypes';
7 |
8 |
9 | export const GetTokenStakeInfoList = (account ,method , token_symbol) => async dispatch => {
10 |
11 | try {
12 | let resStakeInfo = await axios.post(`${PRIVATE_CALADEX_API}stake/get` , {search_str : token_symbol}) ;
13 |
14 | if(resStakeInfo.data.data.data.length === 0) {
15 | return dispatch({
16 | type : ActionTypes.GetTokenStakeInfoList ,
17 | payload : "No Available Information."
18 | }) ;
19 | }
20 |
21 | let tokenStakeInfo = {} ;
22 |
23 | let resBalanceInfo = await axios.post(`${PRIVATE_CALADEX_API}balance/get/${account}`) ;
24 |
25 | let tokenBalanceInfo = {} ;
26 |
27 | for(let element of resBalanceInfo.data.data.doc) {
28 | tokenBalanceInfo[element.token_id.address] = element.caladex_balance ;
29 | }
30 |
31 | for(let element of resStakeInfo.data.data.data) {
32 |
33 | if(typeof tokenBalanceInfo[element.token_id.address] !== "undefined"){
34 | tokenStakeInfo[element._id] = {
35 | ...element ,
36 | is_stake : false ,
37 | duration : '--' ,
38 | balance : tokenBalanceInfo[element.token_id.address]
39 | }
40 | } else {
41 | tokenStakeInfo[element._id] = {
42 | ...element ,
43 | is_stake : false ,
44 | duration : '--' ,
45 | balance : 0
46 | }
47 | }
48 | }
49 |
50 | let resStakeLogInfo = await axios.post(`${PRIVATE_CALADEX_API}stakelog/get/${account}`) ;
51 |
52 | for(let element of resStakeLogInfo.data.data.doc) {
53 | if(typeof tokenStakeInfo[element.stake_id._id] !== "undefined"){
54 | tokenStakeInfo[element.stake_id._id].is_stake = true ;
55 | tokenStakeInfo[element.stake_id._id].duration = element.duration ;
56 | tokenStakeInfo[element.stake_id._id].stakelog_id = element.stakelog_id ;
57 | }
58 | }
59 |
60 |
61 | let tokenStakeInfoArray = json2array(tokenStakeInfo) ;
62 |
63 | return dispatch({
64 | type : ActionTypes.GetTokenStakeInfoList ,
65 | payload : tokenStakeInfoArray
66 | })
67 | }
68 | catch(err) {
69 | console.log(err) ;
70 | }
71 | }
72 |
73 | export const AddTokenStakeLog = (account , stake_id , amount , duration) => async dispatch => {
74 | try{
75 | let res = await axios.post(`${PRIVATE_CALADEX_API}stakelog/add` , {
76 | address : account ,
77 | stake_id : stake_id ,
78 | amount : amount ,
79 | duration : duration ,
80 | });
81 |
82 | if(res.status === 201) {
83 | return "Error" ;
84 | }
85 | return "Ok" ;
86 | }
87 | catch (err) {
88 | console.log(err) ;
89 | return "Error" ;
90 | }
91 | }
92 | export const RemoveTokenStakeLog = async (account , stakelog_id) => {
93 | try {
94 | let res = await axios.post(`${PRIVATE_CALADEX_API}stakelog/unstake` , {
95 | address : account ,
96 | stakelog_id : stakelog_id
97 | }) ;
98 |
99 | if(res.status === 201) {
100 | return "Error" ;
101 | }
102 | return "Ok" ;
103 | }
104 | catch (err) {
105 | console.log(err) ;
106 | return "Error" ;
107 | }
108 | }
109 | export const GetStakingInfo = async (stakelog_id ) => {
110 | try {
111 | let res = await axios.post(`${PRIVATE_CALADEX_API}stakelog/info` , {
112 | stakelog_id : stakelog_id
113 | }) ;
114 |
115 | if(res.status === 201) {
116 | return "Error" ;
117 | }
118 |
119 | return res.data.data.doc ;
120 | }
121 | catch (err) {
122 | console.log(err) ;
123 | return "Error" ;
124 | }
125 | }
126 |
127 | export const GetStakeDateTime = async () => {
128 | try {
129 | let resDateTime = await axios.post(`${PRIVATE_CALADEX_API}stake/time` , {}) ;
130 |
131 | return resDateTime.data.current_time ;
132 | }
133 | catch (err) {
134 | console.log(err) ;
135 | }
136 | }
--------------------------------------------------------------------------------
/src/components/Exchange/CoinBanner/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React, { useEffect } from 'react' ;
5 |
6 | import { useState } from 'react' ;
7 |
8 | import { connect } from 'react-redux';
9 |
10 | import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
11 | import ExpandLessIcon from '@mui/icons-material/ExpandLess';
12 |
13 | //_____________styles_______________
14 | import {
15 | Box,
16 | Grid ,
17 | } from '@mui/material' ;
18 |
19 | import { makeStyles } from '@mui/styles';
20 |
21 | const useStyles = makeStyles((theme) => ({
22 | root : {
23 | backgroundColor : theme.palette.primary.main ,
24 | display : "flex",
25 | alignItems : "center" ,
26 |
27 | "& .MuiGrid-item" : {
28 | display : "flex" ,
29 | flexDirection : "column" ,
30 | justifyContent : "center" ,
31 | alignItems : "flex-end" ,
32 | paddingLeft: "15px" ,
33 | paddingRight : "15px",
34 | paddingTop : "5px" ,
35 | paddingBottom : "5px" ,
36 | } ,
37 | "& .MuiInputBase-root" : {
38 | color : "white !important" ,
39 | textAlign : "right" ,
40 | fontSize : "14px" ,
41 | },
42 | "& .MuiSvgIcon-root" :{
43 | color : "white !important"
44 | }
45 | } ,
46 | label : {
47 | paddingBottom : "5px" ,
48 | color : "#8fb5fc" ,
49 | fontSize : "11px" ,
50 | } ,
51 | trade : {
52 | display : "flex" ,
53 | alignItems : "center" ,
54 | justifyContent : "flex-end" ,
55 | fontSize : "14px" ,
56 | color : "white" ,
57 | }
58 | })) ;
59 |
60 | //___________component_________________
61 | const CoinBanner = (props) => {
62 |
63 | const {
64 | tokenLiquidityList ,
65 | tokenId ,
66 | handlePairInfoVisible ,
67 | } = props ;
68 |
69 | const classes = useStyles() ;
70 |
71 | const [ icon , setIcon ] = useState(0) ;
72 |
73 | const labelList = [
74 | {
75 | index : "last" ,
76 | label : "Last Price"
77 | } ,
78 | {
79 | index : "percentChange" ,
80 | label : "24h Change"
81 | },
82 | {
83 | index : "low24hr" ,
84 | label : "24h Low"
85 | },
86 | {
87 | index : "high24hr" ,
88 | label : "24h High"
89 | } ,
90 | {
91 | index : "total24hr" ,
92 | label : "Volume"
93 | }
94 | ]
95 |
96 | const handleChangeIcon = () => {
97 | setIcon(!icon) ;
98 | }
99 |
100 | const onClickToken = () => {
101 | handlePairInfoVisible() ;
102 | handleChangeIcon() ;
103 | }
104 |
105 | return (
106 |
107 |
108 |
109 |
110 | {
111 | tokenId !== null && tokenLiquidityList.length !== 0 ? <>
112 | { tokenLiquidityList[tokenId].symbol + " / " + tokenLiquidityList[tokenId].pair_type}
113 | { icon ? : }
114 | > :<>>
115 | }
116 |
117 |
118 | Tether
119 |
120 |
121 | {
122 | tokenId !== null && tokenLiquidityList.length !== 0 ?
123 | labelList.map(( item , index ) => {
124 | return (
125 |
126 |
127 | { item.label }
128 |
129 |
130 | { tokenLiquidityList[tokenId][item.index] }
131 |
132 |
133 | )
134 | })
135 | : <>
136 | >
137 | }
138 |
139 |
140 | )
141 | }
142 |
143 | const mapStateToProps = state => ({
144 | tokenLiquidityList : state.token.tokenLiquidityList
145 | })
146 |
147 | export default connect(mapStateToProps)(CoinBanner) ;
--------------------------------------------------------------------------------
/src/components/Layouts/Header/DrawerNavbar.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { makeStyles } from '@mui/styles';
7 |
8 | import TokenListing from '../../Common/TokenListing';
9 |
10 | import {
11 | Drawer ,
12 | List,
13 | ListItem ,
14 | IconButton,
15 | Divider ,
16 | Button ,
17 | Typography ,
18 | Link ,
19 | Box ,
20 | useMediaQuery
21 | } from '@mui/material' ;
22 |
23 | import CloseIcon from '@mui/icons-material/Close' ;
24 |
25 | const useStyles = makeStyles(theme=> ({
26 | root: {
27 | "& .MuiDrawer-paper": {
28 | width : "100% !important",
29 | marginTop: "60px !important" ,
30 | backgroundColor : theme.palette.primary.main + " !important"
31 | }
32 | },
33 | drawerItem: {
34 | color : "white !important",
35 | cursor : "pointer" ,
36 | padding : "0px" ,
37 | textDecoration : 'none' ,
38 | fontWeight: 'bold' ,
39 | fontSize : "20px" ,
40 | height : "430px !important" ,
41 | '&:hover' : {
42 | textDecoration : "none",
43 | color : "white",
44 | } ,
45 | }
46 | }));
47 | const DrawerNavbar = (props) => {
48 |
49 | const {
50 | menuItems,
51 | handleMobileDrawerOpen,
52 | open,
53 | } = props ;
54 |
55 | const classes = useStyles() ;
56 |
57 | const isXs = useMediaQuery("(min-width : 1316px)") ;
58 |
59 | const linkClicked = (path) => {
60 | window.location.pathname = path ;
61 | }
62 | return (
63 |
64 |
72 |
73 |
74 |
75 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | { !isXs ? menuItems.map( element => {
86 | if( element.name === "Token Listing" )
87 | return (
88 |
89 |
90 |
91 | Token Listing
92 |
93 |
94 |
95 |
96 |
97 | )
98 | else
99 | return(
100 |
101 |
linkClicked(element.link)}
103 | >
104 |
105 |
106 |
107 | {element.name}
108 |
109 |
110 |
111 |
112 |
113 |
114 | )
115 | }) : (
116 | <>
117 | >
118 | )
119 | }
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | )
128 | }
129 |
130 | export default DrawerNavbar ;
--------------------------------------------------------------------------------
/src/components/Exchange/Trade/MarketTradeList/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect } from 'react' ;
4 |
5 | import { connect } from 'react-redux';
6 | import { GetTokenTradeList } from '../../../../redux/actions/trade' ;
7 |
8 | import { formatDBDate } from '../../../../utils/helper';
9 |
10 | import {
11 | Box ,
12 | TableContainer,
13 | Table,
14 | TableHead,
15 | TableBody,
16 | TableRow,
17 | TableCell
18 | } from '@mui/material' ;
19 |
20 | import { makeStyles } from '@mui/styles';
21 |
22 | const useStyles = makeStyles((theme) => ({
23 | root : {
24 |
25 | '&::-webkit-scrollbar': {
26 | width: '8px',
27 | backgroundColor : "lightgray",
28 | borderRadius : "5px"
29 | },
30 | '&::-webkit-scrollbar-track': {
31 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
32 | },
33 | '&::-webkit-scrollbar-thumb': {
34 | backgroundColor: 'gray',
35 | borderRadius : "5px"
36 | },
37 |
38 | maxHeight : "calc(50vh - 88px)" ,
39 | height : "calc(50vh - 88px)" ,
40 | overflow : "hidden" ,
41 | overflowY : "scroll" ,
42 | borderBottom : "1px solid gray" ,
43 | borderTop : "1px solid gray" ,
44 |
45 | "& .MuiTableCell-root" : {
46 | padding : "5px" ,
47 | fontSize : "10px",
48 | textAlign : "right" ,
49 | },
50 | "& .MuiTableHead-root" :{
51 | "& .MuiTableCell-root" : {
52 | fontWeight : "bold" ,
53 | color : theme.palette.primary.main ,
54 | fontSize : "12px"
55 | },
56 | }
57 | }
58 | }));
59 |
60 | let tradeListTimer ;
61 |
62 | const MarketTradeList = (props) => {
63 |
64 | const classes = useStyles() ;
65 |
66 | const { tradeToken , GetTokenTradeList , orderTradeList } = props ;
67 |
68 | const headFields = [
69 | "Time" ,
70 | "Price" ,
71 | "Amount" ,
72 | "Total"
73 | ]
74 |
75 | const setTradeListTimer = async (tradeToken) => {
76 | clearInterval(tradeListTimer) ;
77 |
78 | tradeListTimer = setInterval(async () => {
79 | await GetTokenTradeList(tradeToken._id , tradeToken.pair_type) ;
80 | } , 15000)
81 | }
82 |
83 | useEffect(() => {
84 | return () => {
85 | clearInterval(tradeListTimer) ;
86 | }
87 | } , []) ;
88 |
89 | useEffect(async () => {
90 | if(tradeToken) {
91 | await GetTokenTradeList(tradeToken._id , tradeToken.pair_type) ;
92 |
93 | await setTradeListTimer(tradeToken) ;
94 | }
95 | } , [tradeToken]) ;
96 |
97 | return (
98 |
99 |
100 |
101 |
102 |
103 | {
104 | headFields.map(( field , index ) => {
105 | return (
106 |
107 | { field }
108 |
109 | )
110 | })
111 | }
112 |
113 |
114 |
115 | {
116 | orderTradeList.length !== 0 ? orderTradeList.map((item , index) => {
117 | return (
118 |
119 | { formatDBDate(item.time).substr(11,8) }
120 | {item.price}
121 | {item.amount}
122 | { Number(Number(item.price) * Number(item.amount)).toFixed(4) }
123 |
124 | )
125 | }) :<>
126 | >
127 | }
128 |
129 |
130 |
131 |
132 | )
133 | }
134 |
135 | const mapStateTopProps = state => ({
136 | orderTradeList : state.trade.orderTradeList
137 | })
138 |
139 | const mapDispatchToProps = {
140 | GetTokenTradeList
141 | }
142 |
143 | export default connect(mapStateTopProps , mapDispatchToProps)(MarketTradeList) ;
--------------------------------------------------------------------------------
/src/components/Common/FruitBar/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | import {
6 | Card ,
7 | CardContent,
8 | CircularProgress,
9 | Grid,
10 | IconButton,
11 | useMediaQuery,
12 | } from '@mui/material' ;
13 |
14 | import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
15 | import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
16 |
17 | import { makeStyles } from '@mui/styles';
18 |
19 | const useStyles = makeStyles((theme) => ({
20 | fruit : {
21 | borderRadius : "0px !important",
22 | "& .MuiCardContent-root" :{
23 | paddingTop : '1rem !important' ,
24 | paddingBottom : '1rem !important' ,
25 | } ,
26 | "& .MuiButtonBase-root" : {
27 | height : "25px !important" ,
28 | width : "25px !important" ,
29 | },
30 | "& svg" : {
31 | fontSize : "25px !important" ,
32 | color : "white" ,
33 | "&:hover" : {
34 | color : "#235580"
35 | }
36 | }
37 | } ,
38 | fruitContent : {
39 | textAlign : "center" ,
40 | borderRadius : "0px" ,
41 | backgroundColor : theme.palette.primary.main ,
42 | },
43 | fruitItem : {
44 | fontSize : "16px" ,
45 | fontFamily : "Inter,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif" ,
46 | fontWeight : "500" ,
47 | color : "white" ,
48 | cursor : "pointer" ,
49 | display : "flex" ,
50 | justifyContent : "center" ,
51 | alignItems : "center" ,
52 | },
53 | loading : {
54 | color : "white !important"
55 | },
56 | }));
57 | const FruitBar = (props) => {
58 |
59 | const { goToPrevious , goToNext , firstTokenInfo , lastTokenInfo , middleTokenInfo , countTokens , firstTradingIndex} = props;
60 | const isXs = useMediaQuery("(min-width : 599px)") ;
61 | const isXsItem = useMediaQuery("(min-width:930px)") ;
62 |
63 | const classes = useStyles() ;
64 |
65 | return (
66 | <>
67 |
68 |
69 |
70 |
71 | goToPrevious()}>
72 |
73 |
74 |
75 |
76 |
77 | {
78 | countTokens === 0 ? <>
79 |
80 |
81 |
82 | > :<>
83 | =2 ? "flex" : "none"}}>
84 | {firstTokenInfo}
85 |
86 | =3 || countTokens === 1 ? "flex" : "none"}}>
87 | {middleTokenInfo}
88 |
89 | =2 ? "flex" : "none"}}>
90 | {lastTokenInfo}
91 |
92 |
93 | >
94 | }
95 |
96 |
97 |
98 |
99 |
100 | goToNext()}>
101 |
102 |
103 |
104 |
105 |
106 |
107 | >
108 |
109 | )
110 | }
111 |
112 | export default FruitBar ;
--------------------------------------------------------------------------------
/src/constants/abis/erc20.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "inputs": [
4 | {
5 | "internalType": "uint256",
6 | "name": "amountToMint",
7 | "type": "uint256"
8 | }
9 | ],
10 | "stateMutability": "nonpayable",
11 | "type": "constructor"
12 | },
13 | {
14 | "anonymous": false,
15 | "inputs": [
16 | {
17 | "indexed": true,
18 | "internalType": "address",
19 | "name": "owner",
20 | "type": "address"
21 | },
22 | {
23 | "indexed": true,
24 | "internalType": "address",
25 | "name": "spender",
26 | "type": "address"
27 | },
28 | {
29 | "indexed": false,
30 | "internalType": "uint256",
31 | "name": "value",
32 | "type": "uint256"
33 | }
34 | ],
35 | "name": "Approval",
36 | "type": "event"
37 | },
38 | {
39 | "anonymous": false,
40 | "inputs": [
41 | {
42 | "indexed": true,
43 | "internalType": "address",
44 | "name": "from",
45 | "type": "address"
46 | },
47 | {
48 | "indexed": true,
49 | "internalType": "address",
50 | "name": "to",
51 | "type": "address"
52 | },
53 | {
54 | "indexed": false,
55 | "internalType": "uint256",
56 | "name": "value",
57 | "type": "uint256"
58 | }
59 | ],
60 | "name": "Transfer",
61 | "type": "event"
62 | },
63 | {
64 | "inputs": [
65 | {
66 | "internalType": "address",
67 | "name": "",
68 | "type": "address"
69 | },
70 | {
71 | "internalType": "address",
72 | "name": "",
73 | "type": "address"
74 | }
75 | ],
76 | "name": "allowance",
77 | "outputs": [
78 | {
79 | "internalType": "uint256",
80 | "name": "",
81 | "type": "uint256"
82 | }
83 | ],
84 | "stateMutability": "view",
85 | "type": "function"
86 | },
87 | {
88 | "inputs": [
89 | {
90 | "internalType": "address",
91 | "name": "spender",
92 | "type": "address"
93 | },
94 | {
95 | "internalType": "uint256",
96 | "name": "amount",
97 | "type": "uint256"
98 | }
99 | ],
100 | "name": "approve",
101 | "outputs": [
102 | {
103 | "internalType": "bool",
104 | "name": "",
105 | "type": "bool"
106 | }
107 | ],
108 | "stateMutability": "nonpayable",
109 | "type": "function"
110 | },
111 | {
112 | "inputs": [
113 | {
114 | "internalType": "address",
115 | "name": "",
116 | "type": "address"
117 | }
118 | ],
119 | "name": "balanceOf",
120 | "outputs": [
121 | {
122 | "internalType": "uint256",
123 | "name": "",
124 | "type": "uint256"
125 | }
126 | ],
127 | "stateMutability": "view",
128 | "type": "function"
129 | },
130 | {
131 | "inputs": [],
132 | "name": "getBalance",
133 | "outputs": [
134 | {
135 | "internalType": "uint256",
136 | "name": "",
137 | "type": "uint256"
138 | }
139 | ],
140 | "stateMutability": "view",
141 | "type": "function"
142 | },
143 | {
144 | "inputs": [
145 | {
146 | "internalType": "address",
147 | "name": "to",
148 | "type": "address"
149 | },
150 | {
151 | "internalType": "uint256",
152 | "name": "amount",
153 | "type": "uint256"
154 | }
155 | ],
156 | "name": "mint",
157 | "outputs": [],
158 | "stateMutability": "nonpayable",
159 | "type": "function"
160 | },
161 | {
162 | "inputs": [
163 | {
164 | "internalType": "address",
165 | "name": "recipient",
166 | "type": "address"
167 | },
168 | {
169 | "internalType": "uint256",
170 | "name": "amount",
171 | "type": "uint256"
172 | }
173 | ],
174 | "name": "transfer",
175 | "outputs": [
176 | {
177 | "internalType": "bool",
178 | "name": "",
179 | "type": "bool"
180 | }
181 | ],
182 | "stateMutability": "nonpayable",
183 | "type": "function"
184 | },
185 | {
186 | "inputs": [
187 | {
188 | "internalType": "address",
189 | "name": "sender",
190 | "type": "address"
191 | },
192 | {
193 | "internalType": "address",
194 | "name": "recipient",
195 | "type": "address"
196 | },
197 | {
198 | "internalType": "uint256",
199 | "name": "amount",
200 | "type": "uint256"
201 | }
202 | ],
203 | "name": "transferFrom",
204 | "outputs": [
205 | {
206 | "internalType": "bool",
207 | "name": "",
208 | "type": "bool"
209 | }
210 | ],
211 | "stateMutability": "nonpayable",
212 | "type": "function"
213 | }
214 | ]
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/OrderBuyList/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect } from 'react' ;
4 |
5 | import { connect } from 'react-redux' ;
6 | import { GetTokenOrderList } from '../../../../redux/actions/trade';
7 |
8 | import {
9 | Box ,
10 | TableContainer,
11 | Table,
12 | TableBody,
13 | TableRow ,
14 | TableCell
15 | } from "@mui/material" ;
16 |
17 |
18 | import { makeStyles } from '@mui/styles' ;
19 |
20 | const useStyles = makeStyles((theme) => ({
21 | root : {
22 |
23 | '&::-webkit-scrollbar': {
24 | width: '8px',
25 | backgroundColor : "lightgray",
26 | borderRadius : "5px"
27 | },
28 | '&::-webkit-scrollbar-track': {
29 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
30 | },
31 | '&::-webkit-scrollbar-thumb': {
32 | backgroundColor: 'gray',
33 | borderRadius : "5px"
34 | },
35 |
36 | overflow : "hidden" ,
37 | overflowY : "scroll" ,
38 | height : props => {
39 | if(props.orderType === 3) return "calc(50vh - 113.815px)" ;
40 | if(props.orderType === 2) return "calc(100vh - 230px)" ;
41 | if(props.orderType === 1) return "0px" ;
42 | },
43 | borderBottom : "1px solid gray" ,
44 | borderTop : "1px solid gray" ,
45 |
46 | "& .MuiTableBody-root" : {
47 | "& .MuiTableRow-root" : {
48 | position : "relative" ,
49 | cursor : "pointer"
50 | },
51 | "& .MuiTableCell-root" : {
52 | padding : "5px" ,
53 | fontSize : "10px",
54 | textAlign : "right" ,
55 | width : "33.33%"
56 | }
57 | },
58 | },
59 | progress : {
60 | position : "absolute" ,
61 | backgroundColor : "#d7eaea" ,
62 | left : 0 ,
63 | top : 0,
64 | height : "100%" ,
65 | width : props => `${props.total * 100 / props.max}%`,
66 | zIndex : "-1000" ,
67 | },
68 | price : {
69 | color : "#3c868f !important"
70 | }
71 | }));
72 |
73 | const ProgressBar = ( { children, ...props } ) => {
74 |
75 | const classes = useStyles(props) ;
76 |
77 | return (
78 |
79 | )
80 | }
81 |
82 | let orderBuyListTimer ;
83 |
84 | const OrderBuyList = (props) => {
85 |
86 | const {
87 | tradeToken , decimal , orderType ,
88 | handleChangePrice , handleChangeStatus ,
89 | orderBuyList , GetTokenOrderList ,
90 | setMethodType
91 | } = props ;
92 |
93 | const classes = useStyles({
94 | orderType : orderType
95 | }) ;
96 |
97 | const emitEventToMarketing = (price) => {
98 | setMethodType(1);
99 | handleChangePrice(price) ;
100 | handleChangeStatus("sell") ;
101 | }
102 |
103 | const setOrderBuyListTimer = async (tradeToken) => {
104 | clearInterval(orderBuyListTimer) ;
105 |
106 | orderBuyListTimer = setInterval(async () => {
107 | await GetTokenOrderList(tradeToken._id , tradeToken.pair_type , "buy") ;
108 | } , 15000) ;
109 | }
110 |
111 | useEffect(async () => {
112 | if(tradeToken) {
113 | await GetTokenOrderList(tradeToken._id , tradeToken.pair_type , "buy") ;
114 |
115 | await setOrderBuyListTimer(tradeToken) ;
116 | }
117 | } , [tradeToken]) ;
118 |
119 | useEffect(() => {
120 | return () => {
121 | clearInterval(orderBuyListTimer) ;
122 | }
123 | } , []) ;
124 |
125 | return (
126 |
127 |
128 |
129 |
130 | {
131 | orderBuyList.length !== 0 ? orderBuyList.map((item , index) => {
132 | return (
133 | emitEventToMarketing(Number(item.price)) } >
134 |
135 | {Number(item.price).toFixed(decimal)}
136 | {Number(item.amount).toFixed(6)}
137 | {Number(Number(item.price) * Number(item.amount)).toFixed(6)}
138 |
139 | )
140 | }) :<>
141 | >
142 | }
143 |
144 |
145 |
146 |
147 | )
148 | }
149 |
150 | const mapStateToProps = state => ({
151 | orderBuyList : state.trade.orderBuyList
152 | })
153 |
154 | const mapDispatchToProps = {
155 | GetTokenOrderList
156 | }
157 |
158 | export default connect( mapStateToProps , mapDispatchToProps )(OrderBuyList) ;
--------------------------------------------------------------------------------
/src/components/Exchange/RecentOrder/RecentOrderList/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import React from 'react' ;
5 |
6 | import { useEffect } from 'react' ;
7 |
8 | import { connect } from 'react-redux';
9 | import { GetExchangeOrderList } from '../../../../redux/actions/order';
10 |
11 | import { formatDBDate } from '../../../../utils/helper' ;
12 |
13 | import {
14 | Box,
15 | TableContainer,
16 | Table ,
17 | TableHead,
18 | TableBody,
19 | TableRow,
20 | TableCell,
21 | CircularProgress
22 | } from '@mui/material' ;
23 |
24 | import { makeStyles } from '@mui/styles';
25 |
26 | const useStyles = makeStyles(() => ({
27 | root : {
28 | '&::-webkit-scrollbar': {
29 | width: '8px',
30 | backgroundColor : "lightgray",
31 | borderRadius : "5px"
32 | },
33 | '&::-webkit-scrollbar-track': {
34 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
35 | },
36 | '&::-webkit-scrollbar-thumb': {
37 | backgroundColor: 'gray',
38 | borderRadius : "5px"
39 | },
40 |
41 | overflow : "hidden" ,
42 | overflowY : "scroll" ,
43 | maxHeight : "calc(50vh - 145px)" ,
44 | height : "calc(50vh - 145px)" ,
45 |
46 | "& .MuiTableCell-root" :{
47 | padding : "0px !important",
48 | textAlign : "center",
49 | fontSize : "11px" ,
50 | fontWeight : "bold"
51 | }
52 |
53 | },
54 |
55 | }));
56 |
57 | let currentOrderTimer ;
58 |
59 | const RecentSelectBox = (props) => {
60 |
61 | const classes = useStyles() ;
62 |
63 | const {
64 | tradeToken ,
65 | exchangeOrderList , GetExchangeOrderList
66 | } = props ;
67 |
68 | const headFields = [
69 | "DateTime",
70 | "Pair" ,
71 | "Side" ,
72 | "Price" ,
73 | "Amount" ,
74 | "Total"
75 | ]
76 |
77 | const setCurrentOrderTimer = () => {
78 | clearInterval(currentOrderTimer) ;
79 |
80 | const currentOrderTimer = setTimeout(async () => {
81 | // await GetOrderHistory()
82 | } , 15000) ;
83 | }
84 |
85 | useEffect(async () => {
86 | if(tradeToken) {
87 | await GetExchangeOrderList("2022-01-01" , new Date().toISOString().substring(0,10), tradeToken._id , tradeToken.pair_type ) ;
88 | // await GetOrderHistory
89 |
90 | // await setCurrentOrderTimer()
91 | }
92 | } , [tradeToken]) ;
93 |
94 | useEffect(() => {
95 | return () => {
96 | clearInterval(currentOrderTimer) ;
97 | }
98 | } , [])
99 | return (
100 |
101 |
102 |
103 |
104 |
105 | {
106 | headFields.map((item , index) => {
107 | return (
108 |
109 | { item }
110 |
111 | )
112 | })
113 | }
114 |
115 |
116 |
117 | {
118 | exchangeOrderList !== "No Available Informations." ?
119 | ( exchangeOrderList.length !== 0 ? exchangeOrderList.map( (row , index) => {
120 | return (
121 |
122 | {formatDBDate(row.time)}
123 | {row.pair_token}
124 | {row.type}
125 | {row.price}
126 | {row.amount}
127 | {row.amount*row.price}
128 |
129 | )
130 | }) :
131 |
132 |
133 |
134 | ) :
135 | No Available Information
136 |
137 | }
138 |
139 |
140 |
141 |
142 | )
143 | }
144 |
145 | const mapStateToProps = state => ({
146 | exchangeOrderList : state.order.exchangeOrderList
147 | })
148 |
149 | const mapDispatchToProps = {
150 | GetExchangeOrderList
151 | }
152 |
153 | export default connect(mapStateToProps , mapDispatchToProps)(RecentSelectBox) ;
--------------------------------------------------------------------------------
/src/components/Exchange/OrderBook/OrderSellList/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React from 'react' ;
4 |
5 | // ____________ hook ______________________
6 | import { useState , useEffect } from 'react' ;
7 |
8 | // ____________ action and redux _____________
9 | import { connect } from 'react-redux';
10 | import { GetTokenOrderList } from '../../../../redux/actions/trade';
11 |
12 | // ___________ style ___________________
13 | import {
14 | Box ,
15 | TableContainer,
16 | Table,
17 | TableBody,
18 | TableRow ,
19 | TableCell
20 | } from "@mui/material" ;
21 |
22 | import { makeStyles } from '@mui/styles' ;
23 |
24 | const useStyles = makeStyles((theme) => ({
25 | root : {
26 |
27 | '&::-webkit-scrollbar': {
28 | width: '8px',
29 | backgroundColor : "lightgray",
30 | borderRadius : "5px"
31 | },
32 | '&::-webkit-scrollbar-track': {
33 | '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.00)'
34 | },
35 | '&::-webkit-scrollbar-thumb': {
36 | backgroundColor: 'gray',
37 | borderRadius : "5px"
38 | },
39 |
40 | overflow : "hidden" ,
41 | overflowY : "scroll" ,
42 | height : props => {
43 | if(props.orderType === 3) return "calc(50vh - 113.815px)" ;
44 | if(props.orderType === 2) return "0px" ;
45 | if(props.orderType === 1) return "calc(100vh - 230px)" ;
46 | },
47 | borderBottom : "1px solid gray" ,
48 | borderTop : "1px solid gray" ,
49 |
50 | "& .MuiTableBody-root" : {
51 | "& .MuiTableRow-root" : {
52 | position : "relative" ,
53 | },
54 | "& .MuiTableCell-root" : {
55 | padding : "5px" ,
56 | fontSize : "10px",
57 | textAlign : "right" ,
58 | width : "33.33%" ,
59 | cursor : "pointer"
60 | }
61 | },
62 | },
63 | progress : {
64 | position : "absolute" ,
65 | backgroundColor : "#f9dadb" ,
66 | left : 0 ,
67 | top : 0,
68 | height : "100%" ,
69 | width : props => `${props.total * 100 / props.max}%`,
70 | zIndex : "-1000" ,
71 | },
72 | price : {
73 | color : "#c74a4d !important"
74 | }
75 | }));
76 |
77 | const ProgressBar = ( { children, ...props } ) => {
78 |
79 | const classes = useStyles(props) ;
80 |
81 | return (
82 |
83 | )
84 | }
85 |
86 | let orderSellListTimer ;
87 |
88 | const OrderSellList = (props) => {
89 |
90 | const {
91 | tradeToken , decimal , orderType , tokenId ,
92 | handleChangePrice , handleChangeStatus ,
93 | orderSellList , GetTokenOrderList ,
94 | setMethodType
95 | } = props ;
96 |
97 | const classes = useStyles({
98 | orderType : orderType
99 | }) ;
100 |
101 | const setOrderSellListTimer = async (tradeToken) => {
102 | clearInterval(orderSellListTimer) ;
103 |
104 | orderSellListTimer = setInterval(async () => {
105 | await GetTokenOrderList(tradeToken._id , tradeToken.pair_type , "sell") ;
106 | } , 15000)
107 | }
108 | useEffect(() => {
109 | } , [orderType]) ;
110 |
111 | const emitEventToMarketing = (price) => {
112 | setMethodType(1);
113 | handleChangePrice(price) ;
114 | handleChangeStatus("buy") ;
115 | }
116 |
117 | useEffect(async () => {
118 | if(tradeToken) {
119 | await GetTokenOrderList(tradeToken._id , tradeToken.pair_type , "sell") ;
120 | await setOrderSellListTimer(tradeToken) ;
121 | }
122 | } , [tradeToken]) ;
123 |
124 | useEffect(() => {
125 | return () => {
126 | clearInterval(orderSellListTimer) ;
127 | }
128 | } , [])
129 |
130 | return (
131 |
132 |
133 |
134 |
135 | {
136 | orderSellList.length !== 0 ? orderSellList.map((item , index) => {
137 | return (
138 | emitEventToMarketing(item.price) }>
139 |
140 | {Number(item.price).toFixed(decimal)}
141 | {Number(item.amount).toFixed(6)}
142 | {Number(Number(item.price) * Number(item.amount)).toFixed(6)}
143 |
144 | )
145 | }) : <>
146 | >
147 | }
148 |
149 |
150 |
151 |
152 | )
153 | }
154 |
155 |
156 | const mapStateToProps = state => ({
157 | orderSellList : state.trade.orderSellList
158 | });
159 |
160 | const mapDispatchToProps = {
161 | GetTokenOrderList
162 | }
163 |
164 | export default connect(mapStateToProps , mapDispatchToProps)(OrderSellList) ;
--------------------------------------------------------------------------------
/src/redux/actions/order.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import axios from 'axios' ;
4 | import * as config from '../../static/constants' ;
5 | import ActionTypes from './actionTypes';
6 |
7 |
8 | export const OrderMarket = async (account , token_id , pair_token , price , amount , type) => {
9 | try {
10 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}order/market` , {
11 | orderer : account ,
12 | token_id : token_id ,
13 | pair_token : pair_token ,
14 | price : price,
15 | amount : amount ,
16 | type : type
17 | })
18 |
19 | if(res.status === 201){
20 | return false ;
21 | }
22 |
23 | if(res.status === 200){
24 | return true ;
25 | }
26 |
27 | return true ;
28 | }
29 | catch (err) {
30 | console.log(err) ;
31 | return false ;
32 | }
33 | }
34 |
35 | export const OrderLimit = async (account , token_id , pair_token , price , amount , type) => {
36 | try {
37 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}order/addlimit` , {
38 | orderer : account ,
39 | token_id : token_id ,
40 | pair_token : pair_token ,
41 | price : price,
42 | amount : amount ,
43 | type : type
44 | })
45 |
46 | if(res.status === 201){
47 | return false ;
48 | }
49 |
50 | if(res.status === 200){
51 | return true ;
52 | }
53 |
54 | return true ;
55 | }
56 | catch (err) {
57 | console.log(err) ;
58 | return false ;
59 | }
60 | }
61 |
62 | export const GetOrderHistory = (orderer , start_time , end_time , token_id , pair_token , type , is_traded) => async dispatch => {
63 | try {
64 |
65 | let jsonReqBody = {
66 | orderer : orderer,
67 | start_time : start_time,
68 | end_time : end_time,
69 | token_id : token_id,
70 | pair_token : pair_token,
71 | is_traded : is_traded
72 | }
73 |
74 | if(type !== "all") {
75 | jsonReqBody = {
76 | ...jsonReqBody ,
77 | type : type
78 | }
79 | }
80 |
81 | if(token_id === null) {
82 | jsonReqBody = {
83 | orderer : orderer,
84 | start_time : start_time,
85 | end_time : end_time,
86 | is_traded : is_traded
87 | }
88 | }
89 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}order/search` , jsonReqBody) ;
90 |
91 | if(res.status === 201) {
92 | return "error" ;
93 | }
94 |
95 | if(res.data.data.data.length === 0) {
96 | return dispatch({
97 | type : ActionTypes.GetOrderHistory ,
98 | payload : "No Available Informations."
99 | })
100 | }
101 |
102 |
103 | return dispatch({
104 | type : ActionTypes.GetOrderHistory,
105 | payload : res.data.data.data
106 | })
107 |
108 | }
109 | catch (err) {
110 | return "error" ;
111 | }
112 | }
113 |
114 |
115 | export const GetOrderTradeHistory = (orderer , start_time , end_time , token_id , pair_token , type ) => async dispatch => {
116 | try {
117 |
118 | let jsonReqBody = {
119 | orderer : orderer,
120 | start_time : start_time,
121 | end_time : end_time,
122 | token_id : token_id,
123 | pair_token : pair_token,
124 | }
125 |
126 | if(type !== "all") {
127 | jsonReqBody = {
128 | ...jsonReqBody ,
129 | type : type
130 | }
131 | }
132 |
133 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}order/search` , jsonReqBody) ;
134 |
135 | if(res.status === 201) {
136 | return "error" ;
137 | }
138 | if(res.data.data.data.length === 0) {
139 | return dispatch({
140 | type : ActionTypes.GetOrderTradeHistory ,
141 | payload : "No Available Informations."
142 | })
143 | }
144 |
145 | return dispatch({
146 | type : ActionTypes.GetOrderTradeHistory,
147 | payload : res.data.data.data
148 | })
149 |
150 | }
151 | catch (err) {
152 | return "error" ;
153 | }
154 | }
155 |
156 | export const GetExchangeOrderList = (start_time , end_time , token_id , pair_token ) => async dispatch => {
157 | try {
158 |
159 | let jsonReqBody = {
160 | start_time : start_time,
161 | end_time : end_time,
162 | token_id : token_id,
163 | pair_token : pair_token,
164 | is_traded : false
165 | }
166 |
167 | let res = await axios.post(`${config.PRIVATE_CALADEX_API}order/search` , jsonReqBody) ;
168 |
169 | if(res.status === 201) {
170 | return "error" ;
171 | }
172 | if(res.data.data.data.length === 0) {
173 | return dispatch({
174 | type : ActionTypes.GetExchangeOrderList ,
175 | payload : "No Available Informations."
176 | })
177 | }
178 |
179 | return dispatch({
180 | type : ActionTypes.GetExchangeOrderList,
181 | payload : res.data.data.data
182 | })
183 |
184 | }
185 | catch (err) {
186 | return "error" ;
187 | }
188 | }
--------------------------------------------------------------------------------
/src/components/Layouts/Footer/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | import React, { useEffect, useRef } from 'react' ;
4 |
5 | import { makeStyles } from '@mui/styles';
6 |
7 | import {
8 | AppBar ,
9 | Toolbar ,
10 | Typography,
11 | Box ,
12 | IconButton,
13 | useMediaQuery ,
14 | Grid
15 | } from '@mui/material' ;
16 |
17 | const useStyles = makeStyles((theme) => ({
18 | root : {
19 | // flexGrow: 1,
20 |
21 | "& svg" : {
22 | color : "white !important"
23 | } ,
24 | "& button" : {
25 | marginRight : "20px !important"
26 | },
27 | "& .MuiToolbar-root" : {
28 | padding : "0px !important" ,
29 | paddingTop : "10px !important" ,
30 | paddingBottom : "15px !important" ,
31 | },
32 | "& .MuiGrid-item" : {
33 | display : "flex" ,
34 | alignItems : "center",
35 | justifyContent : 'center'
36 | },
37 | // marginTop : "66px" ,
38 | padding:"0px"
39 | },
40 | toolbar : {
41 |
42 | } ,
43 | copyright : {
44 | fontSize : "15px" ,
45 | } ,
46 | iconGroup : {
47 | // marginRight : theme.spacing(2),
48 | } ,
49 |
50 | }));
51 |
52 | const Footer = () => {
53 |
54 | const classes = useStyles() ;
55 |
56 | const isXs = useMediaQuery("(min-width : 700px)") ;
57 |
58 | return (
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | Copyright © 2022
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
80 |
81 |
82 |
86 |
87 |
88 |
94 |
95 |
96 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | )
108 | }
109 | export default Footer ;
--------------------------------------------------------------------------------
/src/constants/abis/token.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "constant": true,
4 | "inputs": [],
5 | "name": "name",
6 | "outputs": [
7 | {
8 | "name": "",
9 | "type": "string"
10 | }
11 | ],
12 | "payable": false,
13 | "stateMutability": "view",
14 | "type": "function"
15 | },
16 | {
17 | "constant": false,
18 | "inputs": [
19 | {
20 | "name": "_spender",
21 | "type": "address"
22 | },
23 | {
24 | "name": "_value",
25 | "type": "uint256"
26 | }
27 | ],
28 | "name": "approve",
29 | "outputs": [
30 | {
31 | "name": "",
32 | "type": "bool"
33 | }
34 | ],
35 | "payable": false,
36 | "stateMutability": "nonpayable",
37 | "type": "function"
38 | },
39 | {
40 | "constant": true,
41 | "inputs": [],
42 | "name": "totalSupply",
43 | "outputs": [
44 | {
45 | "name": "",
46 | "type": "uint256"
47 | }
48 | ],
49 | "payable": false,
50 | "stateMutability": "view",
51 | "type": "function"
52 | },
53 | {
54 | "constant": false,
55 | "inputs": [
56 | {
57 | "name": "_from",
58 | "type": "address"
59 | },
60 | {
61 | "name": "_to",
62 | "type": "address"
63 | },
64 | {
65 | "name": "_value",
66 | "type": "uint256"
67 | }
68 | ],
69 | "name": "transferFrom",
70 | "outputs": [
71 | {
72 | "name": "",
73 | "type": "bool"
74 | }
75 | ],
76 | "payable": false,
77 | "stateMutability": "nonpayable",
78 | "type": "function"
79 | },
80 | {
81 | "constant": true,
82 | "inputs": [],
83 | "name": "decimals",
84 | "outputs": [
85 | {
86 | "name": "",
87 | "type": "uint8"
88 | }
89 | ],
90 | "payable": false,
91 | "stateMutability": "view",
92 | "type": "function"
93 | },
94 | {
95 | "constant": true,
96 | "inputs": [
97 | {
98 | "name": "_owner",
99 | "type": "address"
100 | }
101 | ],
102 | "name": "balanceOf",
103 | "outputs": [
104 | {
105 | "name": "balance",
106 | "type": "uint256"
107 | }
108 | ],
109 | "payable": false,
110 | "stateMutability": "view",
111 | "type": "function"
112 | },
113 | {
114 | "constant": true,
115 | "inputs": [],
116 | "name": "symbol",
117 | "outputs": [
118 | {
119 | "name": "",
120 | "type": "string"
121 | }
122 | ],
123 | "payable": false,
124 | "stateMutability": "view",
125 | "type": "function"
126 | },
127 | {
128 | "constant": false,
129 | "inputs": [
130 | {
131 | "name": "_to",
132 | "type": "address"
133 | },
134 | {
135 | "name": "_value",
136 | "type": "uint256"
137 | }
138 | ],
139 | "name": "transfer",
140 | "outputs": [
141 | {
142 | "name": "",
143 | "type": "bool"
144 | }
145 | ],
146 | "payable": false,
147 | "stateMutability": "nonpayable",
148 | "type": "function"
149 | },
150 | {
151 | "constant": true,
152 | "inputs": [
153 | {
154 | "name": "_owner",
155 | "type": "address"
156 | },
157 | {
158 | "name": "_spender",
159 | "type": "address"
160 | }
161 | ],
162 | "name": "allowance",
163 | "outputs": [
164 | {
165 | "name": "",
166 | "type": "uint256"
167 | }
168 | ],
169 | "payable": false,
170 | "stateMutability": "view",
171 | "type": "function"
172 | },
173 | {
174 | "payable": true,
175 | "stateMutability": "payable",
176 | "type": "fallback"
177 | },
178 | {
179 | "anonymous": false,
180 | "inputs": [
181 | {
182 | "indexed": true,
183 | "name": "owner",
184 | "type": "address"
185 | },
186 | {
187 | "indexed": true,
188 | "name": "spender",
189 | "type": "address"
190 | },
191 | {
192 | "indexed": false,
193 | "name": "value",
194 | "type": "uint256"
195 | }
196 | ],
197 | "name": "Approval",
198 | "type": "event"
199 | },
200 | {
201 | "anonymous": false,
202 | "inputs": [
203 | {
204 | "indexed": true,
205 | "name": "from",
206 | "type": "address"
207 | },
208 | {
209 | "indexed": true,
210 | "name": "to",
211 | "type": "address"
212 | },
213 | {
214 | "indexed": false,
215 | "name": "value",
216 | "type": "uint256"
217 | }
218 | ],
219 | "name": "Transfer",
220 | "type": "event"
221 | }
222 | ]
--------------------------------------------------------------------------------