import { useState } from "react"; import { encodeFunctionData } from 'viem'; import { Box, Typography, TableRow, TableCell, useTheme } from "@mui/material"; import Modal from "../../../../components/Modal/Modal"; import { PrimaryButton, TertiaryButton } from "../../../../components/Button"; import { GHOST_GOVERNANCE_ADDRESSES } from "../../../../constants/addresses"; import { abi as GovernorAbi } from "../../../../abi/GhostGovernor.json"; import { ArgumentInput, ParsedCell } from "./index"; export const prepareSetProposalThresholdCalldata = (chainId, newThreshold) => { const value = 0n; const label = "setProposalThreshold"; const target = GHOST_GOVERNANCE_ADDRESSES[chainId]; const calldata = encodeFunctionData({ abi: GovernorAbi, functionName: 'setProposalThreshold', args: [newThreshold] }); return { label, target, calldata, value }; } export const prepareSetProposalThresholdDescription = "updates the minimum amount required to create a proposal. This threshold applies only when there are no Active or Pending proposals; otherwise, a higher threshold is enforced."; export const SetProposalThresholdParsed = (props) => { const [isOpened, setIsOpened] = useState(false); return ( <> View setProposalThreshold } open={isOpened} onClose={() => setIsOpened(false)} maxWidth="460px" minHeight="80px" > ) } export const SetProposalThresholdSteps = ({ chainId, toInitialStep, addCalldata, args }) => { const createMode = args === undefined; const [newThreshold, setNewThreshold] = useState(args?.at(0)); const handleProceed = () => { addCalldata(prepareSetProposalThresholdCalldata(chainId, newThreshold)); } return ( {}} tooltip="The new proposal threshold defines the minimum amount each proposer must lock for the duration of the proposal. This locked amount serves as the required deposit to create a proposal." /> {createMode && Back Next handleProceed()} fullWidth > Create Function } ); }