Skip to content

Commit

Permalink
update deposits and withdrawals to display correct erc20 symbol (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shramp authored Mar 14, 2023
1 parent 74a9661 commit 81e7798
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Box, Link, Tooltip, Typography } from '@mui/material'
import React, { FC, useContext } from 'react'
import { GnosisSafeContext } from '../contexts'
import { TDeposit } from '../types'
import { getSymbolFromContactAddress } from '../utils/ercTokens'

const precision = 10 ** 6
const locale = 'en-US'
Expand Down Expand Up @@ -41,7 +42,7 @@ export const Deposit: FC<TProps> = ({ deposit }: TProps) => {
<Box>
amount:{' '}
{(deposit.amount / precision).toLocaleString(locale, localeOptions)}{' '}
{gnosisSafeConfig.tokens[0].name}
{getSymbolFromContactAddress(deposit.tokenAddr)}
</Box>
<Box sx={noWrapStyle}>
tx hash:{' '}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/Withdrawal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Box, Link, Tooltip, Typography } from '@mui/material'
import React, { FC, useContext } from 'react'
import { GnosisSafeContext } from '../contexts'
import { TWithdrawal } from '../types'
import { getSymbolFromContactAddress } from '../utils/ercTokens'

type TProps = {
withdrawal: TWithdrawal
Expand Down Expand Up @@ -42,7 +43,7 @@ export const Withdrawal: FC<TProps> = ({ withdrawal }: TProps) => {
<Box>
amount:{' '}
{(withdrawal.amount / precision).toLocaleString(locale, localeOptions)}{' '}
{gnosisSafeConfig.tokens[0].name}
{getSymbolFromContactAddress(withdrawal.tokenAddr)}
</Box>
<Box sx={noWrapStyle}>
tx hash:{' '}
Expand Down
19 changes: 19 additions & 0 deletions frontend/src/utils/ercTokens.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import { Tooltip } from '@mui/material'

export const ERC_SYMBOLS = {
'0x196f4727526eA7FB1e17b2071B3d8eAA38486988': 'RSV',
'0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F': 'eUSD',
'0xeC76FbFD75481839e456C4cb2cd23cda813f19B1':
'geUSD' /* goerli testnet token */,
}

export function getSymbolFromContactAddress(contactAddress: string) {
return (
ERC_SYMBOLS[contactAddress as keyof typeof ERC_SYMBOLS] ?? (
<Tooltip title="Unknown ERC token">
<span>?</span>
</Tooltip>
)
)
}
2 changes: 1 addition & 1 deletion mainnet.gnosis-safe.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F"
],
"name": "eUSD",
"symbol": "Token",
"symbol": "Electronic Dollar",
"decimals": 18,
"logo_uri": "",
"aux_burn_contract_addr": "0x76BD419fBa96583d968b422D4f3CB2A70bf4CF40",
Expand Down

0 comments on commit 81e7798

Please sign in to comment.