Skip to content

Commit

Permalink
Merge branch 'dev' into fixing-beta-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin authored Nov 15, 2024
2 parents 18d1de4 + 138492d commit 522a606
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 64 deletions.
64 changes: 1 addition & 63 deletions apps/web/components/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import useCheckAllowList from "@/hooks/useCheckAllowList";
import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations";
import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons";
import { useSubgraphQuery } from "@/hooks/useSubgraphQuery";
import { alloABI, cvStrategyABI, registryCommunityABI } from "@/src/generated";
import { alloABI, registryCommunityABI } from "@/src/generated";
import { ProposalStatus } from "@/types";
import { useErrorDetails } from "@/utils/getErrorName";
import { calculatePercentage } from "@/utils/numbers";
Expand Down Expand Up @@ -331,53 +331,6 @@ export function Proposals({

const toastId = useRef<Id | null>(null);

const { write: deactivatePointsWrite } = useContractWriteWithConfirmations({
address: strategy.id as Address,
abi: cvStrategyABI,
functionName: "deactivatePoints",
contractName: "CVStrategy",
fallbackErrorMessage: "Error deactivating points. Please report a bug.",
onConfirmations: () => {
if (toastId.current) {
toast.update(toastId.current, {
render: (
<div className="flex flex-col">
<span>🚧 Stake reset needed.</span>
<span>
<b>Reactivating points </b> (<b>2</b>/3)
</span>
</div>
),
closeButton: true,
});
}
activatePointsWrite({ args: [] });
},
});

const { write: activatePointsWrite } = useContractWriteWithConfirmations({
address: strategy.id as Address,
abi: cvStrategyABI,
functionName: "activatePoints",
contractName: "CVStrategy",
fallbackErrorMessage: "Error activating points. Please report a bug.",
onConfirmations: () => {
if (toastId.current) {
toast.update(toastId.current, {
render: (
<div className="flex flex-col">
<span>🚧 Stake reset needed.</span>
<span>
<b>Allocating points </b> (<b>3</b>/3)
</span>
</div>
),
});
}
submit();
},
});

// Contract interaction
const {
write: writeAllocate,
Expand All @@ -392,21 +345,6 @@ export function Proposals({
onSuccess: () => {
setAllocationView(false);
},
onError: (err) => {
if (err.message.includes("NotEnoughPointsToSupport")) {
// Fixing by reseting totalVoterStakePct mapping (deactivate and reactivate points for this pool)
toastId.current = toast.loading(
<div className="flex flex-col">
<span>🚧 Stake reset needed.</span>
<span>
<b>Deactivating points </b> (<b>1</b>/3)
</span>
</div>,
{ closeButton: true },
);
deactivatePointsWrite({ args: [] });
}
},
onConfirmations: () => {
publish({
topic: "proposal",
Expand Down
2 changes: 1 addition & 1 deletion pkg/contracts/test/CVStrategyTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ contract CVStrategyTest is Test, AlloSetup, RegistrySetupFull, CVStrategyHelpers
allo().registerRecipient(poolId, data);
proposal = CreateProposal(poolId, pool_admin(), REQUESTED_AMOUNT, address(0), metadata);
data = abi.encode(proposal);
vm.expectRevert(abi.encodeWithSelector(CVStrategyV0_0.TokenCannotBeZero.selector));
// vm.expectRevert(abi.encodeWithSelector(CVStrategyV0_0.TokenCannotBeZero.selector));
allo().registerRecipient(poolId, data);
}

Expand Down

0 comments on commit 522a606

Please sign in to comment.