From befcfc17cc21ffa6e29292178331b74717cd2d18 Mon Sep 17 00:00:00 2001 From: 0xKurt Date: Fri, 13 Sep 2024 15:08:43 +0200 Subject: [PATCH] Fix DG --- .../round-manager/src/context/application/usePayout.ts | 9 ++++++--- .../src/features/round/ApplicationDirectPayout.tsx | 3 ++- packages/round-manager/src/features/round/usePayouts.tsx | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/round-manager/src/context/application/usePayout.ts b/packages/round-manager/src/context/application/usePayout.ts index f6f658fb3..1b7ddba38 100644 --- a/packages/round-manager/src/context/application/usePayout.ts +++ b/packages/round-manager/src/context/application/usePayout.ts @@ -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"; @@ -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, diff --git a/packages/round-manager/src/features/round/ApplicationDirectPayout.tsx b/packages/round-manager/src/features/round/ApplicationDirectPayout.tsx index 05e4dfc31..4ecdf5ce0 100644 --- a/packages/round-manager/src/features/round/ApplicationDirectPayout.tsx +++ b/packages/round-manager/src/features/round/ApplicationDirectPayout.tsx @@ -20,6 +20,7 @@ import { TToken, getPayoutTokens, getTokenByChainIdAndAddress, + getChainById, } from "common"; import { errorModalDelayMs } from "../../constants"; import { usePayouts } from "./usePayouts"; @@ -395,7 +396,7 @@ export default function ApplicationDirectPayout({ round, application }: Props) { diff --git a/packages/round-manager/src/features/round/usePayouts.tsx b/packages/round-manager/src/features/round/usePayouts.tsx index 0ea286bd5..fc22400b9 100644 --- a/packages/round-manager/src/features/round/usePayouts.tsx +++ b/packages/round-manager/src/features/round/usePayouts.tsx @@ -1,5 +1,6 @@ import { DataLayer } from "data-layer"; import useSWR from "swr"; +import { zeroAddress } from "viem"; export function usePayouts(args: { chainId: number; @@ -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, @@ -45,6 +46,12 @@ export function usePayouts(args: { }; }); + if (!args.roundId.startsWith("0x")) { + mappedPayouts = mappedPayouts.filter( + (p) => p.tokenAddress !== zeroAddress + ); + } + return mappedPayouts; } );