diff --git a/packages/nouns-contracts/test/foundry/governance/InflationHandling.t.sol b/packages/nouns-contracts/test/foundry/governance/InflationHandling.t.sol index c382c1997d..8b9d075231 100644 --- a/packages/nouns-contracts/test/foundry/governance/InflationHandling.t.sol +++ b/packages/nouns-contracts/test/foundry/governance/InflationHandling.t.sol @@ -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); diff --git a/packages/nouns-sdk/src/contract/streamfactory.abi.json b/packages/nouns-sdk/src/contract/streamfactory.abi.json deleted file mode 100644 index 0f89f34c46..0000000000 --- a/packages/nouns-sdk/src/contract/streamfactory.abi.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"_streamImplementation","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DurationMustBePositive","type":"error"},{"inputs":[],"name":"PayerIsAddressZero","type":"error"},{"inputs":[],"name":"RecipientIsAddressZero","type":"error"},{"inputs":[],"name":"TokenAmountIsZero","type":"error"},{"inputs":[],"name":"TokenAmountLessThanDuration","type":"error"},{"inputs":[],"name":"UnexpectedStreamAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"msgSender","type":"address"},{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stopTime","type":"uint256"},{"indexed":false,"internalType":"address","name":"streamAddress","type":"address"}],"name":"StreamCreated","type":"event"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"}],"name":"createAndFundStream","outputs":[{"internalType":"address","name":"stream","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"},{"internalType":"uint8","name":"nonce","type":"uint8"}],"name":"createStream","outputs":[{"internalType":"address","name":"stream","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"},{"internalType":"address","name":"predictedStreamAddress","type":"address"}],"name":"createStream","outputs":[{"internalType":"address","name":"stream","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"}],"name":"createStream","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"}],"name":"createStream","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"msgSender","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"}],"name":"predictStreamAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"msgSender","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"stopTime","type":"uint256"},{"internalType":"uint8","name":"nonce","type":"uint8"}],"name":"predictStreamAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"streamImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/StreamPaymentsReviewStep.module.css b/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/StreamPaymentsReviewStep.module.css index ff401f4f1e..2e30b4405d 100644 --- a/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/StreamPaymentsReviewStep.module.css +++ b/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/StreamPaymentsReviewStep.module.css @@ -5,4 +5,4 @@ opacity: 0.75 !important; font-weight: 500; transition: ease-in-out 125ms; -} \ No newline at end of file +} diff --git a/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/index.tsx b/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/index.tsx index 76c5ad63e1..b524e34a22 100644 --- a/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/index.tsx +++ b/packages/nouns-webapp/src/components/ProposalActionsModal/steps/StreamPaymentsReviewStep/index.tsx @@ -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'; @@ -24,7 +24,7 @@ const StreamPaymentsReviewStep: React.FC = 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, diff --git a/packages/nouns-webapp/src/components/StreamWithdrawModal/index.tsx b/packages/nouns-webapp/src/components/StreamWithdrawModal/index.tsx index cbb4b69e97..7bee96e3ee 100644 --- a/packages/nouns-webapp/src/components/StreamWithdrawModal/index.tsx +++ b/packages/nouns-webapp/src/components/StreamWithdrawModal/index.tsx @@ -7,10 +7,9 @@ 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'; @@ -18,7 +17,7 @@ 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'; @@ -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(0); const [isLoading, setIsLoading] = useState(false); - const elapsedTime = useEllapsedTime(streamAddress ?? ''); + const elapsedTime = useElapsedTime(streamAddress ?? ''); const [percentStreamedSoFar, setPercentStreamedSoFar] = useState(0); @@ -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(), @@ -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 */}
{ setIsLoading(true); withdrawTokens( - formatTokenAmmount( + formatTokenAmount( withdrawAmount.toString(), isUSDC ? SupportedCurrency.USDC : SupportedCurrency.WETH, ), ); }} - isNextBtnDisabled={withdrawableBalance !== 0 && humanUnitsStreamRemaningBalance === 0} + isNextBtnDisabled={withdrawableBalance !== 0 && humanUnitsStreamRemainingBalance === 0} />
Stream diff --git a/packages/nouns-webapp/src/hooks/useStreamPaymentTransactions.ts b/packages/nouns-webapp/src/hooks/useStreamPaymentTransactions.ts index 138566e4c3..25e28261d4 100644 --- a/packages/nouns-webapp/src/hooks/useStreamPaymentTransactions.ts +++ b/packages/nouns-webapp/src/hooks/useStreamPaymentTransactions.ts @@ -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'; @@ -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, diff --git a/packages/nouns-webapp/src/locales/en-US.po b/packages/nouns-webapp/src/locales/en-US.po index 7736c89c33..023c80e509 100644 --- a/packages/nouns-webapp/src/locales/en-US.po +++ b/packages/nouns-webapp/src/locales/en-US.po @@ -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 @@ -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," @@ -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" @@ -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" @@ -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:" @@ -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} votes are being delegated to a new account." msgstr "Your <0>{availableVotes} votes are being delegated to a new account." diff --git a/packages/nouns-webapp/src/locales/ja-JP.po b/packages/nouns-webapp/src/locales/ja-JP.po index f40427d46c..a9f930e87f 100644 --- a/packages/nouns-webapp/src/locales/ja-JP.po +++ b/packages/nouns-webapp/src/locales/ja-JP.po @@ -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 @@ -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 "毎日" @@ -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への報酬" @@ -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 "" @@ -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 "" @@ -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} votes are being delegated to a new account." msgstr "あなたは<0>{availableVotes}アカウントに委任されています" diff --git a/packages/nouns-webapp/src/utils/streamingPaymentUtils/streamingPaymentUtils.ts b/packages/nouns-webapp/src/utils/streamingPaymentUtils/streamingPaymentUtils.ts index a18d612af2..cd1fb10c09 100644 --- a/packages/nouns-webapp/src/utils/streamingPaymentUtils/streamingPaymentUtils.ts +++ b/packages/nouns-webapp/src/utils/streamingPaymentUtils/streamingPaymentUtils.ts @@ -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: diff --git a/packages/nouns-webapp/src/wrappers/nounsStream.ts b/packages/nouns-webapp/src/wrappers/nounsStream.ts index c0c400448b..c650bee709 100644 --- a/packages/nouns-webapp/src/wrappers/nounsStream.ts +++ b/packages/nouns-webapp/src/wrappers/nounsStream.ts @@ -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]>({ @@ -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]>({