diff --git a/apps/staking/__tests__/components/pools/PoolCommission.test.tsx b/apps/staking/__tests__/components/pools/PoolCommission.test.tsx index 78cc644c..f82b63d1 100644 --- a/apps/staking/__tests__/components/pools/PoolCommission.test.tsx +++ b/apps/staking/__tests__/components/pools/PoolCommission.test.tsx @@ -10,11 +10,11 @@ // PARTICULAR PURPOSE. See the GNU General Public License for more details. import { render, screen } from '@testing-library/react'; +import { FaNetworkWired } from 'react-icons/fa'; import PoolCommission from '../../../src/components/pools/PoolCommission'; -import { withChakraTheme } from '../../test-utilities'; import { StakingPool } from '../../../src/graphql/models'; import stakingPoolsData from '../../../src/stories/stake/tables/stakingPoolsData'; -import { FaNetworkWired } from 'react-icons/fa'; +import { withChakraTheme } from '../../test-utilities'; const [pool] = stakingPoolsData as unknown as StakingPool[]; @@ -43,9 +43,7 @@ describe('PoolCommission component', () => { pool.commissionPercentage !== null ? numberFormat.format(pool.commissionPercentage) : '-'; - const commissionLabel = pool.fee.commission - ? `${(pool.fee.commission / 100).toFixed(2)} %` - : `${pool.fee.gas} Gas`; + const commissionLabel = `${(pool.fee.commission / 100).toFixed(2)} %`; const valueLabel = `${accruedCommissionLabel} (${commissionLabel})`; diff --git a/apps/staking/__tests__/components/stake/PoolSetting.test.tsx b/apps/staking/__tests__/components/stake/PoolSetting.test.tsx index 2540c24b..c4800e84 100644 --- a/apps/staking/__tests__/components/stake/PoolSetting.test.tsx +++ b/apps/staking/__tests__/components/stake/PoolSetting.test.tsx @@ -23,6 +23,7 @@ import { BigNumber } from 'ethers'; import { PoolSetting } from '../../../src/components/stake/PoolSetting'; import useStakingPoolQuery from '../../../src/graphql/hooks/useStakingPool'; import useTotalPoolBalance from '../../../src/graphql/hooks/useTotalPoolBalance'; +import { StakingPool } from '../../../src/graphql/models'; import { useStakingPool } from '../../../src/services/pool'; import { useStakingPoolFactory } from '../../../src/services/poolFactory'; import { withChakraTheme } from '../../test-utilities'; diff --git a/apps/staking/__tests__/services/pool.test.ts b/apps/staking/__tests__/services/pool.test.ts index ac853c4a..5ac6c8f4 100644 --- a/apps/staking/__tests__/services/pool.test.ts +++ b/apps/staking/__tests__/services/pool.test.ts @@ -9,28 +9,25 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import { renderHook, waitFor } from '@testing-library/react'; import { - useFlatRateCommission, - useGasTaxCommission, - useStakingPool, - useStakingPoolCommission, -} from '../../src/services/pool'; + Fee, + FlatRateCommission, + StakingPoolImpl, +} from '@cartesi/staking-pool'; +import { renderHook, waitFor } from '@testing-library/react'; +import { BigNumber, FixedNumber } from 'ethers'; +import { act } from 'react-dom/test-utils'; import { useFeeContract, useFlatRateCommissionContract, - useGasTaxCommissionContract, useStakingPoolContract, } from '../../src/services/contracts'; -import { useTransaction, Transaction } from '../../src/services/transaction'; import { - Fee, - FlatRateCommission, - GasTaxCommission, - StakingPoolImpl, -} from '@cartesi/staking-pool'; -import { act } from 'react-dom/test-utils'; -import { BigNumber, FixedNumber } from 'ethers'; + useFlatRateCommission, + useStakingPool, + useStakingPoolCommission, +} from '../../src/services/pool'; +import { Transaction, useTransaction } from '../../src/services/transaction'; jest.mock('@explorer/wallet/src/useWallet'); @@ -43,7 +40,6 @@ jest.mock('../../src/services/eth', () => ({ })); jest.mock('../../src/services/contracts', () => ({ - useGasTaxCommissionContract: jest.fn(), useFlatRateCommissionContract: jest.fn(), useFeeContract: jest.fn(), useStakingPoolContract: jest.fn(), @@ -55,10 +51,6 @@ const mockedUseTransaction = useTransaction as jest.MockedFunction< typeof useTransaction >; -const mockedUseGasTaxCommissionContract = - useGasTaxCommissionContract as jest.MockedFunction< - typeof useGasTaxCommissionContract - >; const mockedUseFlatRateCommissionContract = useFlatRateCommissionContract as jest.MockedFunction< typeof useFlatRateCommissionContract @@ -72,14 +64,6 @@ const mockUseFeeContract = useFeeContract as jest.MockedFunction< typeof useFeeContract >; -const gasTaxCommissionContract = { - setGas: jest.fn(), - gas: () => Promise.resolve(), - feeRaiseTimeout: () => Promise.resolve(), - maxRaise: () => Promise.resolve(), - timeoutTimestamp: () => Promise.resolve(BigNumber.from('10000')), -}; - const flatRateCommissionContract = { setRate: jest.fn(), rate: () => Promise.resolve(), @@ -117,59 +101,6 @@ const stakingPoolContract = { }; describe('pool service', () => { - describe('useGasTaxCommission hook', () => { - it('should return default initial values when fee is undefined', () => { - mockedUseGasTaxCommissionContract.mockReturnValue(undefined); - - const { result } = renderHook(() => useGasTaxCommission(address)); - - expect(result.current.gas).toBe(undefined); - expect(result.current.maxRaise).toBe(undefined); - expect(result.current.timeoutTimestamp).toBe(undefined); - expect(result.current.raiseTimeout).toBe(undefined); - }); - - it('should set a transaction when changing gas', async () => { - mockedUseGasTaxCommissionContract.mockReturnValue( - gasTaxCommissionContract as unknown as GasTaxCommission - ); - const mockedSet = jest.fn(); - mockedUseTransaction.mockReturnValue({ - set: mockedSet, - } as unknown as Transaction); - const { result } = renderHook(() => useGasTaxCommission(address)); - await act(async () => { - result.current.changeGas(1000); - }); - expect(mockedSet).toHaveBeenCalled(); - }); - - it('should set correct values when fee is defined', async () => { - const gas = BigNumber.from('1000'); - const raiseTimeout = BigNumber.from('10000000'); - const maxRaise = BigNumber.from('1000000000'); - const timeoutTimestamp = BigNumber.from('10000'); - mockedUseGasTaxCommissionContract.mockReturnValue({ - setGas: jest.fn(), - gas: () => Promise.resolve(gas), - feeRaiseTimeout: () => Promise.resolve(raiseTimeout), - maxRaise: () => Promise.resolve(maxRaise), - timeoutTimestamp: () => Promise.resolve(timeoutTimestamp), - } as unknown as GasTaxCommission); - - const { result } = renderHook(() => useGasTaxCommission(address)); - - await waitFor(() => { - expect(result.current.gas).toStrictEqual(gas); - expect(result.current.raiseTimeout).toStrictEqual(raiseTimeout); - expect(result.current.maxRaise).toStrictEqual(maxRaise); - expect(result.current.timeoutTimestamp).toStrictEqual( - new Date(timeoutTimestamp.toNumber() * 1000) - ); - }); - }); - }); - describe('useFlatRateCommission hook', () => { it('should return default initial values when fee is undefined', () => { mockedUseFlatRateCommissionContract.mockReturnValue(undefined); diff --git a/apps/staking/__tests__/utils/messages.test.tsx b/apps/staking/__tests__/utils/messages.test.tsx index 51251d1a..51a28597 100644 --- a/apps/staking/__tests__/utils/messages.test.tsx +++ b/apps/staking/__tests__/utils/messages.test.tsx @@ -264,15 +264,6 @@ describe('useMessages hook', () => { 'This model calculates the commission as a fixed percentage of the block CTSI reward before distributing the remaining amount to the pool users.' ); }); - - it('should return a message of how gas-based works', () => { - const { result } = renderHook(() => - useMessages('commission.model.gasBased.howItWorks') - ); - expect(result.current).toEqual( - 'This model calculates the commission considering the current network gas price, Ethereum price and CTSI price. The configured amount of gas above is multiplied by the gas price provided by a ChainLink oracle, then converted from ETH to CTSI using an Uniswap V2 price oracle.' - ); - }); }); }); diff --git a/apps/staking/package.json b/apps/staking/package.json index 942d3d6c..fdb02522 100644 --- a/apps/staking/package.json +++ b/apps/staking/package.json @@ -11,8 +11,8 @@ "lint:fix": "yarn lint --fix", "start": "next start", "storybook": "start-storybook -p 6006", - "test": "jest", - "test:ci": "jest --runInBand --coverage" + "test": "dotenv -c test -- jest", + "test:ci": "dotenv -c test jest --runInBand --coverage" }, "dependencies": { "@apollo/client": "3.4.13", diff --git a/apps/staking/src/components/pools/PoolCommission.tsx b/apps/staking/src/components/pools/PoolCommission.tsx index bf414565..13cdf090 100644 --- a/apps/staking/src/components/pools/PoolCommission.tsx +++ b/apps/staking/src/components/pools/PoolCommission.tsx @@ -9,9 +9,9 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import React, { FC } from 'react'; -import { Flex, HStack, SystemProps, Text, TextProps } from '@chakra-ui/react'; import { Icon } from '@chakra-ui/icons'; +import { Flex, HStack, SystemProps, Text, TextProps } from '@chakra-ui/react'; +import { FC } from 'react'; import { IconType } from 'react-icons'; import { StakingPool } from '../../graphql/models'; @@ -33,9 +33,7 @@ const PoolCommission: FC = (props) => { pool.commissionPercentage !== null ? numberFormat.format(pool.commissionPercentage) : '-'; - const commissionLabel = pool.fee.commission - ? `${(pool.fee.commission / 100).toFixed(2)} %` - : `${pool.fee.gas} Gas`; + const commissionLabel = `${(pool.fee.commission / 100).toFixed(2)} %`; const valueLabel = `${accruedCommissionLabel} (${commissionLabel})`; return ( diff --git a/apps/staking/src/components/pools/fee/CommissionForm.tsx b/apps/staking/src/components/pools/fee/CommissionForm.tsx index 5cc595ea..fc524a0a 100644 --- a/apps/staking/src/components/pools/fee/CommissionForm.tsx +++ b/apps/staking/src/components/pools/fee/CommissionForm.tsx @@ -9,7 +9,6 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import { FC, useEffect, useMemo } from 'react'; import { Alert, Button, @@ -18,18 +17,19 @@ import { FormHelperText, FormLabel, HStack, - Text, - VStack, Input, InputGroup, InputRightAddon, + Text, + VStack, } from '@chakra-ui/react'; -import { useForm } from 'react-hook-form'; import humanizeDuration from 'humanize-duration'; +import { FC, useEffect, useMemo } from 'react'; +import { useForm } from 'react-hook-form'; export interface CommissionFormProps { currentValue: number; // current value - unit: string; // unit: '%' | 'gas' + unit: string; // unit: '%' min?: number; // minimum value max?: number; // maximum value maxRaise: number; // max raise of the value diff --git a/apps/staking/src/components/stake/CommissionForm.tsx b/apps/staking/src/components/stake/CommissionForm.tsx index e7715494..036f86c6 100644 --- a/apps/staking/src/components/stake/CommissionForm.tsx +++ b/apps/staking/src/components/stake/CommissionForm.tsx @@ -33,7 +33,7 @@ import { useForm } from 'react-hook-form'; export interface CommissionFormProps { currentValue: number; - unit: '%' | 'gas'; + unit: '%'; min?: number; max?: number; maxRaise: number; diff --git a/apps/staking/src/components/stake/PoolSetting.tsx b/apps/staking/src/components/stake/PoolSetting.tsx index 3c502120..8a818f32 100644 --- a/apps/staking/src/components/stake/PoolSetting.tsx +++ b/apps/staking/src/components/stake/PoolSetting.tsx @@ -40,7 +40,6 @@ import { FC } from 'react'; import { useForm } from 'react-hook-form'; import { FaBalanceScaleLeft } from 'react-icons/fa'; import FlatRateContainer from '../../containers/stake/FlatRateContainer'; -import GasTaxContainer from '../../containers/stake/GasTaxContainer'; import useStakingPoolQuery from '../../graphql/hooks/useStakingPool'; import { useStakingPool } from '../../services/pool'; import { useStakingPoolFactory } from '../../services/poolFactory'; @@ -129,12 +128,6 @@ export const PoolSetting: FC = ({ address }) => { pool.amounts?.stake > BigNumber.from(0) || pool.amounts?.unstake > BigNumber.from(0) || pool.amounts?.withdraw > BigNumber.from(0); - const feeType = - stakingPool?.fee?.commission !== null - ? 'flatRate' - : stakingPool?.fee?.gas !== null - ? 'gasTax' - : undefined; const isRebalancing = pool.rebalanceTransaction?.isOngoing; const isRebalanceButtonDisabled = !isRebalanceEnabled || isRebalancing; const hasSamePoS = isSamePoS(pool.pos, poolFactory.pos); @@ -297,19 +290,10 @@ export const PoolSetting: FC = ({ address }) => { )} - {feeType == 'flatRate' && ( - - )} - - {feeType == 'gasTax' && ( - - )} + = ({ const { isGnosisSafe } = useWallet(); const ethInfoMessage = useMessages('balance.eth.available.forGasCosts'); const iconColor = useColorModeValue('light.primary', 'dark.primary'); - const iconBg = useColorModeValue('dark.gray.senary', 'dark.gray.primary'); const warningIconColor = useColorModeValue( 'light.support.warning', 'white' diff --git a/apps/staking/src/components/stake/tables/PoolPerformanceTableRow.tsx b/apps/staking/src/components/stake/tables/PoolPerformanceTableRow.tsx index 782c4270..78640224 100644 --- a/apps/staking/src/components/stake/tables/PoolPerformanceTableRow.tsx +++ b/apps/staking/src/components/stake/tables/PoolPerformanceTableRow.tsx @@ -9,7 +9,6 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import { FC, useState } from 'react'; import { LockIcon } from '@chakra-ui/icons'; import { Box, @@ -25,6 +24,7 @@ import { import { Address, StakeIcon } from '@explorer/ui'; import { first, last } from 'lodash/fp'; import NextLink from 'next/link'; +import { FC, useState } from 'react'; import { StakingPool } from '../../../graphql/models'; import labels from '../../../utils/labels'; import { formatCTSI } from '../../../utils/token'; @@ -92,29 +92,11 @@ const PoolPerformanceTableRow: FC = ({ ? numberFormat.format(pool.commissionPercentage) : '-'; - let flatRate = pool.fee.commission > 0; - const gasTax = pool.fee.gas > 0; - - // XXX: if both are zero, currently we don't which is it, for now let's assume it's flat rate - if (!flatRate && !gasTax) { - flatRate = true; - } - // commission label - let commissionLabel = ''; - if (flatRate) { - commissionLabel = `${(pool.fee.commission / 100).toFixed(2)} %`; - } else if (gasTax) { - commissionLabel = `${pool.fee.gas} Gas`; - } + const commissionLabel = `${(pool.fee.commission / 100).toFixed(2)} %`; // commission help tooltip - let commissionTooltip: string = undefined; - if (flatRate) { - commissionTooltip = labels.flatRateCommission; - } else if (gasTax) { - commissionTooltip = labels.gasTaxCommission; - } + const commissionTooltip: string = labels.flatRateCommission; const [isHovered, setHovered] = useState(false); const backgroundColor = useColorModeValue('white', 'dark.gray.primary'); diff --git a/apps/staking/src/containers/pool/GasTaxContainer.tsx b/apps/staking/src/containers/pool/GasTaxContainer.tsx deleted file mode 100644 index b7bb8879..00000000 --- a/apps/staking/src/containers/pool/GasTaxContainer.tsx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2021 Cartesi Pte. Ltd. - -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation, either version 3 of the License, or (at your option) any later -// version. - -// This program is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more details. - -import { FC } from 'react'; -import CommissionForm from '../../components/pools/fee/CommissionForm'; -import TransactionFeedback from '../../components/TransactionFeedback'; -import { useGasTaxCommission } from '../../services/pool'; - -export interface GasTaxContainerProps { - pool: string; -} - -const GasTaxContainer: FC = (props) => { - const { pool } = props; - const { - gas, - maxRaise, - timeoutTimestamp, - raiseTimeout, - changeGas, - transaction, - } = useGasTaxCommission(pool); - - return ( - <> - - - - ); -}; - -export default GasTaxContainer; diff --git a/apps/staking/src/containers/stake/GasTaxContainer.tsx b/apps/staking/src/containers/stake/GasTaxContainer.tsx deleted file mode 100644 index 590d6f8a..00000000 --- a/apps/staking/src/containers/stake/GasTaxContainer.tsx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2021 Cartesi Pte. Ltd. - -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation, either version 3 of the License, or (at your option) any later -// version. - -// This program is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more details. - -import React, { FC } from 'react'; -import CommissionForm from '../../components/stake/CommissionForm'; -import { useGasTaxCommission } from '../../services/pool'; -import TransactionBanner from '../../components/TransactionBanner'; -import { AlertMessage } from '../../components/stake/TransactionInfoBanner'; - -export interface GasTaxContainerProps { - pool: string; - alertMessage: AlertMessage; -} - -const GasTaxContainer: FC = (props) => { - const { pool, alertMessage } = props; - const { - gas, - maxRaise, - timeoutTimestamp, - raiseTimeout, - changeGas, - transaction, - } = useGasTaxCommission(pool); - const progress = transaction?.receipt?.confirmations || 0; - - return ( - <> - - - - - ); -}; - -export default GasTaxContainer; diff --git a/apps/staking/src/graphql/models.ts b/apps/staking/src/graphql/models.ts index c3ae4d55..96e8e326 100644 --- a/apps/staking/src/graphql/models.ts +++ b/apps/staking/src/graphql/models.ts @@ -105,7 +105,6 @@ export type StakingPoolFee = { }; export enum StakingPoolFeeType { - GAS_TAX = 'GAS_TAX_COMMISSION', FLAT_RATE = 'FLAT_RATE_COMMISSION', } diff --git a/apps/staking/src/services/contracts/index.ts b/apps/staking/src/services/contracts/index.ts index be86017f..a4ee606e 100644 --- a/apps/staking/src/services/contracts/index.ts +++ b/apps/staking/src/services/contracts/index.ts @@ -198,5 +198,4 @@ export const usePoS1Contract = pos1.usePoSContract; export const useStakingPoolContract = pool.useStakingPoolContract; export const useFeeContract = pool.useFeeContract; export const useFlatRateCommissionContract = pool.useFlatRateCommissionContract; -export const useGasTaxCommissionContract = pool.useGasTaxCommissionContract; export const useStakingPoolFactoryContract = pool.useStakingPoolFactoryContract; diff --git a/apps/staking/src/services/contracts/pool.ts b/apps/staking/src/services/contracts/pool.ts index fcbc1279..a2590092 100644 --- a/apps/staking/src/services/contracts/pool.ts +++ b/apps/staking/src/services/contracts/pool.ts @@ -9,27 +9,25 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import { useEffect, useState } from 'react'; import { - StakingPoolImpl__factory, - StakingPoolImpl, Fee, Fee__factory, - StakingPoolFactoryImpl, - StakingPoolFactoryImpl__factory, FlatRateCommission, FlatRateCommission__factory, - GasTaxCommission, - GasTaxCommission__factory, + StakingPoolFactoryImpl, + StakingPoolFactoryImpl__factory, + StakingPoolImpl, + StakingPoolImpl__factory, } from '@cartesi/staking-pool'; +import { useEffect, useState } from 'react'; -import mainnet from '@cartesi/staking-pool/export/abi/mainnet.json'; import goerli from '@cartesi/staking-pool/export/abi/goerli.json'; +import mainnet from '@cartesi/staking-pool/export/abi/mainnet.json'; import localhost from './localhost.json'; -import { ChainMap, useContract, useContractFromAddress } from '.'; import { useWallet } from '@explorer/wallet'; +import { ChainMap, useContract, useContractFromAddress } from '.'; const abis: ChainMap = { 1: mainnet, @@ -80,21 +78,3 @@ export const useFlatRateCommissionContract = ( feeAddress ); }; - -export const useGasTaxCommissionContract = ( - address: string -): GasTaxCommission => { - const [feeAddress, setFeeAddress] = useState(); - const pool = useStakingPoolContract(address); - - useEffect(() => { - if (pool) { - pool.fee().then(setFeeAddress); - } - }, [address, pool]); - - return useContractFromAddress( - GasTaxCommission__factory.connect, - feeAddress - ); -}; diff --git a/apps/staking/src/services/pool.ts b/apps/staking/src/services/pool.ts index 725a6256..bbb362f4 100644 --- a/apps/staking/src/services/pool.ts +++ b/apps/staking/src/services/pool.ts @@ -14,7 +14,6 @@ import { useEffect, useState } from 'react'; import { useFeeContract, useFlatRateCommissionContract, - useGasTaxCommissionContract, useStakingPoolContract, } from './contracts'; import { useBlockNumber } from './eth'; @@ -410,38 +409,3 @@ export const useFlatRateCommission = (address: string) => { transaction, }; }; - -export const useGasTaxCommission = (address: string) => { - const fee = useGasTaxCommissionContract(address); - const [gas, setGas] = useState(undefined); - const [maxRaise, setMaxRaise] = useState(undefined); - const [timeoutTimestamp, setTimeoutTimestamp] = useState(undefined); - const [raiseTimeout, setRaiseTimeout] = useState(undefined); - const transaction = useTransaction(); - - useEffect(() => { - if (fee) { - fee.gas().then(setGas); - fee.feeRaiseTimeout().then(setRaiseTimeout); - fee.maxRaise().then(setMaxRaise); - fee.timeoutTimestamp().then((ts) => - setTimeoutTimestamp(new Date(ts.toNumber() * 1000)) - ); - } - }, [fee]); - - const changeGas = (gas: number) => { - if (fee) { - transaction.set(fee.setGas(gas)); - } - }; - - return { - gas, - maxRaise, - timeoutTimestamp, - raiseTimeout, - changeGas, - transaction, - }; -}; diff --git a/apps/staking/src/services/poolFactory.ts b/apps/staking/src/services/poolFactory.ts index eae7554d..182235d9 100644 --- a/apps/staking/src/services/poolFactory.ts +++ b/apps/staking/src/services/poolFactory.ts @@ -26,9 +26,7 @@ export const useStakingPoolFactory = () => { // result is pool address taken from transaction event if (receipt.events) { const event = receipt.events.find( - (e) => - e.event == 'NewFlatRateCommissionStakingPool' || - e.event == 'NewGasTaxCommissionStakingPool' + (e) => e.event == 'NewFlatRateCommissionStakingPool' ); if (event && event.args && event.args.length > 0) { return event.args[0]; diff --git a/apps/staking/src/services/staking.ts b/apps/staking/src/services/staking.ts index 8a9c0888..033c94ae 100644 --- a/apps/staking/src/services/staking.ts +++ b/apps/staking/src/services/staking.ts @@ -9,10 +9,10 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import { useState, useEffect } from 'react'; import { BigNumber, BigNumberish, constants } from 'ethers'; -import { useBlockNumber } from './eth'; +import { useEffect, useState } from 'react'; import { useStakingContract } from './contracts'; +import { useBlockNumber } from './eth'; import { useTransaction } from './transaction'; export const useStaking = (user: string) => { diff --git a/apps/staking/src/stories/pools/fee/CommissionForm.stories.tsx b/apps/staking/src/stories/pools/fee/CommissionForm.stories.tsx index 280d3765..d5af36a1 100644 --- a/apps/staking/src/stories/pools/fee/CommissionForm.stories.tsx +++ b/apps/staking/src/stories/pools/fee/CommissionForm.stories.tsx @@ -9,8 +9,7 @@ // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A // PARTICULAR PURPOSE. See the GNU General Public License for more details. -import React from 'react'; -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { ComponentMeta, ComponentStory } from '@storybook/react'; import CommissionForm from '../../../components/pools/fee/CommissionForm'; @@ -53,16 +52,3 @@ IncreaseLocked.args = { helperText: 'Commission is set as a fixed percentage of every block reward (CTSI)', }; - -export const GasTax = Template.bind({}); -GasTax.args = { - currentValue: 210000, - unit: 'gas', - min: 0, - maxRaise: 20000, - maxDigits: 0, - increaseWaitPeriod: 60 * 60 * 24 * 7, // 7 days - nextIncrease: new Date(now.getTime() - 60 * 1000), - helperText: - 'Commission is set as an amount of gas. This amount is converted to CTSI at the time of block production, by using a gas price from an oracle and a ETH/CTSI price from a price oracle.', -}; diff --git a/apps/staking/src/utils/labels.ts b/apps/staking/src/utils/labels.ts index 58b82c32..60362eef 100644 --- a/apps/staking/src/utils/labels.ts +++ b/apps/staking/src/utils/labels.ts @@ -28,8 +28,6 @@ const labels = { 'Total amount of CTSI locked in the staking contract, currently in the status "staked"', flatRateCommission: 'This pool charges a flat rate CTSI commission over every block reward', - gasTaxCommission: - 'This pool charges a variable rate CTSI commission over every block reward', }; export default labels; diff --git a/apps/staking/src/utils/messages.tsx b/apps/staking/src/utils/messages.tsx index 9cb87b20..b891dae0 100644 --- a/apps/staking/src/utils/messages.tsx +++ b/apps/staking/src/utils/messages.tsx @@ -88,10 +88,6 @@ const messages = { howItWorks: () => `This model calculates the commission as a fixed percentage of the block CTSI reward before distributing the remaining amount to the pool users.`, }, - gasBased: { - howItWorks: () => - `This model calculates the commission considering the current network gas price, Ethereum price and CTSI price. The configured amount of gas above is multiplied by the gas price provided by a ChainLink oracle, then converted from ETH to CTSI using an Uniswap V2 price oracle.`, - }, }, }, pool: {