Skip to content

Commit

Permalink
feat(ifo): Added token decimals (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
hachiojidev committed Dec 23, 2020
1 parent 951ca92 commit 0f199ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/sushi/lib/constants/ifo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ifos: Ifo[] = [
projectSiteUrl: 'https://blink.wink.org',
currency: 'CAKE-BNB LP',
currencyAddress: '0xA527a61703D82139F8a06Bc30097cC9CAA2df5A6',
tokenDecimals: 6,
},
{
id: 'ditto',
Expand All @@ -34,6 +35,7 @@ const ifos: Ifo[] = [
projectSiteUrl: 'https://ditto.money/',
currency: 'CAKE-BNB LP',
currencyAddress: '0xA527a61703D82139F8a06Bc30097cC9CAA2df5A6',
tokenDecimals: 9,
},
]

Expand Down
1 change: 1 addition & 0 deletions src/sushi/lib/constants/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface Ifo {
projectSiteUrl: string
currency: string
currencyAddress: string
tokenDecimals: number
}

export enum QuoteToken {
Expand Down
4 changes: 3 additions & 1 deletion src/views/Ifo/components/IfoCard/IfoCardContribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface Props {
contract: Contract
status: IfoStatus
raisingAmount: BigNumber
tokenDecimals: number
}

const IfoCardContribute: React.FC<Props> = ({
Expand All @@ -27,6 +28,7 @@ const IfoCardContribute: React.FC<Props> = ({
contract,
status,
raisingAmount,
tokenDecimals,
}) => {
const [pendingTx, setPendingTx] = useState(false)
const [offeringTokenBalance, setOfferingTokenBalance] = useState(new BigNumber(0))
Expand Down Expand Up @@ -98,7 +100,7 @@ const IfoCardContribute: React.FC<Props> = ({
isFinished
? userInfo.claimed
? 'Claimed'
: getBalanceNumber(offeringTokenBalance, 6).toFixed(4)
: getBalanceNumber(offeringTokenBalance, tokenDecimals).toFixed(4)
: getBalanceNumber(new BigNumber(userInfo.amount)).toFixed(4)
}
onClick={isFinished ? claim : onPresentContributeModal}
Expand Down
2 changes: 2 additions & 0 deletions src/views/Ifo/components/IfoCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const IfoCard: React.FC<IfoCardProps> = ({ ifo }) => {
projectSiteUrl,
currency,
currencyAddress,
tokenDecimals,
} = ifo
const [state, setState] = useState({
isLoading: true,
Expand Down Expand Up @@ -152,6 +153,7 @@ const IfoCard: React.FC<IfoCardProps> = ({ ifo }) => {
contract={contract}
status={state.status}
raisingAmount={state.raisingAmount}
tokenDecimals={tokenDecimals}
/>
)}
<IfoCardDescription description={description} />
Expand Down

0 comments on commit 0f199ae

Please sign in to comment.