Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for missing bigNumberValue on ethValue while creating proposal from template #1528

Merged
merged 9 commits into from
Apr 11, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ITokenAllocations {
setFieldValue: (field: string, value: any) => void;
addressErrorMessage: string | null;
amountErrorMessage: string | null;
amountInputValue: BigNumber | undefined;
amountInputValue?: BigNumber | null;
allocationLength: number;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ProposalBuilder/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CreateProposalTransaction } from '../../types/proposalBuilder';

export const DEFAULT_PROPOSAL_TRANSACTION: CreateProposalTransaction = {
targetAddress: '',
ethValue: { value: '', bigNumberValue: undefined },
ethValue: { value: '', bigNumberValue: null },
functionName: '',
parameters: [
{
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/forms/BigNumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import { BigNumberValuePair } from '../../../types';
export interface BigNumberInputProps
extends Omit<InputElementProps, 'value' | 'onChange'>,
FormControlOptions {
value: BigNumber | undefined;
value?: BigNumber | null;
onChange: (value: BigNumberValuePair) => void;
decimalPlaces?: number;
min?: string;
max?: string;
maxValue?: BigNumber;
maxValue?: BigNumber | null;
}
/**
* This component will add a chakra Input component that accepts and sets a BigNumber
Expand Down Expand Up @@ -82,7 +82,7 @@ export function BigNumberInput({
if (stringValue === '') {
onChange({
value: stringValue,
bigNumberValue: undefined,
bigNumberValue: null,
});
setInputValue('');
return;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/modals/ForkProposalTemplateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function ForkProposalTemplateModal({
`${DAO_ROUTES.proposalTemplateNew.relative(
addressPrefix,
targetDAOAddress,
)}?templatesHash=${proposalTemplatesHash}&templateIndex=${templateIndex}`,
)}&templatesHash=${proposalTemplatesHash}&templateIndex=${templateIndex}`,
);
onClose();
};
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/DAO/proposal/usePrepareProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export function usePrepareProposal() {

return {
targets,
values: transactionsWithEncoding.map(transaction => transaction.ethValue.bigNumberValue!),
values: transactionsWithEncoding.map(
transaction => transaction.ethValue.bigNumberValue || 0,
),
calldatas: transactionsWithEncoding.map(transaction => transaction.calldata || ''),
metaData: {
title: proposalMetadata.title,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/utils/useApproval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTransaction } from './useTransaction';
const useApproval = (
tokenContract?: VotesERC20 | VotesERC20Wrapper,
spenderAddress?: string,
userBalance?: BigNumber,
userBalance?: BigNumber | null,
) => {
const { address: account } = useAccount();
const [allowance, setAllowance] = useState(BigNumber.from(0));
Expand Down
2 changes: 1 addition & 1 deletion src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BigNumber } from 'ethers';

export interface BigNumberValuePair {
value: string;
bigNumberValue?: BigNumber;
bigNumberValue?: BigNumber | null;
}

export type WithError = { error?: string };