dappuniversity / token_sale

Code Your Own Cryptocurrency & ICO on Ethereum | Tutorial
406 stars 387 forks source link

VM Exception: Blank Address + Cannot Purchase More Tokens Than Available #25

Closed officialfrancismendoza closed 5 years ago

officialfrancismendoza commented 5 years ago

Hey everyone. I was testing my UI and I got an offshoot of the posted "VM exception while processing transaction revert" error, but detailing a purchase of more tokens than available

Refer to the four screenshots below. The first is the default loading page. I will initially purchase 1 DAPP token. image image

Upon stepping through the transaction, it then gets rejected due to overstepping a balance image

As you can see from my DappToken.sol file, I have a circulating supply of 75000 tokens.. how could I possibly overstep the balance? I then reasoned its not the circulating supply- it's one of the functions. Is my reasoning on the right track? image

From my DappTokenSale.sol file, I have isolated the function triggering this error message image

When going into truffle console and investigating possible errors, I noticed the tokenSale address is undefined.. why? As per the second screenshot, I was able to link the Ganache test account to Metamask, which is automatically preloaded with 100 fake ETH.. how could I have an undefined address? image

Forgive me, as I am a novice programmer and am still learning. Please point me in the right direction

officialfrancismendoza commented 5 years ago

Solution: Apparently the addresses are undefined in Windows.. switched to Ubuntu and somehow values got returned. Within Gregory's video lecture, at roughly 6:36:00 he types in commands to load tokens into the smart contract to have it execute.

I originally went off a fork that was using the newest version of Truffle and Solidity, but uninstalled them both and used the version Gregory used in his tutorial.

You cannot successfully execute a transaction if you do not load your smart contract first.