Skip to content

Commit 5cfc1bb

Browse files
CopilotCorantin
andcommitted
Fix type mismatch for MemberStrategyData arrays
Co-authored-by: Corantin <[email protected]>
1 parent 67130df commit 5cfc1bb

File tree

2 files changed

+27
-42
lines changed

2 files changed

+27
-42
lines changed

apps/web/components/PoolGovernance.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,7 @@ export const PoolGovernance: React.FC<PoolGovernanceProps> = ({
167167
type MemberColumn = Column<MemberStrategyData>;
168168

169169
const PoolGovernanceDetails: React.FC<{
170-
membersStrategyData: {
171-
id: string;
172-
activatedPoints: string;
173-
totalStakedPoints: string;
174-
member: {
175-
memberCommunity: {
176-
memberAddress: string;
177-
}[];
178-
stakes: {
179-
amount: string;
180-
proposal: {
181-
proposalStatus: string;
182-
};
183-
}[];
184-
};
185-
}[];
170+
membersStrategyData: MemberStrategyData[];
186171
}> = ({ membersStrategyData }) => {
187172
const columns: MemberColumn[] = [
188173
{

apps/web/components/Proposals.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ export type MemberStrategyData = {
6868
memberCommunity?: {
6969
isRegistered: boolean;
7070
memberAddress: string;
71-
};
71+
}[];
7272
stakes?: {
7373
amount: string;
7474
proposal: {
7575
proposalStatus: number;
7676
};
77-
};
77+
}[];
7878
};
7979
totalStakedPoints: string;
8080
};
@@ -138,7 +138,7 @@ export function Proposals({
138138
const [allocationView, setAllocationView] = useState(false);
139139
const [inputAllocatedTokens, setInputAllocatedTokens] = useState<bigint>(0n);
140140
const [inputs, setInputs] = useState<{ [key: string]: ProposalInputItem }>(
141-
{}
141+
{},
142142
);
143143
const [stakedFilters, setStakedFilters] = useState<{
144144
[key: string]: ProposalInputItem;
@@ -165,7 +165,7 @@ export function Proposals({
165165
if (inst) proposalCardRefs.current.set(id, inst);
166166
else proposalCardRefs.current.delete(id); // cleanup on unmount
167167
},
168-
[]
168+
[],
169169
);
170170

171171
// Queries
@@ -205,7 +205,7 @@ export function Proposals({
205205
{ topic: "member", id: wallet, containerId: strategy.poolId },
206206
],
207207
enabled: !!wallet,
208-
}
208+
},
209209
);
210210

211211
const { data: membersStrategyData } =
@@ -226,7 +226,7 @@ export function Proposals({
226226
});
227227

228228
const memberActivatedPoints: bigint = BigInt(
229-
memberStrategyData?.memberStrategy?.activatedPoints ?? 0
229+
memberStrategyData?.memberStrategy?.activatedPoints ?? 0,
230230
);
231231

232232
// Contract reads
@@ -250,7 +250,7 @@ export function Proposals({
250250
},
251251
() => {
252252
return refetchMemberPower();
253-
}
253+
},
254254
);
255255
return () => {
256256
if (subscritionId.current) {
@@ -265,7 +265,7 @@ export function Proposals({
265265
const memberActivatedStrategy =
266266
memberStrategyData?.memberStrategy?.activatedPoints > 0n;
267267
const memberTokensInCommunity = BigInt(
268-
memberData?.member?.memberCommunity?.[0]?.stakedTokens ?? 0
268+
memberData?.member?.memberCommunity?.[0]?.stakedTokens ?? 0,
269269
);
270270

271271
const proposals = strategy.proposals.sort((a, b) => {
@@ -291,13 +291,13 @@ export function Proposals({
291291
?.filter(
292292
(stake) =>
293293
stake.proposal.strategy.id.toLowerCase() ===
294-
strategy.id.toLowerCase()
294+
strategy.id.toLowerCase(),
295295
)
296296
.map((x) => ({ ...x, amount: BigInt(x.amount) })) ?? [];
297297

298298
const totalStaked = stakesFiltered.reduce(
299299
(acc, curr) => acc + curr.amount,
300-
0n
300+
0n,
301301
);
302302

303303
const memberStakes: { [key: string]: ProposalInputItem } = {};
@@ -318,7 +318,7 @@ export function Proposals({
318318
}));
319319
console.info(
320320
"[Proposals][SupportSnapshot]",
321-
supportSnapshot.length ? supportSnapshot : "No active support positions"
321+
supportSnapshot.length ? supportSnapshot : "No active support positions",
322322
);
323323
}
324324

@@ -355,15 +355,15 @@ export function Proposals({
355355
];
356356

357357
const disableManageSupportButton = disableManageSupportBtnCondition.some(
358-
(cond) => cond.condition
358+
(cond) => cond.condition,
359359
);
360360

361361
const { tooltipMessage, isConnected, missmatchUrl } = useDisableButtons(
362-
disableManageSupportBtnCondition
362+
disableManageSupportBtnCondition,
363363
);
364364

365365
const { tooltipMessage: createProposalTooltipMessage } = useDisableButtons(
366-
disableCreateProposalBtnCondition
366+
disableCreateProposalBtnCondition,
367367
);
368368

369369
useEffect(() => {
@@ -442,7 +442,7 @@ export function Proposals({
442442

443443
const getProposalsInputsDifferences = (
444444
inputData: { [key: string]: ProposalInputItem },
445-
currentData: { [key: string]: ProposalInputItem }
445+
currentData: { [key: string]: ProposalInputItem },
446446
) => {
447447
// log maximum stakable tokens
448448
return Object.values(inputData).reduce<
@@ -527,7 +527,7 @@ export function Proposals({
527527

528528
const proposalsDifferencesArr = getProposalsInputsDifferences(
529529
inputs,
530-
stakedFilters
530+
stakedFilters,
531531
);
532532
if (process.env.NODE_ENV !== "production") {
533533
console.info("[Proposals][Allocate] Current inputs snapshot", {
@@ -548,7 +548,7 @@ export function Proposals({
548548
});
549549
}
550550
const abiTypes = parseAbiParameters(
551-
"(uint256 proposalId, int256 deltaSupport)[]"
551+
"(uint256 proposalId, int256 deltaSupport)[]",
552552
);
553553
const encodedData = encodeAbiParameters(abiTypes, [
554554
proposalsDifferencesArr,
@@ -564,14 +564,14 @@ export function Proposals({
564564
// Computed values
565565
const memberSupportedProposalsPct = calculatePercentageBigInt(
566566
inputAllocatedTokens,
567-
memberActivatedPoints
567+
memberActivatedPoints,
568568
);
569569

570570
const memberPoolWeight =
571571
memberPower != null && +strategy.totalEffectiveActivePoints > 0
572572
? calculatePercentageBigInt(
573573
memberPower,
574-
BigInt(strategy.totalEffectiveActivePoints)
574+
BigInt(strategy.totalEffectiveActivePoints),
575575
)
576576
: undefined;
577577

@@ -614,7 +614,7 @@ export function Proposals({
614614
(x) =>
615615
ProposalStatus[x.proposalStatus] === "cancelled" ||
616616
ProposalStatus[x.proposalStatus] === "rejected" ||
617-
ProposalStatus[x.proposalStatus] === "executed"
617+
ProposalStatus[x.proposalStatus] === "executed",
618618
);
619619

620620
const membersStrategies = membersStrategyData?.memberStrategies;
@@ -633,20 +633,20 @@ export function Proposals({
633633

634634
// Create a record of proposal convictions with proposal ID as keys
635635
const proposalConvictionMap = Array.from(
636-
proposalCardRefs.current.entries()
636+
proposalCardRefs.current.entries(),
637637
).reduce((acc, [id, proposal]) => {
638638
acc[id] = proposal.getProposalConviction();
639639
return acc;
640640
}, {} as Record<string, ReturnType<ProposalHandle["getProposalConviction"]>>);
641641

642642
const totalSupport = Object.values(proposalConvictionMap).reduce(
643643
(acc, proposal) => acc + proposal.support || 0,
644-
0
644+
0,
645645
);
646646

647647
const totalConviction = Object.values(proposalConvictionMap).reduce(
648648
(acc, proposal) => acc + proposal.conviction || 0n,
649-
0n
649+
0n,
650650
);
651651

652652
let rows = activeOrDisputedProposals.map((proposal) => {
@@ -665,12 +665,12 @@ export function Proposals({
665665
: "0%";
666666
const conviction = formatUnits(
667667
proposalConvictionMap[proposal.id]?.conviction || 0n,
668-
tokenDecimals
668+
tokenDecimals,
669669
);
670670
const convictionPercent =
671671
calculatePercentageBigInt(
672672
proposalConvictionMap[proposal.id]?.conviction || 0n,
673-
totalConviction
673+
totalConviction,
674674
) + "%";
675675
const threshold = proposalConvictionMap[proposal.id]?.threshold || 0;
676676
return [
@@ -712,7 +712,7 @@ export function Proposals({
712712
const activeOrDisputedProposals = proposals.filter(
713713
(x) =>
714714
ProposalStatus[x.proposalStatus] === "active" ||
715-
ProposalStatus[x.proposalStatus] === "disputed"
715+
ProposalStatus[x.proposalStatus] === "disputed",
716716
);
717717

718718
// Render

0 commit comments

Comments
 (0)