Skip to content

Commit

Permalink
Merge pull request #3648 from gitcoinco/dg-safe
Browse files Browse the repository at this point in the history
Fix DG
  • Loading branch information
thelostone-mc authored Sep 13, 2024
2 parents c764691 + befcfc1 commit 446d95e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 6 additions & 3 deletions packages/round-manager/src/context/application/usePayout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ProgressStatus, ProgressStep } from "../../features/api/types";
import { Erc20__factory } from "../../types/generated/typechain";
import { Allo, TToken } from "common";
import { Hex } from "viem";
import { Allo, NATIVE, TToken } from "common";
import { Hex, zeroAddress } from "viem";
import { datadogRum } from "@datadog/browser-rum";
import { datadogLogs } from "@datadog/browser-logs";
import { useState } from "react";
Expand Down Expand Up @@ -111,7 +111,10 @@ export function usePayout() {
await allo
.payoutDirectGrants({
roundId: roundId,
token: token.address,
token:
token.address === zeroAddress
? (NATIVE as `0x${string}`)
: token.address,
amount: payoutAmount,
recipientAddress: payoutWallet,
recipientId: applicationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
TToken,
getPayoutTokens,
getTokenByChainIdAndAddress,
getChainById,
} from "common";
import { errorModalDelayMs } from "../../constants";
import { usePayouts } from "./usePayouts";
Expand Down Expand Up @@ -395,7 +396,7 @@ export default function ApplicationDirectPayout({ round, application }: Props) {
</span>
<a
target="_blank"
href={`${chain?.blockExplorers?.default.url}/tx/${payout.txnHash}`}
href={`${getChainById(chain.id).blockExplorer}/tx/${payout.txnHash}`}
className="inline items-center ml-2"
rel="noreferrer"
>
Expand Down
9 changes: 8 additions & 1 deletion packages/round-manager/src/features/round/usePayouts.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DataLayer } from "data-layer";
import useSWR from "swr";
import { zeroAddress } from "viem";

export function usePayouts(args: {
chainId: number;
Expand Down Expand Up @@ -35,7 +36,7 @@ export function usePayouts(args: {
result.applications[0]
.applicationsPayoutsByChainIdAndRoundIdAndApplicationId;

const mappedPayouts = payouts.map((payout) => {
let mappedPayouts = payouts.map((payout) => {
return {
applicationIndex: Number(result.applications[0].id),
amount: payout.amount,
Expand All @@ -45,6 +46,12 @@ export function usePayouts(args: {
};
});

if (!args.roundId.startsWith("0x")) {
mappedPayouts = mappedPayouts.filter(
(p) => p.tokenAddress !== zeroAddress
);
}

return mappedPayouts;
}
);
Expand Down

0 comments on commit 446d95e

Please sign in to comment.