Skip to content

Commit 68ca7a6

Browse files
vacekjgravityblast
andauthored
fix op dai (gitcoinco#2218)
* chore: add logging when tx failed * fix: reload the payout token on change * fix: reload the payout token on change * fix: reload the payout token on change * chore: remove eslint ignore * chore: remove eslint ignore * chore: remove eslint ignore --------- Co-authored-by: Andrea Franz <andrea@gravityblast.com>
1 parent 589ca44 commit 68ca7a6

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

packages/grant-explorer/src/checkoutStore.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,21 @@ export const useCheckoutStore = create<CheckoutState>()(
262262
: undefined
263263
);
264264

265+
if (receipt.status === "reverted") {
266+
console.error(
267+
`vote on chain ${chainId} - roundIds ${Object.keys(
268+
donations.map((d) => d.roundId)
269+
)}, token ${token.name}`,
270+
receipt,
271+
sig,
272+
token
273+
);
274+
275+
throw new Error("vote failed", {
276+
cause: receipt,
277+
});
278+
}
279+
265280
console.log(
266281
"Voting succesful for chain",
267282
chainId,

packages/grant-explorer/src/features/round/ViewCartPage/CartWithProjects.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
getPayoutTokenOptions,
44
GroupedCartProjectsByRoundId,
55
} from "../../api/utils";
6-
import React, { useState } from "react";
6+
import React, { useEffect, useState } from "react";
77
import { PayoutToken } from "../../api/types";
88
import { PayoutTokenDropdown } from "./PayoutTokenDropdown";
99
import { ApplyTooltip } from "./ApplyTooltip";
@@ -39,6 +39,19 @@ export function CartWithProjects({ cart, chainId }: Props) {
3939
// get number of projects in cartByRound
4040
const projectCount = cartByRound.reduce((acc, curr) => acc + curr.length, 0);
4141

42+
/** The payout token data (like permit version etc.) might've changed since the user last visited the page
43+
* Refresh it to update, default to the first payout token if the previous token was deleted */
44+
useEffect(() => {
45+
setPayoutTokenForChain(
46+
chainId,
47+
getPayoutTokenOptions(chainId).find(
48+
(token) => token.address === selectedPayoutToken.address
49+
) ?? getPayoutTokenOptions(chainId)[0]
50+
);
51+
/* We only want this to happen on first render */
52+
// eslint-disable-next-line react-hooks/exhaustive-deps
53+
}, [chainId]);
54+
4255
return (
4356
<div className="grow block px-[16px] py-4 bg-white">
4457
<div className="flex flex-col md:flex-row justify-between border-b-2 pb-2 gap-3 mb-6">

0 commit comments

Comments
 (0)