Creating our Token Discussion


#1

Welcome to the discussion about this section. Here you can ask questions or post feedback about this specific section.


#2

Hello @filip , is it necessary to inherit from both ERC20 and ERC20Detailed contracts? What I mean is that ERC20Detailed itself inherits from ERC20 contract so our GameToken should have both ERC20 and ERC20Detailed types and all their (protected and public) members and functions, right? Or Solidity works differently than most OOP languages in this case?
Thanks for reply, cheers, Petr


#3

Good question. You do need both. Because ERC20Detailed actually doesn’t inherit from the ERC20 contract. It just inherits the interface, IERC20, which forces you to implement the ERC20 as well.


#4

Ah, sure, I didn’t notice that Detailed just implements IERC20 interface, not inheriting the contract itself (always hated convention of starting interface names with I :smiley: )


#5

I am on the Deploying Our Token section, and when I try to execute the ‘compile’ or ‘migrate’ commands, nothing happens at all, no errors, no messages. BTW, I run truffle develop when in the Solidity folder itself. Stuck.


#6

@filip will help you out soon!


#7

could you send me a screenshot of what’s happening in the terminal?


#8

Hej guys, thanks for the quick response. Below is another attempt to get it ruuning. Do I need to have something else ruuning when doing this like ganashe or?
ps: i replaced the private keys below with xxxs
thanks again!

Last login: Mon Feb 11 14:29:27 on ttys000

homes-MacBook-Pro:~ homeaccount$ cd /Users/homeaccount/Downloads/Blockchain\ Projects/Simple\ Game/Solidity

homes-MacBook-Pro:Solidity homeaccount$ truffle init

:heavy_check_mark: Preparing to download

:heavy_check_mark: Downloading

contracts already exists in this directory…

? Overwrite contracts? No

migrations already exists in this directory…

? Overwrite migrations? No

test already exists in this directory…

? Overwrite test? No

truffle-config.js already exists in this directory…

? Overwrite truffle-config.js? No

:heavy_check_mark: Cleaning up temporary files

:heavy_check_mark: Setting up box

Unbox successful. Sweet!

Commands:

Compile: truffle compile

Migrate: truffle migrate

Test contracts: truffle test

homes-MacBook-Pro:Solidity homeaccount$ truffle develop

Truffle Develop started at http://127.0.0.1:9545/

Accounts:

(0) 0x7d00795eb918d3e739bfd09b88b826f415af81fb

(1) 0x926300809c24e5cf7904c870909254d1c2ee1e47

(2) 0x75e104065e3f3e3d4289b323471cbf77f77fc068

(3) 0xa3ddb2bfbdb91e177fde57a1c4f3d17ad3771424

(4) 0x11573588a0d2498151aae312d26779687a437c26

(5) 0xac820b00663c2aaa152d93f6ac5548a6b873d848

(6) 0xa4486d270c7429667a80d807d4acc6ec89c35d65

(7) 0xa80a42292bbd448b3ca5f1dcc975d732b56a51f8

(8) 0x6385c17baa2ce3f0927465e6e1c54c39e99d5cf1

(9) 0x119c6beac5589d4dc3e114731948c1b3f351d48a

Private Keys:

(0) xxx

(1) xxx

(2) xxx

(3) xxx

(4) xxx

(5) xxx

(6) xxx

(7) xxx

(8) xxx

(9) xxx

Mnemonic: math drastic diagram fit aisle tiger hood orbit inmate danger master token

:warning: Important :warning: : This mnemonic was created for you by Truffle. It is not secure.

Ensure you do not use it on production blockchains, or else you risk losing funds.

truffle(develop)> compile


#9

I just noticed that backward slashes are replacing spaces in the folder names! I guess I should have spaces in folder names. See below:

homes-MacBook-Pro:~ homeaccount$ cd /Users/homeaccount/Downloads/Blockchain\ Projects/Simple\ Game/Solidity

Ok, I just changed the folder names so there are no more slashes and it now looks like this:

homes-MacBook-Pro:BlockchainProjects homeaccount$ cd /Users/homeaccount/Downloads/BlockchainProjects/SimpleGame/Solidity

Unfortunately, the compile still doesn’t work. Nothing happens at all, just a cursor waiting for input below the compile command. Any help would be great, thanks.


#10

Thank you. The backslashes shouldn’t be a problem.

I don’t see any wrong there. What truffle version do you have? Could you zip your directory with all the files and send it to me? I need your files in order to continue to debug.


#11

Hello Filip,

Here is what I find:

Last login: Thu Feb 14 07:06:47 on ttys000

homes-MacBook-Pro:~ homeaccount$ truffle version

Truffle v5.0.3 (core: 5.0.3)

Solidity v0.5.0 (solc-js)

Node v11.9.0

homes-MacBook-Pro:~ homeaccount$


#12

Could you send me your code in anyway? And screenshot your terminal please.


#13

Hello @filip, just curious about the method demonstrated to access the contract (note I paused the video to ask so if this is answered later in the video forgive me and feel free to ignore this question :slight_smile: ). I had learned to set the contract to a local variable and then call that:
truffle(develop)> GameToken.deployed().then(function(instance){app=instance;})
undefined
truffle(develop)> app.totalSupply()
<BN: 0>
truffle(develop)>

Is there a cost (meaning time, memory use, etc) to using await instead?

Thanks,

David