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

Fixing dev 2 #498

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions apps/web/components/Forms/ProposalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,25 +162,6 @@ export const ProposalForm = ({

const chainIdFromPath = useChainIdFromPath();

const { data: thresholdFromContract } = useContractRead({
address: strategy.id as Address,
abi: cvStrategyABI,
chainId: chainIdFromPath,
functionName: "calculateThreshold",
args: [
requestedAmount ? parseUnits(requestedAmount, tokenGarden.decimals) : 0n,
],
enabled:
requestedAmount !== undefined &&
PoolTypes[strategy?.config?.proposalType] === "funding",
});

const thresholdPct = calculatePercentageBigInt(
thresholdFromContract as bigint,
BigInt(strategy.maxCVSupply),
tokenGarden?.decimals ?? 18,
);

const disableSubmitBtn = useMemo<ConditionObject[]>(
() => [
{
Expand All @@ -193,12 +174,6 @@ export const ProposalForm = ({
const { isConnected, missmatchUrl, tooltipMessage } =
useDisableButtons(disableSubmitBtn);

const spendingLimitString = formatTokenAmount(
spendingLimit,
+tokenGarden?.decimals,
6,
);

const proposalTypeName = PoolTypes[proposalType];

const createProposal = async () => {
Expand Down Expand Up @@ -264,9 +239,37 @@ export const ProposalForm = ({
chainId,
});

const spendingLimitString = formatTokenAmount(
spendingLimit,
poolToken?.decimals ?? 0,
Mati0x marked this conversation as resolved.
Show resolved Hide resolved
6,
);

const INPUT_TOKEN_MIN_VALUE = 1 / 10 ** (poolToken?.decimals ?? 0);

const spendingLimitNumber = spendingLimit / 10 ** (poolToken?.decimals ?? 0);

const { data: thresholdFromContract } = useContractRead({
address: strategy.id as Address,
abi: cvStrategyABI,
chainId: chainIdFromPath,
functionName: "calculateThreshold",
args: [
requestedAmount ?
parseUnits(requestedAmount, poolToken?.decimals ?? 0)
: 0n,
],
enabled:
requestedAmount !== undefined &&
PoolTypes[strategy?.config?.proposalType] === "funding",
});

const thresholdPct = calculatePercentageBigInt(
thresholdFromContract as bigint,
BigInt(strategy.maxCVSupply),
poolToken?.decimals ?? 18,
);

if (!poolToken && PoolTypes[proposalType] === "funding") {
return (
<div className="m-40">
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/PoolHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default function PoolHeader({
"Spending limit",
"Min threshold",
"Min conviction",
"Pool staked cap",
"Max voting weight",
].includes(config.label),
)
: PoolTypes[proposalType] === "signaling" ?
Expand All @@ -260,7 +260,7 @@ export default function PoolHeader({
),
)
: PointSystems[pointSystem] === "capped" ? poolConfig
: poolConfig.filter((config) => config.label !== "Pool staked cap");
: poolConfig.filter((config) => config.label !== "Max voting weight");

//hooks
const { data: isCouncilMember } = useContractRead({
Expand Down
Loading