diff --git a/packages/round-manager/src/context/application/usePayout.ts b/packages/round-manager/src/context/application/usePayout.ts index 5496a9da1f..5f509187a0 100644 --- a/packages/round-manager/src/context/application/usePayout.ts +++ b/packages/round-manager/src/context/application/usePayout.ts @@ -6,7 +6,7 @@ import { } from "../../types/generated/typechain"; import { BigNumber, ethers } from "ethers"; import { waitForSubgraphSyncTo } from "../../features/api/subgraph"; -import { PayoutTokens } from "../../features/api/payoutTokens"; +import { PayoutToken } from "../../features/api/payoutTokens"; export function usePayout() { const [contractApproveSpendStatus, setContractApproveSpendStatus] = @@ -71,7 +71,7 @@ export function usePayout() { type Args = { address: string; signer: ethers.Signer; - token: PayoutTokens; + token: PayoutToken; projectId: string; applicationIndex: number; payoutStrategyAddress: string; diff --git a/packages/round-manager/src/context/round/FundContractContext.tsx b/packages/round-manager/src/context/round/FundContractContext.tsx index 44cb0a2b5b..a74d4845ce 100644 --- a/packages/round-manager/src/context/round/FundContractContext.tsx +++ b/packages/round-manager/src/context/round/FundContractContext.tsx @@ -13,7 +13,7 @@ import { waitForSubgraphSyncTo } from "../../features/api/subgraph"; import { ProgressStatus } from "../../features/api/types"; -import { PayoutTokens } from "../../features/api/payoutTokens"; +import { PayoutToken } from "../../features/api/payoutTokens"; export interface FundContractState { tokenApprovalStatus: ProgressStatus; @@ -31,14 +31,14 @@ export interface FundContractState { export type FundContractParams = { roundId: string; fundAmount: number; - payoutToken: PayoutTokens; + payoutToken: PayoutToken; }; interface SubmitFundParams { signer: Signer; context: FundContractState; roundId: string; - payoutToken: PayoutTokens; + payoutToken: PayoutToken; fundAmount: number; } @@ -180,7 +180,7 @@ async function _fundContract({ async function approveTokenForFunding( signerOrProvider: Signer, roundId: string, - token: PayoutTokens, + token: PayoutToken, amount: number, context: FundContractState ): Promise { @@ -204,7 +204,7 @@ async function approveTokenForFunding( async function fund( signerOrProvider: Signer, roundId: string, - token: PayoutTokens, + token: PayoutToken, fundAmount: number, context: FundContractState ): Promise { diff --git a/packages/round-manager/src/features/api/application.ts b/packages/round-manager/src/features/api/application.ts index 27833a8699..8666a23f62 100644 --- a/packages/round-manager/src/features/api/application.ts +++ b/packages/round-manager/src/features/api/application.ts @@ -19,7 +19,7 @@ import { Signer } from "@ethersproject/abstract-signer"; import { Web3Provider } from "@ethersproject/providers"; import { graphql_fetch } from "common"; import { DirectPayoutStrategy__factory } from "../../types/generated/typechain"; -import { PayoutTokens } from "./payoutTokens"; +import { PayoutToken } from "./payoutTokens"; // import { verifyApplicationMetadata } from "common/src/verification"; // import { fetchProjectOwners } from "common/src/registry"; @@ -485,7 +485,7 @@ export const updateApplicationList = async ( export const fundRoundContract = async ( roundId: string, signer: Signer, - payoutToken: PayoutTokens, + payoutToken: PayoutToken, amount: BigNumber ): Promise<{ txBlockNumber: number; txHash: string }> => { // checksum conversion diff --git a/packages/round-manager/src/features/api/payoutTokens.ts b/packages/round-manager/src/features/api/payoutTokens.ts index 86484c9937..bee2d86cbb 100644 --- a/packages/round-manager/src/features/api/payoutTokens.ts +++ b/packages/round-manager/src/features/api/payoutTokens.ts @@ -1,7 +1,7 @@ import { ChainId, RedstoneTokenIds } from "common"; import { ethers } from "ethers"; -export type PayoutTokens = { +export type PayoutToken = { name: string; chainId: number; address: string; @@ -24,7 +24,7 @@ export const TokenNamesAndLogos = { MATIC: "/logos/pol-logo.svg", CVP: "/logos/power-pool.png", // PowerPool } as const; -const MAINNET_TOKENS: PayoutTokens[] = [ +const MAINNET_TOKENS: PayoutToken[] = [ { name: "DAI", chainId: ChainId.MAINNET, @@ -50,7 +50,7 @@ const MAINNET_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["CVP"], }, ]; -const OPTIMISM_MAINNET_TOKENS: PayoutTokens[] = [ +const OPTIMISM_MAINNET_TOKENS: PayoutToken[] = [ { name: "DAI", chainId: ChainId.OPTIMISM_MAINNET_CHAIN_ID, @@ -68,7 +68,7 @@ const OPTIMISM_MAINNET_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["ETH"], }, ]; -const FANTOM_MAINNET_TOKENS: PayoutTokens[] = [ +const FANTOM_MAINNET_TOKENS: PayoutToken[] = [ { name: "WFTM", chainId: ChainId.FANTOM_MAINNET_CHAIN_ID, @@ -110,7 +110,7 @@ const FANTOM_MAINNET_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["DAI"], // We use DAI for the price }, ]; -const FANTOM_TESTNET_TOKENS: PayoutTokens[] = [ +const FANTOM_TESTNET_TOKENS: PayoutToken[] = [ { name: "DAI", chainId: ChainId.FANTOM_TESTNET_CHAIN_ID, @@ -128,7 +128,7 @@ const FANTOM_TESTNET_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["FTM"], }, ]; -const PGN_TESTNET_TOKENS: PayoutTokens[] = [ +const PGN_TESTNET_TOKENS: PayoutToken[] = [ { name: "TEST", chainId: ChainId.PGN_TESTNET, @@ -144,7 +144,7 @@ const PGN_TESTNET_TOKENS: PayoutTokens[] = [ decimal: 18, }, ]; -const PGN_MAINNET_TOKENS: PayoutTokens[] = [ +const PGN_MAINNET_TOKENS: PayoutToken[] = [ { name: "ETH", chainId: ChainId.PGN, @@ -170,7 +170,7 @@ const PGN_MAINNET_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["DAI"], }, ]; -const ARBITRUM_GOERLI_TOKENS: PayoutTokens[] = [ +const ARBITRUM_GOERLI_TOKENS: PayoutToken[] = [ { name: "ETH", chainId: ChainId.ARBITRUM_GOERLI, @@ -180,7 +180,7 @@ const ARBITRUM_GOERLI_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["ETH"], }, ]; -const ARBITRUM_TOKENS: PayoutTokens[] = [ +const ARBITRUM_TOKENS: PayoutToken[] = [ { name: "ETH", chainId: ChainId.ARBITRUM, @@ -206,7 +206,7 @@ const ARBITRUM_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["ARB"], }, ]; -const AVALANCHE_TOKENS: PayoutTokens[] = [ +const AVALANCHE_TOKENS: PayoutToken[] = [ { name: "AVAX", chainId: ChainId.AVALANCHE, @@ -224,7 +224,7 @@ const AVALANCHE_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["USDC"], }, ]; -const FUJI_TOKENS: PayoutTokens[] = [ +const FUJI_TOKENS: PayoutToken[] = [ { name: "AVAX", chainId: ChainId.FUJI, @@ -242,7 +242,7 @@ const FUJI_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["USDC"], }, ]; -const POLYGON_TOKENS: PayoutTokens[] = [ +const POLYGON_TOKENS: PayoutToken[] = [ { name: "MATIC", chainId: ChainId.POLYGON, @@ -260,7 +260,7 @@ const POLYGON_TOKENS: PayoutTokens[] = [ redstoneTokenId: RedstoneTokenIds["USDC"], }, ]; -const POLYGON_MUMBAI_TOKENS: PayoutTokens[] = [ +const POLYGON_MUMBAI_TOKENS: PayoutToken[] = [ { name: "MATIC", chainId: ChainId.POLYGON_MUMBAI, @@ -293,7 +293,7 @@ export const payoutTokens = [ ...POLYGON_MUMBAI_TOKENS, ]; -export const getPayoutTokenOptions = (chainId: ChainId): PayoutTokens[] => { +export const getPayoutTokenOptions = (chainId: ChainId): PayoutToken[] => { const tokens = payoutTokens.filter((token) => token.chainId === chainId); return tokens.length > 0 ? tokens : MAINNET_TOKENS; }; diff --git a/packages/round-manager/src/features/round/QuadraticFundingForm.tsx b/packages/round-manager/src/features/round/QuadraticFundingForm.tsx index 278aa55eff..b34dbbff6b 100644 --- a/packages/round-manager/src/features/round/QuadraticFundingForm.tsx +++ b/packages/round-manager/src/features/round/QuadraticFundingForm.tsx @@ -24,7 +24,7 @@ import { Round } from "../api/types"; import { useWallet } from "../common/Auth"; import { FormStepper } from "../common/FormStepper"; import { FormContext } from "../common/FormWizard"; -import { getPayoutTokenOptions, PayoutTokens } from "../api/payoutTokens"; +import { getPayoutTokenOptions, PayoutToken } from "../api/payoutTokens"; interface QuadraticFundingFormProps { stepper: typeof FormStepper; } @@ -95,7 +95,7 @@ export default function QuadraticFundingForm(props: QuadraticFundingFormProps) { }; const { chain } = useWallet(); - const payoutTokenOptions: PayoutTokens[] = [ + const payoutTokenOptions: PayoutToken[] = [ { name: "Choose Payout Token", chainId: chain.id, @@ -288,7 +288,7 @@ function LeftSidebar() { function PayoutTokenButton(props: { errors: FieldErrors; - token?: PayoutTokens; + token?: PayoutToken; }) { const { token } = props; return ( @@ -353,7 +353,7 @@ function PayoutTokenDropdown(props: { register: UseFormRegisterReturn; errors: FieldErrors; control: Control; - payoutTokenOptions: PayoutTokens[]; + payoutTokenOptions: PayoutToken[]; }) { const { field } = useController({ name: "token", @@ -463,7 +463,7 @@ function MatchingFundsAvailable(props: { register: UseFormRegisterReturn; errors: FieldErrors; token: string; - payoutTokenOptions: PayoutTokens[]; + payoutTokenOptions: PayoutToken[]; }) { // not sure why UseFormRegisterReturn only takes strings for react-hook-form return ( @@ -522,7 +522,7 @@ function MatchingCap(props: { errors: FieldErrors; control?: Control; token: string; - payoutTokenOptions: PayoutTokens[]; + payoutTokenOptions: PayoutToken[]; }) { const { field: matchingCapField } = useController({ name: "roundMetadata.quadraticFundingConfig.matchingCap", diff --git a/packages/round-manager/src/features/round/ViewFundGrantees.tsx b/packages/round-manager/src/features/round/ViewFundGrantees.tsx index 7e30c7b120..621475709b 100644 --- a/packages/round-manager/src/features/round/ViewFundGrantees.tsx +++ b/packages/round-manager/src/features/round/ViewFundGrantees.tsx @@ -26,7 +26,7 @@ import InfoModal from "../common/InfoModal"; import ProgressModal from "../common/ProgressModal"; import { Spinner } from "../common/Spinner"; import { assertAddress } from "common/src/address"; -import { PayoutTokens, payoutTokens } from "../api/payoutTokens"; +import { PayoutToken, payoutTokens } from "../api/payoutTokens"; export default function ViewFundGrantees(props: { round: Round | undefined; @@ -100,7 +100,7 @@ function FinalizedRoundContent(props: { round: Round }) { const [unpaidProjects, setUnpaidProjects] = useState([]); const [price, setPrice] = useState(0); - const matchingFundPayoutToken: PayoutTokens = payoutTokens.filter( + const matchingFundPayoutToken: PayoutToken = payoutTokens.filter( (t) => t.address.toLowerCase() == props.round.token.toLowerCase() )[0]; @@ -184,7 +184,7 @@ function FinalizedRoundContent(props: { round: Round }) { // TODO: Add types export function PayProjectsTable(props: { projects: MatchingStatsData[]; - token: PayoutTokens; + token: PayoutToken; price: number; round: Round; allProjects: MatchingStatsData[]; @@ -513,7 +513,7 @@ export function PayProjectsTable(props: { export function PaidProjectsTable(props: { projects: MatchingStatsData[]; chainId: number; - token: PayoutTokens; + token: PayoutToken; price: number; }) { // todo: such a nice table should be in a separate and shared file