Skip to content

Commit 75b4b42

Browse files
author
qiaolinfei
committed
fix transfer/show token precise problem
1 parent 95506af commit 75b4b42

File tree

1 file changed

+4
-2
lines changed
  • basic/09-hardhat-react/frontend/src/components

1 file changed

+4
-2
lines changed

basic/09-hardhat-react/frontend/src/components/Dapp.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ export class Dapp extends React.Component {
107107
<p>
108108
Welcome <b>{this.state.selectedAddress}</b>, you have{' '}
109109
<b>
110-
{this.state.balance.toString()} {this.state.tokenData.symbol}
110+
{/* show human read balance (deployed contract with precise 1 in /scripts/deploy.js) */}
111+
{this.state.balance/10} {this.state.tokenData.symbol}
111112
</b>
112113
.
113114
</p>
@@ -159,7 +160,8 @@ export class Dapp extends React.Component {
159160
{this.state.balance.gt(0) && (
160161
<Transfer
161162
transferTokens={(to, amount) =>
162-
this._transferTokens(to, amount)
163+
// convert to contract precise amount
164+
this._transferTokens(to, amount*10**1)
163165
}
164166
/>
165167
)}

0 commit comments

Comments
 (0)