WA-232 Reusing standard token

This commit is contained in:
apanizo 2018-07-05 17:56:36 +02:00
parent 6467a1a0d6
commit afe7d4fc2f
1 changed files with 5 additions and 1 deletions

View File

@ -7,9 +7,11 @@ import { getBalanceInEtherOf, getWeb3 } from '~/wallets/getWeb3'
import { type GlobalState } from '~/store/index'
import { makeBalance, type Balance, type BalanceProps } from '~/routes/safe/store/model/balance'
import logo from '~/assets/icons/icon_etherTokens.svg'
import { ensureOnce } from '~/utils/singleton'
import addBalances from './addBalances'
export const getStandardTokenContract = async () => {
const createStandardTokenContract = async () => {
const web3 = getWeb3()
const erc20Token = await contract(StandardToken)
erc20Token.setProvider(web3.currentProvider)
@ -17,6 +19,8 @@ export const getStandardTokenContract = async () => {
return erc20Token
}
export const getStandardTokenContract = ensureOnce(createStandardTokenContract)
export const calculateBalanceOf = async (tokenAddress: string, address: string, decimals: number) => {
const erc20Token = await getStandardTokenContract()