Skip to content

Commit

Permalink
Remove unnecessary ABI, fix additional typos
Browse files Browse the repository at this point in the history
  • Loading branch information
solimander committed Feb 10, 2023
1 parent be0e4d7 commit 2e87dff
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ contract NounsDAOLogicV2InflationHandling40TotalSupplyTest is NounsDAOLogicV2Inf
propose(user1, address(0), 0, '', '');
}

function testAllowsProposingIfAboveTreshold() public {
function testAllowsProposingIfAboveThreshold() public {
// Give user1 3 tokens, proposal requires 3
vm.startPrank(tokenHolder);
nounsToken.transferFrom(tokenHolder, user1, 1);
Expand Down
1 change: 0 additions & 1 deletion packages/nouns-sdk/src/contract/streamfactory.abi.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
opacity: 0.75 !important;
font-weight: 500;
transition: ease-in-out 125ms;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ModalBottomButtonRow from '../../../ModalBottomButtonRow';
import ModalTitle from '../../../ModalTitle';
import config from '../../../../config';
import {
formatTokenAmmount,
formatTokenAmount,
getTokenAddressForCurrency,
usePredictStreamAddress,
} from '../../../../utils/streamingPaymentUtils/streamingPaymentUtils';
Expand All @@ -24,7 +24,7 @@ const StreamPaymentsReviewStep: React.FC<FinalProposalActionStepProps> = props =
msgSender: config.addresses.nounsDaoExecutor,
payer: config.addresses.nounsDaoExecutor,
recipient: state.address,
tokenAmount: formatTokenAmmount(state.amount, state.TransferFundsCurrency),
tokenAmount: formatTokenAmount(state.amount, state.TransferFundsCurrency),
tokenAddress: getTokenAddressForCurrency(state.TransferFundsCurrency),
startTime: state.streamStartTimestamp,
endTime: state.streamEndTimestamp,
Expand Down
20 changes: 9 additions & 11 deletions packages/nouns-webapp/src/components/StreamWithdrawModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ import ModalTitle from '../ModalTitle';
import config from '../../config';
import { contract2humanUSDCFormat } from '../../utils/usdcUtils';
import { ethers } from 'ethers';
import { useEthers } from '@usedapp/core/dist/cjs/src';
import {
useEllapsedTime,
useStreamRemaningBalance,
useElapsedTime,
useStreamRemainingBalance,
useWithdrawTokens,
} from '../../wrappers/nounsStream';
import ModalBottomButtonRow from '../ModalBottomButtonRow';
import BrandSpinner from '../BrandSpinner';
import BrandNumericEntry from '../BrandNumericEntry';
import SolidColorBackgroundModal from '../SolidColorBackgroundModal';
import StartOrEndTime from '../StartOrEndTime';
import { formatTokenAmmount } from '../../utils/streamingPaymentUtils/streamingPaymentUtils';
import { formatTokenAmount } from '../../utils/streamingPaymentUtils/streamingPaymentUtils';
import { SupportedCurrency } from '../ProposalActionsModal/steps/TransferFundsDetailsStep';
import ModalLabel from '../ModalLabel';
import { countDecimals } from '../../utils/numberUtils';
Expand Down Expand Up @@ -48,13 +47,12 @@ const StreamWithdrawModalOverlay: React.FC<{

const isUSDC = tokenAddress.toLowerCase() === config.addresses.usdcToken?.toLowerCase();
const unitForDisplay = isUSDC ? 'USDC' : 'WETH';
const { account } = useEthers();

const withdrawableBalance = useStreamRemaningBalance(streamAddress ?? '', account ?? '') ?? 0;
const withdrawableBalance = useStreamRemainingBalance(streamAddress ?? '') ?? 0;
const { withdrawTokens, withdrawTokensState } = useWithdrawTokens(streamAddress ?? '');
const [withdrawAmount, setWithdrawAmount] = useState<number>(0);
const [isLoading, setIsLoading] = useState(false);
const elapsedTime = useEllapsedTime(streamAddress ?? '');
const elapsedTime = useElapsedTime(streamAddress ?? '');

const [percentStreamedSoFar, setPercentStreamedSoFar] = useState(0);

Expand Down Expand Up @@ -112,7 +110,7 @@ const StreamWithdrawModalOverlay: React.FC<{
);
}

const humanUnitsStreamRemaningBalance = parseFloat(
const humanUnitsStreamRemainingBalance = parseFloat(
isUSDC
? contract2humanUSDCFormat(withdrawableBalance?.toString() ?? '', true)
: ethers.utils.formatUnits(withdrawableBalance?.toString() ?? '').toString(),
Expand Down Expand Up @@ -162,7 +160,7 @@ const StreamWithdrawModalOverlay: React.FC<{
setWithdrawAmount(e.floatValue ?? 0);
}}
placeholder={isUSDC ? '0 USDC' : '0 WETH'}
isInvalid={withdrawAmount > humanUnitsStreamRemaningBalance}
isInvalid={withdrawAmount > humanUnitsStreamRemainingBalance}
/>
{/* Hover brightness */}
<div
Expand All @@ -188,13 +186,13 @@ const StreamWithdrawModalOverlay: React.FC<{
onNextBtnClick={async () => {
setIsLoading(true);
withdrawTokens(
formatTokenAmmount(
formatTokenAmount(
withdrawAmount.toString(),
isUSDC ? SupportedCurrency.USDC : SupportedCurrency.WETH,
),
);
}}
isNextBtnDisabled={withdrawableBalance !== 0 && humanUnitsStreamRemaningBalance === 0}
isNextBtnDisabled={withdrawableBalance !== 0 && humanUnitsStreamRemainingBalance === 0}
/>
<div className={classes.streamTimeWrapper}>
Stream <StartOrEndTime startTime={startTime} endTime={endTime} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import StreamFactoryABI from '../utils/streamingPaymentUtils/streamFactory.abi.j
import wethABIJSON from '../utils/wethUtils/weth.abi.json';
import payerABIJSON from '../utils/payerContractUtils/payerABI.json';
import {
formatTokenAmmount,
formatTokenAmount,
getTokenAddressForCurrency,
} from '../utils/streamingPaymentUtils/streamingPaymentUtils';

Expand Down Expand Up @@ -48,7 +48,7 @@ export default function useStreamPaymentTransactions({
]),
calldata: abi._encodeParams(abi.functions[fundStreamFunction ?? '']?.inputs ?? [], [
state.address,
formatTokenAmmount(state.amount, state.TransferFundsCurrency),
formatTokenAmount(state.amount, state.TransferFundsCurrency),
getTokenAddressForCurrency(state.TransferFundsCurrency),
state.streamStartTimestamp,
state.streamEndTimestamp,
Expand Down
24 changes: 0 additions & 24 deletions packages/nouns-webapp/src/locales/en-US.po
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ msgstr "Auction ends in"
msgid "Available to withdraw"
msgstr "Available to withdraw"

#: src/components/StreamWithdrawModal/index.tsx
#~ msgid "Avilable to withdraw"
#~ msgstr "Avilable to withdraw"

#: src/components/ProposalActionsModal/steps/FunctionCallEnterArgsStep/index.tsx
#: src/components/ProposalActionsModal/steps/FunctionCallReviewStep/index.tsx
#: src/components/ProposalActionsModal/steps/FunctionCallSelectFunctionStep/index.tsx
Expand Down Expand Up @@ -460,10 +456,6 @@ msgstr "Download the Free iOS App"
msgid "Dynamic Threshold"
msgstr "Dynamic Threshold"

#: src/components/DynamicQuorumInfoModal/index.tsx
#~ msgid "Dynamic Treshold"
#~ msgstr "Dynamic Treshold"

#: src/components/Banner/index.tsx
msgid "EVERY DAY,"
msgstr "EVERY DAY,"
Expand Down Expand Up @@ -731,10 +723,6 @@ msgstr "Nounder's Reward"
msgid "Nounders receive rewards in the form of Nouns (10% of supply for first 5 years)."
msgstr "Nounders receive rewards in the form of Nouns (10% of supply for first 5 years)."

#: src/components/Documentation/index.tsx
#~ msgid "Nounders will proveably revoke this veto right when they deem it safe to do so. This decision will be based on a healthy Noun distribution and a community that is engaged in the governance process."
#~ msgstr "Nounders will proveably revoke this veto right when they deem it safe to do so. This decision will be based on a healthy Noun distribution and a community that is engaged in the governance process."

#: src/pages/Nounders/index.tsx
msgid "Nounders' Reward"
msgstr "Nounders' Reward"
Expand Down Expand Up @@ -821,10 +809,6 @@ msgstr "Only 32x32 PNG images are accepted"
msgid "Only Nouns you owned or were delegated to you before {0} are eligible to vote."
msgstr "Only Nouns you owned or were delegated to you before {0} are eligible to vote."

#: src/pages/Vote/index.tsx
#~ msgid "Only visable to you"
#~ msgstr "Only visable to you"

#: src/pages/Vote/index.tsx
msgid "Only visible to you"
msgstr "Only visible to you"
Expand Down Expand Up @@ -1104,10 +1088,6 @@ msgstr "The Nouns community has undertaken a preliminary exploration of proposal
msgid "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. It increases linearly as a function of the % of Nouns voting against a prop, varying between Min Threshold and Max Threshold."
msgstr "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. It increases linearly as a function of the % of Nouns voting against a prop, varying between Min Threshold and Max Threshold."

#: src/components/DynamicQuorumInfoModal/index.tsx
#~ msgid "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. It increases linearly as a function of the % of Nouns voting against a prop, varying between Min Treshold and Max Treshold."
#~ msgstr "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. It increases linearly as a function of the % of Nouns voting against a prop, varying between Min Treshold and Max Treshold."

#: src/components/DynamicQuorumInfoModal/index.tsx
msgid "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. The number of For votes required to pass Proposal {0} is given by the following curve:"
msgstr "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. The number of For votes required to pass Proposal {0} is given by the following curve:"
Expand Down Expand Up @@ -1416,10 +1396,6 @@ msgstr "You've successfully voted on on prop {0}"
msgid "You've successfully withdrawn {widthdrawAmount} {unitForDisplay} to your wallet"
msgstr "You've successfully withdrawn {widthdrawAmount} {unitForDisplay} to your wallet"

#: src/components/StreamWithdrawModal/index.tsx
#~ msgid "You've successfully withrawn {0} {unitForDisplay} to your wallet"
#~ msgstr "You've successfully withrawn {0} {unitForDisplay} to your wallet"

#: src/components/ChangeDelegatePannel/index.tsx
msgid "Your <0>{availableVotes}</0> votes are being delegated to a new account."
msgstr "Your <0>{availableVotes}</0> votes are being delegated to a new account."
Expand Down
24 changes: 0 additions & 24 deletions packages/nouns-webapp/src/locales/ja-JP.po
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ msgstr "オークション終了まで"
msgid "Available to withdraw"
msgstr ""

#: src/components/StreamWithdrawModal/index.tsx
#~ msgid "Avilable to withdraw"
#~ msgstr ""

#: src/components/ProposalActionsModal/steps/FunctionCallEnterArgsStep/index.tsx
#: src/components/ProposalActionsModal/steps/FunctionCallReviewStep/index.tsx
#: src/components/ProposalActionsModal/steps/FunctionCallSelectFunctionStep/index.tsx
Expand Down Expand Up @@ -465,10 +461,6 @@ msgstr ""
msgid "Dynamic Threshold"
msgstr ""

#: src/components/DynamicQuorumInfoModal/index.tsx
#~ msgid "Dynamic Treshold"
#~ msgstr ""

#: src/components/Banner/index.tsx
msgid "EVERY DAY,"
msgstr "毎日"
Expand Down Expand Up @@ -736,10 +728,6 @@ msgstr "Nounderへの報酬"
msgid "Nounders receive rewards in the form of Nouns (10% of supply for first 5 years)."
msgstr "Nounderには、Nounsという形で報酬が与えられます (最初の5年間は供給量の10%)。"

#: src/components/Documentation/index.tsx
#~ msgid "Nounders will proveably revoke this veto right when they deem it safe to do so. This decision will be based on a healthy Noun distribution and a community that is engaged in the governance process."
#~ msgstr "Nounderは、安全であると判断した場合、この拒否権を無効にすることが出来ます。この決定は、健全なNounの分布と、ガバナンスプロセスに関与しているコミュニティに基づいて行われます。"

#: src/pages/Nounders/index.tsx
msgid "Nounders' Reward"
msgstr "Nounderへの報酬"
Expand Down Expand Up @@ -826,10 +814,6 @@ msgstr "32x32 PNG画像のみ受け付けています"
msgid "Only Nouns you owned or were delegated to you before {0} are eligible to vote."
msgstr "投票できるのは {0} 以前に所有していた、または委任されたNounsのみです。"

#: src/pages/Vote/index.tsx
#~ msgid "Only visable to you"
#~ msgstr ""

#: src/pages/Vote/index.tsx
msgid "Only visible to you"
msgstr ""
Expand Down Expand Up @@ -1109,10 +1093,6 @@ msgstr ""
msgid "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. It increases linearly as a function of the % of Nouns voting against a prop, varying between Min Threshold and Max Threshold."
msgstr ""

#: src/components/DynamicQuorumInfoModal/index.tsx
#~ msgid "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. It increases linearly as a function of the % of Nouns voting against a prop, varying between Min Treshold and Max Treshold."
#~ msgstr ""

#: src/components/DynamicQuorumInfoModal/index.tsx
msgid "The Threshold (minimum number of For votes required to pass a proposal) is set as a function of the number of Against votes a proposal has received. The number of For votes required to pass Proposal {0} is given by the following curve:"
msgstr ""
Expand Down Expand Up @@ -1421,10 +1401,6 @@ msgstr "あなたは提案 {0} に投票することに成功しました。"
msgid "You've successfully withdrawn {withdrawAmount} {unitForDisplay} to your wallet"
msgstr ""

#: src/components/StreamWithdrawModal/index.tsx
#~ msgid "You've successfully withrawn {0} {unitForDisplay} to your wallet"
#~ msgstr ""

#: src/components/ChangeDelegatePannel/index.tsx
msgid "Your <0>{availableVotes}</0> votes are being delegated to a new account."
msgstr "あなたは<0>{availableVotes}</0>アカウントに委任されています"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function usePredictStreamAddress({
return predictedAddress?.toString();
}

export function formatTokenAmmount(amount?: string, currency?: SupportedCurrency) {
export function formatTokenAmount(amount?: string, currency?: SupportedCurrency) {
const amt = amount ?? '0';
switch (currency) {
case SupportedCurrency.USDC:
Expand Down
4 changes: 2 additions & 2 deletions packages/nouns-webapp/src/wrappers/nounsStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import streamABI from '../utils/streamingPaymentUtils/stream.abi.json';

const abi = new utils.Interface(streamABI);

export const useStreamRemaningBalance = (streamAddress: string, userAddress: string) => {
export const useStreamRemainingBalance = (streamAddress: string) => {

const [balance] =
useContractCall<[BigNumber]>({
Expand All @@ -25,7 +25,7 @@ export const useWithdrawTokens = (streamAddress: string) => {
return { withdrawTokens, withdrawTokensState };
};

export const useEllapsedTime = (streamAddress: string) => {
export const useElapsedTime = (streamAddress: string) => {

const [elapsedTime] =
useContractCall<[BigNumber]>({
Expand Down

0 comments on commit 2e87dff

Please sign in to comment.