dappuniversity / token_sale

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

Balance of token sale contract #29

Closed ryanfalzon closed 2 years ago

ryanfalzon commented 4 years ago

Hi,

In the smart contract tests we commission 75% of the tokens to the sale smart contract. however this is not done when we deploy contracts to use fo the front-end. This gives an error as when I try to buy some tokens, the balance of the contract instantiating the transfer function is empty. Can you please point me to what I am missing?

Thanks :)

olekashiwa commented 4 years ago

Hi, I am planning to buy some tokens, so I had no experience yet.

Madeindreams commented 4 years ago

@ryanfalzon

This is to be expected because the token sale contract doesn't have any tokens yet. The initial transfer to the contract is made with truffle console. However, since the contract has an address it would probably be possible, once fully deployed on the main network with a valid and official address, to send some tokens back to the contract, but the app.js file is using predetermined variable to set the amount of available tokens to be purchased. So this part of the app would need to be updated to get the available tokens from the contract address balance in order to keep track of the available token for sale by the contract. This is one of the step i'm planning to add on my version.