From 6a383a1f6d348bb540ed147276377caaa55cefcd Mon Sep 17 00:00:00 2001 From: Tim Escher Date: Mon, 31 Oct 2022 16:58:40 -0800 Subject: [PATCH] Add currency/contract mapping --- .../src/components/pages/Bounties/Form/FormFields.tsx | 5 +++-- .../react-app/src/components/pages/Bounties/index.tsx | 6 +++--- packages/react-app/src/constants/currency.ts | 11 +++++++++++ packages/react-app/src/types/index.ts | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 packages/react-app/src/constants/currency.ts diff --git a/packages/react-app/src/components/pages/Bounties/Form/FormFields.tsx b/packages/react-app/src/components/pages/Bounties/Form/FormFields.tsx index ff245dde..582ef106 100644 --- a/packages/react-app/src/components/pages/Bounties/Form/FormFields.tsx +++ b/packages/react-app/src/components/pages/Bounties/Form/FormFields.tsx @@ -17,9 +17,10 @@ import { required, validNonNegativeDecimal, } from '@app/utils/formUtils'; +import ALLOWED_CURRENCIES from '@app/constants/currency'; const useCurrencies = (): string[] => { - return ['BANK']; + return ALLOWED_CURRENCIES; }; const PLACEHOLDERS = { @@ -33,7 +34,7 @@ export const bountyFormFieldValues = { title: '', description: '', reward: '1000', - currency: 'BANK', + currency: ALLOWED_CURRENCIES[0], criteria: '', dueAt: new Date().toISOString(), }; diff --git a/packages/react-app/src/components/pages/Bounties/index.tsx b/packages/react-app/src/components/pages/Bounties/index.tsx index 7b2a6779..4d3bf85b 100644 --- a/packages/react-app/src/components/pages/Bounties/index.tsx +++ b/packages/react-app/src/components/pages/Bounties/index.tsx @@ -210,7 +210,7 @@ const SelectExport = ({ }); } } > - Parcel.money format (only claimed bounties) + Parcel.money format { @@ -218,14 +218,14 @@ const SelectExport = ({ handleCSV(); } } > - Limited data (CSV format) + CSV format { handleJSON(); } } > - All data (JSON format) + JSON format diff --git a/packages/react-app/src/constants/currency.ts b/packages/react-app/src/constants/currency.ts new file mode 100644 index 00000000..d1a790b5 --- /dev/null +++ b/packages/react-app/src/constants/currency.ts @@ -0,0 +1,11 @@ +export const ALLOWED_CURRENCY_CONTRACTS = { + BANK: '0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198', + ETH: 'ETH', + USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + BTC: '', +}; + +export const ALLOWED_CURRENCIES = Object.keys(ALLOWED_CURRENCY_CONTRACTS); + +export default ALLOWED_CURRENCIES; diff --git a/packages/react-app/src/types/index.ts b/packages/react-app/src/types/index.ts index f8f66335..66dd8e90 100644 --- a/packages/react-app/src/types/index.ts +++ b/packages/react-app/src/types/index.ts @@ -1,2 +1,3 @@ // Extract the string values of an object as a union of typescript string literals export type ObjectValues> = T[keyof T]; +export type ObjectKeys> = keyof T;