Practice exercises, Quizzes FAQ — Udacity Blockchain

Alvaro Andres Pinzon Cortes
1 min readMar 22, 2019

--

5. Identity and Smart Contracts

Lesson 2: Smart Contracts with Solidity

  1. At Lesson 2- Smart Contract and Solidity, 22. Creating ERC-20 with OpenZeppelin, I successfully run truffle migrate --reset --network rinkeby and deploy SampleToken.sol contract to Rinkeby Testnet, but why the custom token UET is 0 when I added it to MetaMask?

The problem is the following. The balance is metamask that is going to appear is:

balance = _initialSupply / 10^_decimals

So if you have the values from the lectures

balance = _initialSupply / 10^_decimals
balance = 1000 / (10¹⁹)
balance ≈ 0

To fix it try:

_initialSupply = 1000
_decimals = 10
balance = 1000 / 100 = 10

--

--

No responses yet