├── public ├── _redirects ├── favicon.ico ├── favicon.png ├── robots.txt ├── manifest.json ├── index.html └── special.css ├── src ├── views │ └── Home │ │ ├── index.ts │ │ ├── types.ts │ │ └── components │ │ └── Balances.tsx ├── components │ ├── Logo │ │ ├── index.ts │ │ └── Logo.tsx │ ├── Button │ │ ├── index.ts │ │ └── Button.tsx │ ├── Card │ │ ├── index.ts │ │ └── Card.tsx │ ├── CardIcon │ │ ├── index.ts │ │ └── CardIcon.tsx │ ├── Dial │ │ ├── index.ts │ │ └── Dial.tsx │ ├── Label │ │ ├── index.ts │ │ └── Label.tsx │ ├── Page │ │ ├── index.ts │ │ └── Page.tsx │ ├── TopBar │ │ ├── index.ts │ │ ├── components │ │ │ ├── TxButton.tsx │ │ │ ├── PresaleBtn.tsx │ │ │ ├── AccountButton.tsx │ │ │ ├── ThemeSelector.tsx │ │ │ ├── Nav.tsx │ │ │ ├── AccountModal.tsx │ │ │ └── MarketingModal.tsx │ │ └── TopBar.tsx │ ├── Value │ │ ├── index.ts │ │ └── Value.tsx │ ├── CardEth │ │ ├── index.ts │ │ └── CardEth.tsx │ ├── Container │ │ ├── index.ts │ │ └── Container.tsx │ ├── Footer │ │ ├── index.ts │ │ ├── Footer.tsx │ │ └── components │ │ │ └── Nav.tsx │ ├── IconButton │ │ ├── index.ts │ │ └── IconButton.tsx │ ├── Loader │ │ ├── index.ts │ │ └── Loader.tsx │ ├── ModalTitle │ │ ├── index.ts │ │ └── ModalTitle.tsx │ ├── Spacer │ │ ├── index.ts │ │ └── Spacer.tsx │ ├── CardContent │ │ ├── index.ts │ │ └── CardContent.tsx │ ├── CardTitle │ │ ├── index.ts │ │ └── CardTitle.tsx │ ├── MobileMenu │ │ ├── index.ts │ │ └── MobileMenu.tsx │ ├── PageHeader │ │ ├── index.ts │ │ └── PageHeader.tsx │ ├── Separator │ │ ├── index.ts │ │ └── Separator.tsx │ ├── TokenAIcon │ │ ├── index.ts │ │ └── TokenAIcon.tsx │ ├── TokenInput │ │ ├── index.ts │ │ └── TokenInput.tsx │ ├── Countdown │ │ ├── index.ts │ │ └── HomeCountdown.tsx │ ├── DisclaimerModal │ │ ├── index.ts │ │ └── DisclaimerModal.tsx │ ├── ModalActions │ │ ├── index.ts │ │ └── ModalActions.tsx │ ├── ModalContent │ │ ├── index.ts │ │ └── ModalContent.tsx │ ├── WalletProviderModal │ │ ├── index.ts │ │ ├── components │ │ │ └── WalletCard.tsx │ │ └── WalletProviderModal.tsx │ ├── Hype │ │ ├── index.ts │ │ └── Hype.tsx │ ├── Icon │ │ ├── index.ts │ │ └── Icon.tsx │ ├── Modal │ │ ├── index.ts │ │ └── Modal.tsx │ ├── Input │ │ ├── index.ts │ │ └── Input.tsx │ └── icons │ │ ├── index.ts │ │ ├── MenuIcon.tsx │ │ ├── RemoveIcon.tsx │ │ └── AddIcon.tsx ├── react-app-env.d.ts ├── contexts │ ├── Modals │ │ ├── index.ts │ │ └── Modals.tsx │ ├── TokenAProvider │ │ ├── index.ts │ │ └── TokenAProvider.tsx │ ├── PresaleProvider │ │ ├── index.ts │ │ └── PresaleProvider.tsx │ ├── Transactions │ │ ├── index.ts │ │ ├── types.ts │ │ ├── context.ts │ │ ├── TransactionsProvider.tsx │ │ └── reducer.ts │ └── Farms │ │ ├── index.ts │ │ ├── context.ts │ │ ├── types.ts │ │ └── Farms.tsx ├── assets │ └── img │ │ ├── bsc.png │ │ ├── icon.png │ │ ├── logo.png │ │ ├── main.gif │ │ ├── arrow.png │ │ ├── account.png │ │ ├── bnb-logo.png │ │ ├── checkicon.png │ │ ├── favicon.png │ │ ├── sitelogo.jpg │ │ ├── sitelogo.png │ │ ├── background.jpg │ │ ├── trustwallet.png │ │ ├── NoBackground.png │ │ ├── NoBackgroundLogoSite.png │ │ ├── wallet-connect.svg │ │ └── metamask-fox.svg ├── presale │ ├── lib │ │ ├── types.js │ │ ├── accounts.js │ │ ├── evm.js │ │ ├── contracts.js │ │ └── abi │ │ │ └── presaleErc20.json │ ├── index.js │ └── Presale.js ├── tokenA │ ├── lib │ │ ├── types.js │ │ ├── accounts.js │ │ ├── evm.js │ │ ├── abi │ │ │ ├── weth.json │ │ │ ├── erc20.json │ │ │ └── xtokenA.json │ │ └── contracts.js │ ├── index.js │ ├── TokenA.js │ └── utils.js ├── utils │ ├── formatAddress.ts │ ├── index.ts │ ├── formatBalance.ts │ └── erc20.ts ├── redux │ ├── themeActions.tsx │ └── themeReducer.tsx ├── hooks │ ├── useTokenA.ts │ ├── usePresale.ts │ ├── useFarms.ts │ ├── useUnharvested.ts │ ├── useTransactionAdder.ts │ ├── useFarm.ts │ ├── useModal.ts │ ├── usePendingTransactions.ts │ ├── useRedeem.ts │ ├── useEnter.ts │ ├── useReward.ts │ ├── useLeave.ts │ ├── useStake.ts │ ├── useUnstake.ts │ ├── useBlock.ts │ ├── useApprove.ts │ ├── useApproveStaking.ts │ ├── useTokenBalance.ts │ ├── useStakedBalance.ts │ ├── useMasterChefBalance.ts_ │ ├── useEarnings.ts │ ├── useAllEarnings.ts │ ├── useAllowance.ts │ ├── useAllowanceStaking.ts │ └── useAllStakedValue.ts ├── setupTests.js ├── constants │ ├── tokenAddresses.ts │ └── abi │ │ └── ERC20.json ├── index.css ├── theme │ ├── colors.ts │ └── index.ts ├── index.tsx ├── App.tsx └── logo.svg ├── .gitignore ├── tsconfig.json ├── package.json └── README.md /public/_redirects: -------------------------------------------------------------------------------- 1 | /* /index.html 200 -------------------------------------------------------------------------------- /src/views/Home/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Home' -------------------------------------------------------------------------------- /src/components/Logo/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Logo' -------------------------------------------------------------------------------- /src/components/Button/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Button' -------------------------------------------------------------------------------- /src/components/Card/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Card' 2 | -------------------------------------------------------------------------------- /src/components/CardIcon/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardIcon' -------------------------------------------------------------------------------- /src/components/Dial/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Dial' 2 | -------------------------------------------------------------------------------- /src/components/Label/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Label' 2 | -------------------------------------------------------------------------------- /src/components/Page/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Page' 2 | -------------------------------------------------------------------------------- /src/components/TopBar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TopBar' -------------------------------------------------------------------------------- /src/components/Value/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Value' 2 | -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /src/components/CardEth/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardEth' 2 | -------------------------------------------------------------------------------- /src/components/Container/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Container' -------------------------------------------------------------------------------- /src/components/Footer/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Footer' 2 | -------------------------------------------------------------------------------- /src/components/IconButton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './IconButton' -------------------------------------------------------------------------------- /src/components/Loader/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Loader' 2 | -------------------------------------------------------------------------------- /src/components/ModalTitle/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ModalTitle' -------------------------------------------------------------------------------- /src/components/Spacer/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Spacer' 2 | -------------------------------------------------------------------------------- /src/components/CardContent/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardContent' -------------------------------------------------------------------------------- /src/components/CardTitle/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardTitle' 2 | -------------------------------------------------------------------------------- /src/components/MobileMenu/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './MobileMenu' 2 | -------------------------------------------------------------------------------- /src/components/PageHeader/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './PageHeader' 2 | -------------------------------------------------------------------------------- /src/components/Separator/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Separator' 2 | -------------------------------------------------------------------------------- /src/components/TokenAIcon/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TokenAIcon' 2 | -------------------------------------------------------------------------------- /src/components/TokenInput/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TokenInput' 2 | -------------------------------------------------------------------------------- /src/contexts/Modals/index.ts: -------------------------------------------------------------------------------- 1 | export { Context, default } from './Modals' 2 | -------------------------------------------------------------------------------- /src/components/Countdown/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './HomeCountdown'; 2 | -------------------------------------------------------------------------------- /src/components/DisclaimerModal/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DisclaimerModal' -------------------------------------------------------------------------------- /src/components/ModalActions/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ModalActions' 2 | -------------------------------------------------------------------------------- /src/components/ModalContent/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ModalContent' 2 | -------------------------------------------------------------------------------- /src/contexts/TokenAProvider/index.ts: -------------------------------------------------------------------------------- 1 | export { default, Context } from './TokenAProvider' 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/public/favicon.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/components/WalletProviderModal/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './WalletProviderModal' 2 | -------------------------------------------------------------------------------- /src/contexts/PresaleProvider/index.ts: -------------------------------------------------------------------------------- 1 | export { default, Context } from './PresaleProvider' 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | .DS_Store 4 | build/ 5 | package-lock.json 6 | yarn.lock 7 | 8 | -------------------------------------------------------------------------------- /src/assets/img/bsc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/bsc.png -------------------------------------------------------------------------------- /src/assets/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/icon.png -------------------------------------------------------------------------------- /src/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/logo.png -------------------------------------------------------------------------------- /src/assets/img/main.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/main.gif -------------------------------------------------------------------------------- /src/components/Hype/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Hype' 2 | export type { HypeProps } from './Hype' -------------------------------------------------------------------------------- /src/components/Icon/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Icon' 2 | export type { IconProps } from './Icon' -------------------------------------------------------------------------------- /src/components/Modal/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Modal' 2 | export type { ModalProps } from './Modal' -------------------------------------------------------------------------------- /src/assets/img/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/arrow.png -------------------------------------------------------------------------------- /src/components/Input/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Input' 2 | export type { InputProps } from './Input' 3 | -------------------------------------------------------------------------------- /src/assets/img/account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/account.png -------------------------------------------------------------------------------- /src/assets/img/bnb-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/bnb-logo.png -------------------------------------------------------------------------------- /src/assets/img/checkicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/checkicon.png -------------------------------------------------------------------------------- /src/assets/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/favicon.png -------------------------------------------------------------------------------- /src/assets/img/sitelogo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/sitelogo.jpg -------------------------------------------------------------------------------- /src/assets/img/sitelogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/sitelogo.png -------------------------------------------------------------------------------- /src/assets/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/background.jpg -------------------------------------------------------------------------------- /src/assets/img/trustwallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/trustwallet.png -------------------------------------------------------------------------------- /src/assets/img/NoBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/NoBackground.png -------------------------------------------------------------------------------- /src/contexts/Transactions/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Context } from './context' 2 | export { default } from './TransactionsProvider' 3 | -------------------------------------------------------------------------------- /src/presale/lib/types.js: -------------------------------------------------------------------------------- 1 | export const ConfirmationType = { 2 | Hash: 0, 3 | Confirmed: 1, 4 | Both: 2, 5 | Simulate: 3, 6 | } 7 | -------------------------------------------------------------------------------- /src/tokenA/lib/types.js: -------------------------------------------------------------------------------- 1 | export const ConfirmationType = { 2 | Hash: 0, 3 | Confirmed: 1, 4 | Both: 2, 5 | Simulate: 3, 6 | } 7 | -------------------------------------------------------------------------------- /src/assets/img/NoBackgroundLogoSite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptodev0124/GSOI-presale/HEAD/src/assets/img/NoBackgroundLogoSite.png -------------------------------------------------------------------------------- /src/contexts/Farms/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Context } from './context' 2 | export { default } from './Farms' 3 | export type { Farm, FarmsContext } from './types' 4 | -------------------------------------------------------------------------------- /src/utils/formatAddress.ts: -------------------------------------------------------------------------------- 1 | const formatAddress = (address: string) => { 2 | return address.slice(0, 6) + '...' + address.slice(-6) 3 | } 4 | 5 | export default formatAddress -------------------------------------------------------------------------------- /src/components/icons/index.ts: -------------------------------------------------------------------------------- 1 | export { default as AddIcon } from './AddIcon' 2 | export { default as MenuIcon } from './MenuIcon' 3 | export { default as RemoveIcon } from './RemoveIcon' -------------------------------------------------------------------------------- /src/redux/themeActions.tsx: -------------------------------------------------------------------------------- 1 | export const APPLY_THEME = "APPLY_THEME"; 2 | 3 | export const applyTheme = (theme: any) => { 4 | return { 5 | type: APPLY_THEME, 6 | payload: theme 7 | }; 8 | }; -------------------------------------------------------------------------------- /src/views/Home/types.ts: -------------------------------------------------------------------------------- 1 | export interface OverviewData { 2 | circSupply?: string, 3 | curPrice?: number, 4 | nextRebase?: number, 5 | scalingFactor?: number, 6 | targetPrice?: number, 7 | totalSupply?: string 8 | } -------------------------------------------------------------------------------- /src/contexts/Farms/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react' 2 | import { FarmsContext } from './types' 3 | 4 | const context = createContext({ 5 | farms: [], 6 | unharvested: 0, 7 | }) 8 | 9 | export default context 10 | -------------------------------------------------------------------------------- /src/hooks/useTokenA.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context } from '../contexts/TokenAProvider' 3 | 4 | const useTokenA = () => { 5 | const { tokenA } = useContext(Context) 6 | return tokenA 7 | } 8 | 9 | export default useTokenA 10 | -------------------------------------------------------------------------------- /src/hooks/usePresale.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context } from '../contexts/PresaleProvider' 3 | 4 | const usePresale = () => { 5 | const presale = useContext(Context) 6 | return presale 7 | } 8 | 9 | export default usePresale 10 | -------------------------------------------------------------------------------- /src/hooks/useFarms.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context as FarmsContext } from '../contexts/Farms' 3 | 4 | const useFarms = () => { 5 | const { farms } = useContext(FarmsContext) 6 | return [farms] 7 | } 8 | 9 | export default useFarms 10 | -------------------------------------------------------------------------------- /src/presale/index.js: -------------------------------------------------------------------------------- 1 | import BigNumber from 'bignumber.js/bignumber' 2 | import Web3 from 'web3' 3 | 4 | BigNumber.config({ 5 | EXPONENTIAL_AT: 1000, 6 | DECIMAL_PLACES: 80, 7 | }) 8 | 9 | export { Presale } from './Presale.js' 10 | export { Web3, BigNumber } 11 | -------------------------------------------------------------------------------- /src/tokenA/index.js: -------------------------------------------------------------------------------- 1 | import BigNumber from 'bignumber.js/bignumber' 2 | import Web3 from 'web3' 3 | 4 | BigNumber.config({ 5 | EXPONENTIAL_AT: 1000, 6 | DECIMAL_PLACES: 80, 7 | }) 8 | 9 | export { TokenA } from './TokenA.js' 10 | export { Web3, BigNumber } 11 | -------------------------------------------------------------------------------- /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/extend-expect'; 6 | -------------------------------------------------------------------------------- /src/contexts/Transactions/types.ts: -------------------------------------------------------------------------------- 1 | import { TransactionReceipt } from 'web3-core' 2 | 3 | export interface Transaction { 4 | description: string 5 | hash: string 6 | receipt?: TransactionReceipt 7 | } 8 | 9 | export interface TransactionsMap { 10 | [key: string]: Transaction 11 | } 12 | -------------------------------------------------------------------------------- /src/hooks/useUnharvested.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context as FarmsContext } from '../contexts/Farms' 3 | 4 | const useUnharvested = () => { 5 | const { unharvested } = useContext(FarmsContext) 6 | return unharvested 7 | } 8 | 9 | export default useUnharvested 10 | -------------------------------------------------------------------------------- /src/hooks/useTransactionAdder.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context } from '../contexts/Transactions' 3 | 4 | const useTransactionAdder = () => { 5 | const { onAddTransaction } = useContext(Context) 6 | return { onAddTransaction } 7 | } 8 | 9 | export default useTransactionAdder 10 | -------------------------------------------------------------------------------- /src/constants/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenA = '0x0e2298e3b3390e3b945a5456fbf59ecc3f55da16' 2 | export const tokenAv2 = '0xaba8cac6866b83ae4eec97dd07ed254282f6ad8a' 3 | export const tokenAAddress = '0x43a7903E3a839a67192151eE300e11198985E54b' 4 | export const masterChefAddress = '0x245A074cA9814fB46A21562bC70fAB92F8A3F779' 5 | -------------------------------------------------------------------------------- /src/hooks/useFarm.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context as FarmsContext, Farm } from '../contexts/Farms' 3 | 4 | const useFarm = (id: string): Farm => { 5 | const { farms } = useContext(FarmsContext) 6 | const farm = farms.find((farm) => farm.id === id) 7 | return farm 8 | } 9 | 10 | export default useFarm 11 | -------------------------------------------------------------------------------- /src/presale/lib/accounts.js: -------------------------------------------------------------------------------- 1 | export class Account { 2 | constructor(contracts, address) { 3 | this.contracts = contracts 4 | this.accountInfo = address 5 | this.type = '' 6 | this.allocation = [] 7 | this.balances = {} 8 | this.status = '' 9 | this.approvals = {} 10 | this.walletInfo = {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/tokenA/lib/accounts.js: -------------------------------------------------------------------------------- 1 | export class Account { 2 | constructor(contracts, address) { 3 | this.contracts = contracts 4 | this.accountInfo = address 5 | this.type = '' 6 | this.allocation = [] 7 | this.balances = {} 8 | this.status = '' 9 | this.approvals = {} 10 | this.walletInfo = {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "TokenASwap", 3 | "name": "Farm TOKENA with Uniswap LP Tokens", 4 | "icons": [ 5 | { 6 | "src": "favicon.png", 7 | "type": "image/png", 8 | "sizes": "240x240" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /src/components/CardEth/CardEth.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const CardEth: React.FC = ({ children }) => {children} 5 | 6 | const StyledCardEth = styled.div` 7 | display: flex; 8 | flex: 1; 9 | flex-direction: column; 10 | border: 0px; 11 | border-radius: 28px; 12 | ` 13 | 14 | export default CardEth 15 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | /* background: #fff8ee; */ 3 | background: #f5f5f5; 4 | color: rgb(20, 1, 8); 5 | margin: 0; 6 | font-family: 'Noto Sans', sans-serif; 7 | font-size: 16px; 8 | -webkit-font-smoothing: antialiased; 9 | -moz-osx-font-smoothing: grayscale; 10 | } 11 | 12 | code { 13 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 14 | monospace; 15 | } 16 | -------------------------------------------------------------------------------- /src/contexts/Transactions/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react' 2 | import { Transaction, TransactionsMap } from './types' 3 | 4 | interface TransactionsContext { 5 | transactions: TransactionsMap 6 | onAddTransaction: (tx: Transaction) => void 7 | } 8 | 9 | export default createContext({ 10 | transactions: {}, 11 | onAddTransaction: (tx: Transaction) => {}, 12 | }) 13 | -------------------------------------------------------------------------------- /src/components/Label/Label.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | interface LabelProps { 5 | text?: string 6 | } 7 | 8 | const Label: React.FC = ({ text }) => ( 9 | {text} 10 | ) 11 | 12 | const StyledLabel = styled.div` 13 | color: white; 14 | font-size: 15px; 15 | // position: relative; 16 | // left: -25px; 17 | ` 18 | 19 | export default Label 20 | -------------------------------------------------------------------------------- /src/theme/colors.ts: -------------------------------------------------------------------------------- 1 | export const white = '#FFF' 2 | export const black = '#000' 3 | 4 | export const green = { 5 | 500: '##00d1810', 6 | } 7 | 8 | export const red = { 9 | 100: '#FFFDFE', 10 | 200: '#ffc2a8', 11 | 500: '#d16c00', 12 | } 13 | 14 | export const grey = { 15 | 100: '#f7f4f2', 16 | 200: '#f0e9e7', 17 | 300: '#e2d6cf', 18 | 400: '#aa9585', 19 | 500: '#805e49', 20 | 600: '#5b3926', 21 | 800: '#2d1e12', 22 | } 23 | -------------------------------------------------------------------------------- /src/hooks/useModal.ts: -------------------------------------------------------------------------------- 1 | import { useCallback, useContext } from 'react' 2 | import { Context } from '../contexts/Modals' 3 | 4 | const useModal = (modal: React.ReactNode, key?: string) => { 5 | const { onDismiss, onPresent } = useContext(Context) 6 | 7 | const handlePresent = useCallback(() => { 8 | onPresent(modal, key) 9 | }, [key, modal, onPresent]) 10 | 11 | return [handlePresent, onDismiss] 12 | } 13 | 14 | export default useModal 15 | -------------------------------------------------------------------------------- /src/hooks/usePendingTransactions.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context } from '../contexts/Transactions' 3 | 4 | const usePendingTransactions = () => { 5 | const { transactions } = useContext(Context) 6 | const pendingTransactions = Object.keys(transactions) 7 | .map((txHash) => transactions[txHash]) 8 | .filter((tx) => !tx.receipt) 9 | return pendingTransactions 10 | } 11 | 12 | export default usePendingTransactions 13 | -------------------------------------------------------------------------------- /src/components/icons/MenuIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import { IconProps } from '../Icon' 4 | 5 | const MenuIcon: React.FC = ({ size = 24 }) => { 6 | return ( 7 | 12 | 13 | 14 | 15 | ) 16 | } 17 | 18 | export default MenuIcon 19 | -------------------------------------------------------------------------------- /src/contexts/Farms/types.ts: -------------------------------------------------------------------------------- 1 | import { Contract } from 'web3-eth-contract' 2 | 3 | export interface Farm { 4 | pid: number 5 | name: string 6 | lpToken: string 7 | lpTokenAddress: string 8 | lpContract: Contract 9 | tokenAddress: string 10 | earnToken: string 11 | earnTokenAddress: string 12 | icon: React.ReactNode 13 | id: string 14 | tokenSymbol: string 15 | } 16 | 17 | export interface FarmsContext { 18 | farms: Farm[] 19 | unharvested: number 20 | } 21 | -------------------------------------------------------------------------------- /src/components/TokenAIcon/TokenAIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | interface TokenAIconProps { 4 | size?: number 5 | v1?: boolean 6 | v2?: boolean 7 | v3?: boolean 8 | } 9 | 10 | const TokenAIcon: React.FC = ({ size = 36, v1, v2, v3 }) => ( 11 | 18 | 🍣 19 | 20 | ) 21 | 22 | export default TokenAIcon 23 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import { createStore } from 'redux'; 4 | import { Provider } from 'react-redux'; 5 | import App from './App' 6 | import { themeReducer } from './redux/themeReducer'; 7 | 8 | const store = createStore(themeReducer); 9 | 10 | ReactDOM.render( 11 | 12 | 13 | 14 | 15 | , 16 | document.getElementById('root'), 17 | ) 18 | -------------------------------------------------------------------------------- /src/redux/themeReducer.tsx: -------------------------------------------------------------------------------- 1 | import * as Actions from './themeActions'; 2 | import { lightTheme } from '../theme'; 3 | import { } from 'redux'; 4 | import { } from 'react-redux'; 5 | 6 | const initialState = { 7 | theme: lightTheme 8 | }; 9 | 10 | export const themeReducer = (state: any = initialState, action: any) => { 11 | switch (action.type) { 12 | case Actions.APPLY_THEME: 13 | return Object.assign({}, { theme: action.payload } ); 14 | default: 15 | return state; 16 | } 17 | }; -------------------------------------------------------------------------------- /src/components/ModalContent/ModalContent.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const ModalContent: React.FC = ({ children }) => { 5 | return {children} 6 | } 7 | 8 | const StyledModalContent = styled.div` 9 | padding: ${(props) => props.theme.spacing[4]}px; 10 | 11 | @media (max-width: 767px) { 12 | width: 100%; 13 | padding: ${(props) => props.theme.spacing[4]}px 12px; 14 | } 15 | ` 16 | 17 | export default ModalContent 18 | -------------------------------------------------------------------------------- /src/components/Icon/Icon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | export interface IconProps { 5 | color?: string, 6 | children?: React.ReactNode, 7 | size?: number, 8 | } 9 | 10 | const Icon: React.FC = ({ children, color, size = 24 }) => ( 11 | 12 | {React.isValidElement(children) && React.cloneElement(children, { 13 | color, 14 | size, 15 | })} 16 | 17 | ) 18 | 19 | const StyledIcon = styled.div` 20 | ` 21 | 22 | export default Icon -------------------------------------------------------------------------------- /src/components/CardContent/CardContent.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const CardContent: React.FC = ({ children }) => ( 5 | {children} 6 | ) 7 | 8 | const StyledCardContent = styled.div` 9 | display: flex; 10 | flex: 1; 11 | flex-direction: column; 12 | z-index: 2; 13 | position: relative; 14 | height: 30px; 15 | @media (max-width: 767px) { 16 | left: 0px; 17 | height: auto; 18 | padding: 5px; 19 | } 20 | ` 21 | 22 | export default CardContent 23 | -------------------------------------------------------------------------------- /src/components/Card/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const Card: React.FC = ({ children }) => {children} 5 | 6 | const StyledCard = styled.div` 7 | display: flex; 8 | flex: 1; 9 | flex-direction: column; 10 | background: ${(props) => props.theme.cardbackgroundColor}; 11 | border: 0px; 12 | border-radius: 28px; 13 | box-shadow: ${(props) => props.theme.boxshadow}; 14 | width: 320px; 15 | @media (max-width: 767px) { 16 | width: 100%; 17 | } 18 | ` 19 | 20 | export default Card 21 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import BigNumber from 'bignumber.js' 2 | 3 | export { default as formatAddress } from './formatAddress' 4 | 5 | export const bnToDec = (bn: BigNumber, decimals = 18): number => { 6 | return bn.dividedBy(new BigNumber(10).pow(decimals)).toNumber() 7 | } 8 | 9 | export const decToBn = (dec: number, decimals = 18) => { 10 | return new BigNumber(dec).multipliedBy(new BigNumber(10).pow(decimals)) 11 | } 12 | 13 | export function shorten(str: string) { 14 | if (str.length < 10) return str; 15 | return `${str.slice(0, 8)}...${str.slice(str.length - 6)}`; 16 | } -------------------------------------------------------------------------------- /src/hooks/useRedeem.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | import { useWallet } from 'use-wallet' 3 | import { Contract } from 'web3-eth-contract' 4 | import { redeem } from '../tokenA/utils' 5 | 6 | const useRedeem = (masterChefContract: Contract) => { 7 | const { account } = useWallet() 8 | 9 | const handleRedeem = useCallback(async () => { 10 | const txHash = await redeem(masterChefContract, account) 11 | console.log(txHash) 12 | return txHash 13 | }, [account, masterChefContract]) 14 | 15 | return { onRedeem: handleRedeem } 16 | } 17 | 18 | export default useRedeem 19 | -------------------------------------------------------------------------------- /src/components/icons/RemoveIcon.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react' 2 | import { ThemeContext } from 'styled-components' 3 | 4 | import { IconProps } from '../Icon' 5 | 6 | const RemoveIcon: React.FC = ({ color, size = 18 }) => { 7 | const { color: themeColor } = useContext(ThemeContext) 8 | return ( 9 | 15 | 16 | 17 | 18 | ) 19 | } 20 | 21 | export default RemoveIcon -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react", 21 | "strictNullChecks": false 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /src/hooks/useEnter.ts: -------------------------------------------------------------------------------- 1 | import {useCallback} from 'react' 2 | import useTokenA from './useTokenA' 3 | import {useWallet} from 'use-wallet' 4 | import {enter, getXTokenAStakingContract} from '../tokenA/utils' 5 | 6 | const useEnter = () => { 7 | const {account} = useWallet() 8 | const tokenA = useTokenA() 9 | 10 | const handle = useCallback( 11 | async (amount: string) => { 12 | const txHash = await enter( 13 | getXTokenAStakingContract(tokenA), 14 | amount, 15 | account, 16 | ) 17 | console.log(txHash) 18 | }, 19 | [account, tokenA], 20 | ) 21 | 22 | return {onEnter: handle} 23 | } 24 | 25 | export default useEnter 26 | -------------------------------------------------------------------------------- /src/components/Logo/Logo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Link } from 'react-router-dom' 3 | import styled from 'styled-components' 4 | import chef from '../../assets/img/NoBackgroundLogoSite.png' 5 | 6 | const Logo: React.FC = () => { 7 | return ( 8 | 9 | logo 10 | 11 | ) 12 | } 13 | 14 | const StyledLogo = styled(Link)` 15 | align-items: center; 16 | display: flex; 17 | justify-content: center; 18 | margin: 0; 19 | min-height: 44px; 20 | min-width: 44px; 21 | padding: 0; 22 | text-decoration: none; 23 | ` 24 | 25 | export default Logo 26 | -------------------------------------------------------------------------------- /src/hooks/useReward.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | import useTokenA from './useTokenA' 3 | import { useWallet } from 'use-wallet' 4 | import { harvest, getMasterChefContract } from '../tokenA/utils' 5 | 6 | const useReward = (pid: number) => { 7 | const { account } = useWallet() 8 | const tokenA = useTokenA() 9 | const masterChefContract = getMasterChefContract(tokenA) 10 | 11 | const handleReward = useCallback(async () => { 12 | const txHash = await harvest(masterChefContract, pid, account) 13 | console.log(txHash) 14 | return txHash 15 | }, [account, pid, tokenA]) 16 | 17 | return { onReward: handleReward } 18 | } 19 | 20 | export default useReward 21 | -------------------------------------------------------------------------------- /src/hooks/useLeave.ts: -------------------------------------------------------------------------------- 1 | import {useCallback} from 'react' 2 | 3 | import useTokenA from './useTokenA' 4 | import {useWallet} from 'use-wallet' 5 | 6 | import {leave, getXTokenAStakingContract} from '../tokenA/utils' 7 | 8 | const useLeave = () => { 9 | const {account} = useWallet() 10 | const tokenA = useTokenA() 11 | 12 | const handle = useCallback( 13 | async (amount: string) => { 14 | const txHash = await leave( 15 | getXTokenAStakingContract(tokenA), 16 | amount, 17 | account, 18 | ) 19 | console.log(txHash) 20 | }, 21 | [account, tokenA], 22 | ) 23 | 24 | return {onLeave: handle} 25 | } 26 | 27 | export default useLeave 28 | -------------------------------------------------------------------------------- /src/components/CardTitle/CardTitle.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | interface CardTitleProps { 5 | text?: string 6 | } 7 | 8 | const CardTitle: React.FC = ({ text }) => ( 9 | {text} 10 | ) 11 | 12 | const StyledCardTitle = styled.div` 13 | font-family: Optima; 14 | font-style: normal; 15 | font-weight: bold; 16 | color:black; 17 | font-size: 16px; 18 | line-height: 19px; 19 | padding: ${(props) => props.theme.spacing[3]}px; 20 | text-align: center; 21 | @media (max-width: 767px) { 22 | font-size: 12px; 23 | padding: 0; 24 | } 25 | ` 26 | 27 | export default CardTitle 28 | -------------------------------------------------------------------------------- /src/components/icons/AddIcon.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react' 2 | import { ThemeContext } from 'styled-components' 3 | 4 | import { IconProps } from '../Icon' 5 | 6 | const AddIcon: React.FC = ({ color, size = 24 }) => { 7 | const { color: themeColor } = useContext(ThemeContext) 8 | return ( 9 | 14 | 18 | 22 | 23 | ) 24 | } 25 | 26 | export default AddIcon -------------------------------------------------------------------------------- /src/hooks/useStake.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | import useTokenA from './useTokenA' 3 | import { useWallet } from 'use-wallet' 4 | import { stake, getMasterChefContract } from '../tokenA/utils' 5 | 6 | const useStake = (pid: number) => { 7 | const { account } = useWallet() 8 | const tokenA = useTokenA() 9 | 10 | const handleStake = useCallback( 11 | async (amount: string) => { 12 | const txHash = await stake( 13 | getMasterChefContract(tokenA), 14 | pid, 15 | amount, 16 | account, 17 | ) 18 | console.log(txHash) 19 | }, 20 | [account, pid, tokenA], 21 | ) 22 | 23 | return { onStake: handleStake } 24 | } 25 | 26 | export default useStake 27 | -------------------------------------------------------------------------------- /src/hooks/useUnstake.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | import useTokenA from './useTokenA' 3 | import { useWallet } from 'use-wallet' 4 | import { unstake, getMasterChefContract } from '../tokenA/utils' 5 | 6 | const useUnstake = (pid: number) => { 7 | const { account } = useWallet() 8 | const tokenA = useTokenA() 9 | const masterChefContract = getMasterChefContract(tokenA) 10 | 11 | const handleUnstake = useCallback( 12 | async (amount: string) => { 13 | const txHash = await unstake(masterChefContract, pid, amount, account) 14 | console.log(txHash) 15 | }, 16 | [account, pid, tokenA], 17 | ) 18 | 19 | return { onUnstake: handleUnstake } 20 | } 21 | 22 | export default useUnstake 23 | -------------------------------------------------------------------------------- /src/contexts/Farms/Farms.tsx: -------------------------------------------------------------------------------- 1 | import React, { useCallback, useEffect, useState } from 'react' 2 | import { useWallet } from 'use-wallet' 3 | import useTokenA from '../../hooks/useTokenA' 4 | import { getFarms } from '../../tokenA/utils' 5 | import Context from './context' 6 | 7 | const Farms: React.FC = ({ children }) => { 8 | const [unharvested, setUnharvested] = useState(0) 9 | 10 | const tokenA = useTokenA() 11 | const { account } = useWallet() 12 | 13 | const farms = getFarms(tokenA) 14 | 15 | return ( 16 | 22 | {children} 23 | 24 | ) 25 | } 26 | 27 | export default Farms 28 | -------------------------------------------------------------------------------- /src/components/ModalTitle/ModalTitle.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | interface ModalTitleProps { 5 | text?: string 6 | } 7 | 8 | const ModalTitle: React.FC = ({ text }) => ( 9 | 10 | {text} 11 | 12 | ) 13 | 14 | const StyledModalTitle = styled.div` 15 | font-family: Optima; 16 | font-style: normal; 17 | font-weight: bold; 18 | font-size: 26px; 19 | line-height: 32px; 20 | border-bottom: 4px solid rgb(0, 0, 0); 21 | width: 320px; 22 | padding-bottom: 20px; 23 | padding-top: 14px; 24 | text-align: left; 25 | @media (max-width: 767px) { 26 | width: 100%; 27 | } 28 | color: black; 29 | ` 30 | 31 | export default ModalTitle -------------------------------------------------------------------------------- /src/utils/formatBalance.ts: -------------------------------------------------------------------------------- 1 | import BigNumber from 'bignumber.js' 2 | 3 | export const getBalanceNumber = (balance: BigNumber, decimals = 18) => { 4 | const displayBalance = balance.dividedBy(new BigNumber(10).pow(decimals)) 5 | return displayBalance.toNumber() 6 | } 7 | 8 | export const getDisplayBalance = (balance: BigNumber, decimals = 18) => { 9 | const displayBalance = balance.dividedBy(new BigNumber(10).pow(decimals)) 10 | if (displayBalance.lt(1)) { 11 | return displayBalance.toPrecision(4) 12 | } else { 13 | return displayBalance.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',') 14 | } 15 | } 16 | 17 | export const getFullDisplayBalance = (balance: BigNumber, decimals = 18) => { 18 | return balance.dividedBy(new BigNumber(10).pow(decimals)).toFixed() 19 | } 20 | -------------------------------------------------------------------------------- /src/hooks/useBlock.ts: -------------------------------------------------------------------------------- 1 | import { useCallback, useEffect, useState } from 'react' 2 | import Web3 from 'web3' 3 | import { provider } from 'web3-core' 4 | import { useWallet } from 'use-wallet' 5 | 6 | const useBlock = () => { 7 | const [block, setBlock] = useState(0) 8 | const { ethereum }: { ethereum: provider } = useWallet() 9 | 10 | useEffect(() => { 11 | if (!ethereum) return 12 | const web3 = new Web3(ethereum) 13 | 14 | const interval = setInterval(async () => { 15 | const latestBlockNumber = await web3.eth.getBlockNumber() 16 | if (block !== latestBlockNumber) { 17 | setBlock(latestBlockNumber) 18 | } 19 | }, 1000) 20 | 21 | return () => clearInterval(interval) 22 | }, [ethereum]) 23 | 24 | return block 25 | } 26 | 27 | export default useBlock 28 | -------------------------------------------------------------------------------- /src/components/Footer/Footer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | import Nav from './components/Nav' 5 | import bgImg from '../../assets/img/footerbg.svg' 6 | 7 | const Footer: React.FC = () => ( 8 | 9 | 10 |