Skip to content

Commit 0f199ae

Browse files
authored
feat(ifo): Added token decimals (#234)
1 parent 951ca92 commit 0f199ae

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/sushi/lib/constants/ifo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const ifos: Ifo[] = [
1717
projectSiteUrl: 'https://blink.wink.org',
1818
currency: 'CAKE-BNB LP',
1919
currencyAddress: '0xA527a61703D82139F8a06Bc30097cC9CAA2df5A6',
20+
tokenDecimals: 6,
2021
},
2122
{
2223
id: 'ditto',
@@ -34,6 +35,7 @@ const ifos: Ifo[] = [
3435
projectSiteUrl: 'https://ditto.money/',
3536
currency: 'CAKE-BNB LP',
3637
currencyAddress: '0xA527a61703D82139F8a06Bc30097cC9CAA2df5A6',
38+
tokenDecimals: 9,
3739
},
3840
]
3941

src/sushi/lib/constants/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface Ifo {
1515
projectSiteUrl: string
1616
currency: string
1717
currencyAddress: string
18+
tokenDecimals: number
1819
}
1920

2021
export enum QuoteToken {

src/views/Ifo/components/IfoCard/IfoCardContribute.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface Props {
1818
contract: Contract
1919
status: IfoStatus
2020
raisingAmount: BigNumber
21+
tokenDecimals: number
2122
}
2223

2324
const IfoCardContribute: React.FC<Props> = ({
@@ -27,6 +28,7 @@ const IfoCardContribute: React.FC<Props> = ({
2728
contract,
2829
status,
2930
raisingAmount,
31+
tokenDecimals,
3032
}) => {
3133
const [pendingTx, setPendingTx] = useState(false)
3234
const [offeringTokenBalance, setOfferingTokenBalance] = useState(new BigNumber(0))
@@ -98,7 +100,7 @@ const IfoCardContribute: React.FC<Props> = ({
98100
isFinished
99101
? userInfo.claimed
100102
? 'Claimed'
101-
: getBalanceNumber(offeringTokenBalance, 6).toFixed(4)
103+
: getBalanceNumber(offeringTokenBalance, tokenDecimals).toFixed(4)
102104
: getBalanceNumber(new BigNumber(userInfo.amount)).toFixed(4)
103105
}
104106
onClick={isFinished ? claim : onPresentContributeModal}

src/views/Ifo/components/IfoCard/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const IfoCard: React.FC<IfoCardProps> = ({ ifo }) => {
7373
projectSiteUrl,
7474
currency,
7575
currencyAddress,
76+
tokenDecimals,
7677
} = ifo
7778
const [state, setState] = useState({
7879
isLoading: true,
@@ -152,6 +153,7 @@ const IfoCard: React.FC<IfoCardProps> = ({ ifo }) => {
152153
contract={contract}
153154
status={state.status}
154155
raisingAmount={state.raisingAmount}
156+
tokenDecimals={tokenDecimals}
155157
/>
156158
)}
157159
<IfoCardDescription description={description} />

0 commit comments

Comments
 (0)