Skip to content

Commit

Permalink
chore: removed code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny Chung committed Apr 20, 2022
1 parent e9b97cd commit 29f3ea3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import styled from 'styled-components';
import { Input } from 'components/Guilds/common/Form/Input';
import Avatar from 'components/Guilds/Avatar';
import { useEffect, useMemo } from 'react';
import { useEffect } from 'react';
import { ActionEditorProps } from '..';
import { BigNumber, ethers } from 'ethers';
import { ethers } from 'ethers';
import useENSAvatar from 'hooks/Guilds/ether-swr/ens/useENSAvatar';
import { Box } from 'components/Guilds/common/Layout';
import { shortenAddress, MAINNET_ID } from 'utils';
Expand All @@ -12,10 +12,9 @@ import { ReactComponent as Info } from '../../../../../assets/images/info.svg';
import StyledIcon from 'components/Guilds/common/SVG';
import useBigNumberToNumber from 'hooks/Guilds/conversions/useBigNumberToNumber';
import { useState } from 'react';
import { useERC20Info } from 'hooks/Guilds/ether-swr/erc20/useERC20Info';
import { useGuildConfig } from 'hooks/Guilds/ether-swr/guild/useGuildConfig';
import { useParams } from 'react-router-dom';
import NumericalInput from 'components/Guilds/common/Form/NumericalInput';
import { useTotalSupply } from 'hooks/Guilds/guild/useTotalSupply';
import { useTokenData } from 'hooks/Guilds/guild/useTokenData';

const Control = styled(Box)`
display: flex;
Expand Down Expand Up @@ -50,28 +49,14 @@ const RepMintInput = styled(NumericalInput)`
}
`;

interface REPMintState {
toAddress: string;
amount: BigNumber;
}

const Mint: React.FC<ActionEditorProps> = ({ decodedCall, updateCall }) => {
// parse transfer state from calls
const [repPercent, setRepPercent] = useState(0);
const [repAmount, setRepAmount] = useState(0);
const { guild_id: guildId } =
useParams<{ chain_name?: string; guild_id?: string }>();
const { data } = useGuildConfig(guildId);
const { data: tokenData } = useERC20Info(data?.token);
const totalSupply = useBigNumberToNumber(tokenData?.totalSupply, 18);
const { parsedData } = useTotalSupply({ decodedCall });
const { tokenData } = useTokenData();

const parsedData = useMemo<REPMintState>(() => {
if (!decodedCall) return null;
return {
toAddress: decodedCall.args.to,
amount: decodedCall.args.amount,
};
}, [decodedCall]);
const totalSupply = useBigNumberToNumber(tokenData?.totalSupply, 18);

const { imageUrl } = useENSAvatar(parsedData?.toAddress, MAINNET_ID);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
import Avatar from 'components/Guilds/Avatar';
import useENSAvatar from 'hooks/Guilds/ether-swr/ens/useENSAvatar';
import { useMemo } from 'react';
import { FiArrowRight } from 'react-icons/fi';
import { MAINNET_ID, shortenAddress } from 'utils';
import { ActionViewProps } from '..';
import { Segment } from '../common/infoLine';
import { ReactComponent as Mint } from '../../../../../assets/images/mint.svg';
import StyledIcon from 'components/Guilds/common/SVG';
import styled from 'styled-components';
import { BigNumber } from 'ethers';
import useBigNumberToNumber from 'hooks/Guilds/conversions/useBigNumberToNumber';
import { useERC20Info } from 'hooks/Guilds/ether-swr/erc20/useERC20Info';
import { useGuildConfig } from 'hooks/Guilds/ether-swr/guild/useGuildConfig';
import { useParams } from 'react-router-dom';
import { useTotalSupply } from 'hooks/Guilds/guild/useTotalSupply';
import { useTokenData } from 'hooks/Guilds/guild/useTokenData';

const StyledMintIcon = styled(StyledIcon)`
margin: 0;
`;

interface REPMintState {
guildAddress: string;
toAddress: string;
amount: BigNumber;
}

const REPMintInfoLine: React.FC<ActionViewProps> = ({ decodedCall }) => {
const { guild_id: guildId } =
useParams<{ chain_name?: string; guild_id?: string }>();
const { data } = useGuildConfig(guildId);
const { data: tokenData } = useERC20Info(data?.token);
const { parsedData } = useTotalSupply({ decodedCall });
const { tokenData } = useTokenData();

const totalSupply = useBigNumberToNumber(tokenData?.totalSupply, 18);

const parsedData = useMemo<REPMintState>(() => {
if (!decodedCall) return null;
return {
guildAddress: decodedCall.to,
toAddress: decodedCall.args.to,
amount: decodedCall.args.amount,
};
}, [decodedCall]);
const { ensName, imageUrl } = useENSAvatar(parsedData?.toAddress, MAINNET_ID);

const roundedRepAmount = useBigNumberToNumber(parsedData?.amount, 16, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Segment } from '../common/infoLine';
import { DetailCell, DetailHeader, DetailRow } from '../common/summary';
import { useTotalSupply } from 'hooks/Guilds/guild/useTotalSupply';
import { useTokenData } from 'hooks/Guilds/guild/useTokenData';

const REPMintSummary: React.FC<ActionViewProps> = ({ decodedCall }) => {
const { parsedData } = useTotalSupply({ decodedCall });
const { tokenData } = useTokenData();
Expand Down

0 comments on commit 29f3ea3

Please sign in to comment.