Skip to content

Commit

Permalink
Add currency/contract mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
tescher committed Nov 1, 2022
1 parent 6a7a504 commit 6a383a1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -33,7 +34,7 @@ export const bountyFormFieldValues = {
title: '',
description: '',
reward: '1000',
currency: 'BANK',
currency: ALLOWED_CURRENCIES[0],
criteria: '',
dueAt: new Date().toISOString(),
};
Expand Down
6 changes: 3 additions & 3 deletions packages/react-app/src/components/pages/Bounties/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,22 +210,22 @@ const SelectExport = ({
});
} }
>
Parcel.money format (only claimed bounties)
Parcel.money format
</MenuItem>
<MenuItem
onClick={ () => {
setCsvFormat(BOUNTY_LIMITED_EXPORT_ITEMS);
handleCSV();
} }
>
Limited data (CSV format)
CSV format
</MenuItem>
<MenuItem
onClick={ () => {
handleJSON();
} }
>
All data (JSON format)
JSON format
</MenuItem>
</MenuList>
</Menu>
Expand Down
11 changes: 11 additions & 0 deletions packages/react-app/src/constants/currency.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions packages/react-app/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// Extract the string values of an object as a union of typescript string literals
export type ObjectValues<T extends Record<string, string>> = T[keyof T];
export type ObjectKeys<T extends Record<string, string>> = keyof T;

0 comments on commit 6a383a1

Please sign in to comment.